|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2019-04-09 15:31 UTC] nikic@php.net
[2019-04-09 15:39 UTC] nicolas dot grekas+php at gmail dot com
[2021-08-06 19:10 UTC] cmb@php.net
-Summary: private/protected __serialize/__unserialize triggers
a warning
+Summary: private/protected __serialize/__unserialize should
throw Error
-Type: Bug
+Type: Feature/Change Request
[2021-08-06 19:10 UTC] cmb@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Nov 02 08:00:02 2025 UTC |
Description: ------------ When the new __serialize/__unserialize method are made protected or private, a warning is thrown. Throwing an Error might be better. Test script: --------------- class foo { private function __serialize() { return [123]; } public function __unserialize($a) { } } $f = new foo(); $s = serialize($f); Expected result: ---------------- "Fatal error: Uncaught Error: Call to private method foo::__serialize()" or similar Actual result: -------------- Warning: Invalid callback foo::__serialize, cannot access private method foo::__serialize() in /var/www/html/test.php on line 22