php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #76737 Unserialized reflection objects are broken, but they shouldn't be serializable
Submitted: 2018-08-13 14:13 UTC Modified: 2018-09-29 12:49 UTC
Votes:1
Avg. Score:3.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: nicolas dot grekas+php at gmail dot com Assigned: nikic (profile)
Status: Closed Package: Reflection related
PHP Version: 7.1Git-2018-08-13 (Git) OS:
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: nicolas dot grekas+php at gmail dot com
New email:
PHP Version: OS:

 

 [2018-08-13 14:13 UTC] nicolas dot grekas+php at gmail dot com
Description:
------------
When serializing any `Reflector` instance, but also `ReflectionType` and `ReflectionGenerator` (which are the only two classes of the reflection extension not implementing `Reflector` BTW), then the unserialized value is unusable and throws `Error`: "Internal error: Failed to retrieve the reflection object" on any method calls.

This is legit, but instead of this late error, these should not be serializable in the first place.



Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2018-08-14 13:25 UTC] cmb@php.net
-Status: Open +Status: Verified
 [2018-08-14 13:25 UTC] cmb@php.net
See also the related FR #62919.
 [2018-08-20 13:59 UTC] nicolas dot grekas+php at gmail dot com
Note that IteratorIterator and RecursiveIteratorIterator also shouldn't be serializable.
(and by the way, they're missing a private __clone method, same for ReflectionGenerator)
 [2018-09-29 12:48 UTC] nikic@php.net
Automatic comment on behalf of nikita.ppv@gmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=96da1fe8a906da8d2927f57ff94ed25a8e6ea411
Log: Fixed bug #76737
 [2018-09-29 12:48 UTC] nikic@php.net
-Status: Verified +Status: Closed
 [2018-09-29 12:49 UTC] nikic@php.net
-Assigned To: +Assigned To: nikic
 [2018-09-29 12:49 UTC] nikic@php.net
Fixed for master only (PHP 7.4), as this may potentially break some code unintentionally serializing reflection objects.
 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Wed May 22 19:01:32 2019 UTC