From: phil3862 at hotmail dot com Operating system: Redhat 9, 2.4.20-30.9 PHP version: 4.3.6 PHP Bug Type: DOM XML related Bug description: Method calls fail on DOM document objects passed as session variables
Description: ------------ Method calls fail on DOM document objects passed as session variables. This happens whether you pass the DOM document object itself or a reference to the object as a session variable. If you serialize and unserialize an object reference to a DOM document object without passing it as a session variable, it works fine: <?php /** * This test shows that a reference to a DOM object can be * serialized and unserialized and still be used. */ $xml = "<?xml version='1.0' ?><foo><bar>Hoot!</bar></foo>"; $foo =& domxml_open_mem($xml); $foo = unserialize(serialize($foo)); print $foo->dump_mem(); ?> Reproduce code: --------------- <?php session_start(); /** * This code tests method calls on a reference to a DOM object that * has been passed as a session variable. */ if (session_is_registered('foo')) { $_SESSION['foo']->dump_mem(); session_unregister('foo'); } else { print "Creating reference to new DOM object as a session variable..."; session_register('foo'); $xml = "<?xml version='1.0' ?><foo><bar>Hoot!</bar></foo>"; $_SESSION['foo'] =& domxml_open_mem($xml); } ?> <?php session_start(); /** * This code tests method calls on a DOM object that has been passed * as a session variable. */ if (session_is_registered('foo')) { $_SESSION['foo']->dump_mem(); session_unregister('foo'); } else { print "Creating new DOM object as a session variable..."; session_register('foo'); $xml = "<?xml version='1.0' ?><foo><bar>Hoot!</bar></foo>"; $_SESSION['foo'] = domxml_open_mem($xml); } ?> Expected result: ---------------- Both of these scripts should print the original xml source. Actual result: -------------- Warning: dump_mem(): Underlying object missing or of invalid type in /home/jks/public_html/auctionhawk/projects/item_specifics/session-tests/reftest5a.php on line 11 Warning: dump_mem(): Cannot fetch DOM object in /home/jks/public_html/auctionhawk/projects/item_specifics/session-tests/reftest5a.php on line 11 -- Edit bug report at http://bugs.php.net/?id=28160&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=28160&r=trysnapshot4 Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=28160&r=trysnapshot5 Fixed in CVS: http://bugs.php.net/fix.php?id=28160&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=28160&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=28160&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=28160&r=needscript Try newer version: http://bugs.php.net/fix.php?id=28160&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=28160&r=support Expected behavior: http://bugs.php.net/fix.php?id=28160&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=28160&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=28160&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=28160&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=28160&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=28160&r=dst IIS Stability: http://bugs.php.net/fix.php?id=28160&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=28160&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=28160&r=float