|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #81667 Error on serialization with MongoDB class
Submitted: 2021-11-27 12:29 UTC Modified: 2021-12-01 18:30 UTC
From: giacomo dot fabbian at gmail dot com Assigned:
Status: Not a bug Package: *General Issues
PHP Version: 7.4.26 OS:
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
Solve the problem:
13 + 48 = ?
Subscribe to this entry?

 [2021-11-27 12:29 UTC] giacomo dot fabbian at gmail dot com
My application is based on Laravel and MongoDB. Serialization is often used  in this framework for session and emit event. When I try to pass a MongoDB model with nested data with more than 2 level the serialization() not working. The only workaround that I have found is to cast data into array of object.
Is there a way to fix this without casting?


Actual result:
I got this exception: Serialization of 'MongoDB\Driver\Manager' is not allowed


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2021-11-27 12:49 UTC]
-Status: Open +Status: Not a bug
 [2021-11-27 12:49 UTC]
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit as this bug system is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.

 [2021-12-01 14:05 UTC] giacomo dot fabbian at gmail dot com
-Summary: Error on serialization with MongoDB class +Summary:
 [2021-12-01 14:05 UTC] giacomo dot fabbian at gmail dot com
I open an issue here because serialize() function is part of PHP core and the function has to work with any type of class and with deep nested data.
 [2021-12-01 18:30 UTC]
-Summary: +Summary: Error on serialization with MongoDB class
 [2021-12-01 18:30 UTC]
1. We don't manage the MongoDB driver.
2. The Manager class explicitly declared that it does not to allow serialization.

If you believe that the Manager class should allow serialization then file a bug against that project.
 [2021-12-01 23:11 UTC] giacomo dot fabbian at gmail dot com
ok thank you for your reply
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Jul 16 15:01:28 2024 UTC