#28163 [Opn->Bgs]: Method calls fail on DOM document objects passed as session variables
| From: | derick@php.net | Date: | Mon, 26 Apr 2004 18:10:52 +0000 |
| Subject: | #28163 [Opn->Bgs]: Method calls fail on DOM document objects passed as session variables | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-58811@lists.php.net to get a copy of this message | ||
ID: 28163
Updated by: derick@php.net
Reported By: phil3862 at hotmail dot com
-Status: Open
+Status: Bogus
Bug Type: DOM XML related
Operating System: Redhat 9, 2.4.20-30.9
PHP Version: 4.3.6
New Comment:
Sorry, but your problem does not imply a bug in PHP itself. For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system
is not the
appropriate forum for asking support questions.
Thank you for your interest in PHP.
.
Previous Comments:
------------------------------------------------------------------------
[2004-04-26 18:30:43] phil3862 at hotmail dot com
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:
--------------
Both fail with "Warning: dump_mem(): Underlying object missing or of
invalid type" followed by "Warning: dump_mem(): Cannot fetch DOM
object" error.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=28163&edit=1