|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
Patchesbug55326.diff (last revision 2011-07-31 03:17 UTC by cataphract@php.net)Pull RequestsHistoryAllCommentsChangesGit/SVN commits
[2011-07-31 03:17 UTC] cataphract@php.net
[2011-07-31 12:27 UTC] felipe@php.net
[2011-07-31 12:28 UTC] felipe@php.net
-Status: Open
+Status: Closed
-Assigned To:
+Assigned To: felipe
[2011-07-31 12:28 UTC] felipe@php.net
[2012-04-18 09:49 UTC] laruence@php.net
[2012-07-24 23:40 UTC] rasmus@php.net
[2013-11-17 09:37 UTC] laruence@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Oct 29 12:00:01 2025 UTC |
Description: ------------ _ADD_MAGIC_METHOD in zend_compile.c identifies "serialize_func" and "unserialize_func" as magic methods and copies them to ce->serialize_func and ce->unserialize_func. The correct names are "serialize" and "unserialize". These names could be changed, or, better yet, those two lines should be deleted because the methods serialize and unserialize are only relevant if the class implements Serializable (or, more precisely, if ce->serialize and ce->unserialize are zend_user_serialize and zend_user_unserialize, respectively, and in any case ce->serialize_func and ce->unserialize_func work only as a lazy cache. Test script: --------------- <?php trait A { function serialize_func() { return "serialize_func"; } function serialize() { return "serialize"; } function unserialize($foo) {} } class B implements Serializable { use A; } echo serialize(new B); Expected result: ---------------- C:1:"B":9:{serialize} Actual result: -------------- C:1:"B":14:{serialize_func}