-
Type: Bug
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: None
-
None
-
PHP Drivers
-
Not Needed
-
test script :
<?php function foo(array &$value): void {} $typeMap = ['fieldPaths' => []]; foo($typeMap['fieldPaths']); MongoDB\BSON\Document::fromPHP([])->toPHP($typeMap);
Unexpected error:
PHP Fatal error: Uncaught MongoDB\Driver\Exception\InvalidArgumentException: The 'fieldPaths' element is not an array in typemap.php:6 Stack trace: #0 typemap.php(25): MongoDB\BSON\Document->toPHP(Array) #1 {main} thrown in typemap.php on line 6
If we remove the call to the function, there is no error.
PHPC version: 5518255188be716bbab0b3f2aef7a862ccaf0c87
php --ri mongodb MongoDB support => enabled MongoDB extension version => 1.21.0dev MongoDB extension stability => devel libbson bundled version => 1.28.0 libmongoc bundled version => 1.28.0 libmongoc SSL => enabled libmongoc SSL library => OpenSSL libmongoc crypto => enabled libmongoc crypto library => libcrypto libmongoc crypto system profile => disabled libmongoc SASL => enabled libmongoc SRV => enabled libmongoc compression => enabled libmongoc compression snappy => disabled libmongoc compression zlib => enabled libmongoc compression zstd => enabled libmongocrypt bundled version => 1.11.0 libmongocrypt crypto => enabled libmongocrypt crypto library => libcrypto crypt_shared library version => unknownDirective => Local Value => Master Value mongodb.debug => no value => no value
php -v PHP 8.3.8 (cli) (built: Jun 4 2024 14:53:17) (NTS) Copyright (c) The PHP Group Zend Engine v4.3.8, Copyright (c) Zend Technologies with Zend OPcache v8.3.8, Copyright (c), by Zend Technologies with Xdebug v3.3.1, Copyright (c) 2002-2023, by Derick Rethans
Context:
I tracked this issue when upgrading to PHPUnit 10.
The test FunctionTest::testApplyTypeMapToDocument #2 fails
The bug appears on phpunit/phpunit b
color: Color value is invalid
etween 10.5.3 and 10.5.4
With the commit https://github.com/sebastianbergmann/phpunit/commit/5d049893b805733369a72dab5b92556a1f665eb9
At some point, it calls sebastian/recursion-context 5.0.0, the method https://github.com/sebastianbergmann/recursion-context/blob/5.0/src/Context.php#L69
This method call creates this error.
- has to be done before
-
PHPLIB-1369 Update test suite to use PHPUnit 10
- Closed