#49800 [NEW]: SimpleXML allow serialize() calls without warning
| From: | wmeler at wp-sa dot pl | Date: | Wed, 07 Oct 2009 09:09:45 +0000 |
| Subject: | #49800 [NEW]: SimpleXML allow serialize() calls without warning | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-143345@lists.php.net to get a copy of this message | ||
From: wmeler at wp-sa dot pl
Operating system: any
PHP version: 5.3.0
PHP Bug Type: SimpleXML related
Bug description: SimpleXML allow serialize() calls without warning
Description:
------------
simplexml allows serialization which can (and should) be easily forbidden
with following patch
--- php-5.3.0/ext/simplexml/simplexml.c 2009-06-11 11:41:15.000000000
+0200
+++ arisphp5/php/ext/simplexml/simplexml.c 2009-10-06
18:39:54.000652000 +0200
@@ -2526,6 +2526,8 @@
sxe_class_entry = zend_register_internal_class(&sxe TSRMLS_CC);
sxe_class_entry->get_iterator = php_sxe_get_iterator;
sxe_class_entry->iterator_funcs.funcs = &php_sxe_iterator_funcs;
+ sxe_class_entry->serialize = zend_class_serialize_deny;
+ sxe_class_entry->unserialize = zend_class_unserialize_deny;
zend_class_implements(sxe_class_entry TSRMLS_CC, 1,
zend_ce_traversable);
sxe_object_handlers.get_method =
zend_get_std_object_handlers()->get_method;
sxe_object_handlers.get_constructor =
zend_get_std_object_handlers()->get_constructor;
Reproduce code:
---------------
<?
echo serialize(simplexml_load_string("<xml/>"));
Expected result:
----------------
Exception: Serialization of 'SimpleXMLElement' is not allowed in ...
Actual result:
--------------
O:16:"SimpleXMLElement":0:{}
--
Edit bug report at http://bugs.php.net/?id=49800&edit=1
--
Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=49800&r=trysnapshot52
Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=49800&r=trysnapshot53
Try a snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=49800&r=trysnapshot60
Fixed in SVN: http://bugs.php.net/fix.php?id=49800&r=fixed
Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=49800&r=needdocs
Fixed in release: http://bugs.php.net/fix.php?id=49800&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=49800&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=49800&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=49800&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=49800&r=support
Expected behavior: http://bugs.php.net/fix.php?id=49800&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=49800&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=49800&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=49800&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=49800&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=49800&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=49800&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=49800&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=49800&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=49800&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=49800&r=mysqlcfg