Arch devs,
After update tonight of
php-legacy-mongodb-2.0.0-1-x86_64.pkg.tar.zst, accessing mongodb through
PHP results in the error:
[Sat Apr 12 01:25:20.286158 2025] [php:error] [pid 685:tid 685] [client
192.168.6.224:53078] PHP Fatal error: Declaration of
MongoDB\\Model\\BSONArray::bsonSerialize() must be compatible with
MongoDB\\BSON\\Serializable::bsonSerialize():
stdClass|MongoDB\\BSON\\Document|MongoDB\\BSON\\PackedArray|array in
/srv/http/vendor/mongodb/mongodb/src/Model/BSONArray.php on line 74,
referer: https://2pi.3111skyline.com/tmp/db/jnl-grid/
This has never happened before and it is pointing to one of the
package files. I updated all composer mongodb/mongodb files thinking
that may help. It didn't. I also built php-legacy-mongodb from:
https://gitlab.archlinux.org/archlinux/packaging/packages/php-mongodb/-/tree/61f5592dccd0c30a7e7a98c6c1e7ff9d728246e1
And downgraded, restarted httpd and everything works fine again.
New bug or is there some known break with backwards compatibility?
The changelog on Serializable::bsonSerialize makes no mention of a break:
https://www.php.net/manual/en/mongodb-bson-serializable.bsonserialize.php
--
David C. Rankin, J.D.,P.E.