php.net |  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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: giacomo dot fabbian at gmail dot com
New email:
PHP Version: OS:

 

 [2021-11-27 12:29 UTC] giacomo dot fabbian at gmail dot com
Description:
------------
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?

Thanks

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

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2021-11-27 12:49 UTC] requinix@php.net
-Status: Open +Status: Not a bug
 [2021-11-27 12:49 UTC] requinix@php.net
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 http://www.php.net/support.php 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: giacomo.fabbian@gmail.com
 [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] requinix@php.net
-Summary: giacomo.fabbian@gmail.com +Summary: Error on serialization with MongoDB class
 [2021-12-01 18:30 UTC] requinix@php.net
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.
https://github.com/mongodb/mongo-php-driver
 [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 Dec 03 05:01:32 2024 UTC