[php-maint] pear package for XML_Parser

Thomas Goirand thomas at goirand.fr
Thu May 27 09:40:05 UTC 2010


Hi there,

I have been using the pear package XML_Parser, which currently has 2 issues:

1/ It uses eregi instead of preg_match. The solution here is obvious. As
the maintainer wants to keep compatibility with php4 (which I think is
stupid because it's been since 2007 that php4 is not supported, but hey,
not my decision...), I suggested the following:

$regexp = "^testit\$";
if (version_compare( phpversion(), '5.3.0') >= 0){
  $check_result = prereg_match( "/" . $regexp . "/i" , $myvar);
}else{
  $check_result = eregi( $regexp , $myvar);
}

which will be ok.

2/ It uses a code like this:

  $err = &new XML_Parser_Error($msg, $ecode);
  return parent::raiseError($err);

which raises a deprecated warning in PHP. I'm not so fan of OOP (I got a
background of assembly programmer, and my mind is too much set with
procedures, even though I understand all the concept of OOP and even
implemented polymorphism and such in assembly 68k). I never used "return
a reference", and I'm not sure what to give as advice to the upstream
author.

Can one of you (maybe Raphael) tell me what should be done to fix the
issue with php >= 5.3 ? Should the & be just removed, and that's it?

As a reference, this is what I'm trying to deal with:

http://pear.php.net/bugs/bug.php?id=16567&thanks=3

Thomas



More information about the pkg-php-maint mailing list