php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #20899 DOM Objects saved in current session can't be accessed after the initial page
Submitted: 2002-12-09 05:30 UTC Modified: 2002-12-09 05:36 UTC
Votes:1
Avg. Score:4.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: jalonso at art3mis dot com Assigned:
Status: Wont fix Package: DOM XML related
PHP Version: 4.3.0RC2 OS: Debian Linux 3.0
Private report: No CVE-ID: None
 [2002-12-09 05:30 UTC] jalonso at art3mis dot com
Imagine this scenario: You load an XML file (with configuration data) into the current session along with some custom methods to change data in the XML object in memory to , finally, save your changes.

But actually you can't use DOM Methods like dump_mem() after registering your DOM object in the current session.

Try this script:

-------------------------------------
<?php
session_start();

if (!isset($_SESSION['doc']))
  $_SESSION['doc'] = domxml_open_file('lalala.xml');

$_SESSION['doc']->dump_mem();
?>
<a href="<?=$_SERVER['SCRIPT_NAME']?>">click</a>
--------------------------------------

lalala.xml is a valid xml file.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-12-09 05:36 UTC] chregu@php.net
This is not possible and most presumably never will be possible. We would have to store the actual xml-data somewhere, but php knows only the pointer to the xml-data which is handled by the libxml2-library and this stuff gets freed after script-end.

you have to parse and save it everytime or use your own xml-structure built with php-objects, like maybe XML_Tree from PEAR (never tested that, though)

chregu
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Dec 10 22:01:28 2024 UTC