|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #6671 using the XML parser in a class does not seem to work any longer
Submitted: 2000-09-12 02:05 UTC Modified: 2002-06-18 18:13 UTC
From: d dot roche at lectra dot com Assigned:
Status: Closed Package: XML related
PHP Version: 4.0.2 OS: Linux RedHat 6.2
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: d dot roche at lectra dot com
New email:
PHP Version: OS:


 [2000-09-12 02:05 UTC] d dot roche at lectra dot com
here is a little script which works with php4.0.1pl2
and crash ( Segmentation fault (11) ) with php4.0.2 !

both version where compiled with :
./configure  --disable-debug --with-apxs=/usr/sbin/apxs --with-regex=system --with-zlib --with-gd --with-db2 --with-gdbm --with-config-file-path=/etc/httpd --enable-trans-sid

the php.ini is the same for both.

========script : cut here================
<title>test xml problem</title>
<h1>test xml problem</h1>
<script language="php">

class XmlParse {

  // variable members
  var $parser;

  // constructor

  function XmlParse() {
    $this->parser = xml_parser_create();
  // handler (private) functions

  function tag_open($parser,$tag,$attributes) { 
  function tag_close($parser,$tag) { 

  function core_data($parser,$cdata) { 
  // parse (public) function

  function parse($data) { 

    if (!xml_parse($this->parser, $data, 1)) {
      $error = sprintf("XML error: %s at line %d",
      echo $error;

  // debug function

  function debug1($title,$msg) { 

    echo $title;
    echo " &laquo;";
    echo $msg;
    echo "&raquo; ";
    echo "\n";

  function viewarray($arr) { 
    $str = "";
    if ( is_array($arr) ) {
      while ( list($key,$val) = each($arr) ) {
	$str .= " ".$key."=".$val;
    return $str;


$xmldata = '<?xml version="1.0"?><tab><line><auteur>zimmer bradley</auteur><titre>la matrice fant?me</titre><serie>la romance de t?n?breuse</serie><type>ser20</type><moyenne>16</moyenne><genre>0x00000004</genre><key>0000658</key></line></tab>';

$xfx = new XmlParse();


==========cut here================

Some other tests i have made shows that XML parsing works well
with standard functions but does not work any longer with class methods.
I use xml_set_object($this->parser,&$this);

thank you for your attention !


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2000-10-30 09:43 UTC] also reports this to happen in:

PHP 4.0.2 running as ISAPI under Win98/ed1/PWS
RH6.2 and apache [various versions] 
 [2001-05-07 16:11 UTC]
This looks like a dup of 6175.

 [2002-06-18 18:13 UTC]
Thank you for your bug report. This issue has already been fixed
in the latest released version of PHP, which you can download at

PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Thu Jun 01 02:03:36 2023 UTC