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
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
MUST BE VALID
Solve the problem:
5 + 10 = ?
Subscribe to this entry?

 
 [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

Add a Patch

Pull Requests

Add a Pull Request

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: Thu Apr 25 11:01:30 2024 UTC