From c93640ec73cadd8e05bec462774b7d1c988555e4 Mon Sep 17 00:00:00 2001 From: Toni Vega <1808267+tonivega@users.noreply.github.com> Date: Sun, 20 Apr 2025 10:46:04 +0200 Subject: [PATCH] Replaced a too strict assertion in DatabaseSessionHandler that prevented to use the sessions at all with a more simple sanity check (#3366) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Set zend.assertions=1 --------- Co-authored-by: Toni Vega Co-authored-by: Jérôme Tamarelle --- .github/workflows/build-ci-atlas.yml | 2 +- .github/workflows/build-ci.yml | 2 +- phpunit.xml.dist | 2 ++ src/Session/MongoDbSessionHandler.php | 8 +++++--- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build-ci-atlas.yml b/.github/workflows/build-ci-atlas.yml index c699d2023..46f30150d 100644 --- a/.github/workflows/build-ci-atlas.yml +++ b/.github/workflows/build-ci-atlas.yml @@ -91,4 +91,4 @@ jobs: - name: "Run tests" run: | export MONGODB_URI="mongodb://127.0.0.1:27017/?directConnection=true" - ./vendor/bin/phpunit --coverage-clover coverage.xml --group atlas-search + php -d zend.assertions=1 ./vendor/bin/phpunit --coverage-clover coverage.xml --group atlas-search diff --git a/.github/workflows/build-ci.yml b/.github/workflows/build-ci.yml index 6fec7bb28..bbc8b53d1 100644 --- a/.github/workflows/build-ci.yml +++ b/.github/workflows/build-ci.yml @@ -118,4 +118,4 @@ jobs: - name: "Run tests" run: | export MONGODB_URI="mongodb://127.0.0.1:27017/?replicaSet=rs" - ./vendor/bin/phpunit --coverage-clover coverage.xml --exclude-group atlas-search + php -d zend.assertions=1 ./vendor/bin/phpunit --coverage-clover coverage.xml --exclude-group atlas-search diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 7044f9069..d7f066483 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -23,6 +23,8 @@ + + ['root' => 'bson'], ], ); - assert($result instanceof Document); - return $result ? (string) $result->payload : false; + if ($result instanceof Document) { + return (string) $result->payload; + } + + return false; } public function write($sessionId, $data): bool