php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #7186 class object variables get 'unset' when assigned within xml handlers
Submitted: 2000-10-13 11:49 UTC Modified: 2001-02-15 08:46 UTC
From: igo at ipass dot net Assigned:
Status: Closed Package: XML related
PHP Version: 4.0.3 OS: Solaris 8
Private report: No CVE-ID: None
 [2000-10-13 11:49 UTC] igo at ipass dot net
<?

require_once "XML/Parser.php";

class __TestParser1 extends XML_Parser {
  var $data;
    function __TestParser1() {
  $this->XML_Parser();
    }
    function startHandler($xp, $element, $attribs) {
    }
    function endHandler($xp, $element) {
    }
    function cdataHandler($xp, $cdata) {
      $this->data=$cdata;
    }
    function defaultHandler($xp, $cdata) {
 
    }
}
$o = new __TestParser1();
$o->parseString("<?xml version='1.0' ?><root>foo</root>",
1);
echo $o->data;  // Should print 'foo', it does not print anything

?>

No php.ini used

EXTRA_LDFLAGS="-Wl,-s" \
CPPFLAGS=$CFLAGS \
./configure \
--with-regex=system \
--enable-shared     \
--enable-track-vars \
--with-config-file-path=/usr/local/etc \
--with-mysql=/usr/local \
--enable-ftp \
--enable-xml \
--with-gd=no \
--with-db2=no \
--with-db3=no \
--with-zlib=no \

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-02-15 08:46 UTC] thies@php.net
one bug has been fixed in regards to xml_set_object in CVS

you also need to say:
$o = &new __TestParser1();
instead of 
$o = new __TestParser1();

elsewise $this in the constructor won't be the same as vale of $o once new __TestParser1() has returned!
see:
http://viewcvs.php.net/viewcvs.cgi/php4/NEWS.diff?r1=1.532.2.2&r2=1.532.2.3



 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 21:01:27 2024 UTC