Bug#580383: [php-maint] Bug#580383: Bug#580383: php-xml-parser uses deprecated eregi and reference of new object
Thijs Kinkhorst wrote: On Tue, August 31, 2010 23:28, Thomas Goirand wrote: Because of upstream insisting to support ante-diluvian version of php, and my will to have the patch upstreamed. preg_match has been available since PHP 3.0, relased 1998. cheers, Thijs Hi, I made a much much smaller patch for the package. Could you please have a look at the interdiff, and let me know what you think before I upload? Also, should I put myself in the Uploaders: list rather than doing it as an NMU? Let me know. Thomas Goirand P.S: I've submit 2 other bugs for php-xml-serializer and libnusoap-php that suffer from the same kind of issue (return of a new by reference). These will have to be fixed as well. I'll *try* to find time to work on them too. diff -u php-xml-parser-1.3.2/debian/rules php-xml-parser-1.3.2/debian/rules --- php-xml-parser-1.3.2/debian/rules +++ php-xml-parser-1.3.2/debian/rules @@ -1,5 +1,7 @@ #!/usr/bin/make -f +include /usr/share/dpatch/dpatch.make + DEB_VERSION := $(shell dpkg-parsechangelog | egrep '^Version:' | cut -f 2 -d ' ') DEB_NOEPOCH_VERSION := $(shell echo $(DEB_VERSION) | cut -d: -f2-) DEB_UPSTREAM_VERSION := $(shell echo $(DEB_NOEPOCH_VERSION) | sed 's/-[^-]*$$//') @@ -17,9 +19,10 @@ build-stamp: configure-stamp dh_testdir + dpatch apply-all touch build-stamp -clean: +clean: unpatch dh_testdir dh_testroot if [ -f $(pear_pkg)/package.xml ]; then \ diff -u php-xml-parser-1.3.2/debian/control php-xml-parser-1.3.2/debian/control --- php-xml-parser-1.3.2/debian/control +++ php-xml-parser-1.3.2/debian/control @@ -3,8 +3,8 @@ Priority: optional Maintainer: Debian PHP Maintainers pkg-php-ma...@lists.alioth.debian.org Uploaders: Thijs Kinkhorst th...@debian.org -Build-Depends: debhelper (= 7) -Standards-Version: 3.8.4 +Build-Depends: debhelper (= 7), dpatch +Standards-Version: 3.9.1 Build-Depends-Indep: php-pear Vcs-Svn: svn://svn.debian.org/pkg-php/pear/php-xml-parser/trunk Vcs-Browser: http://svn.debian.org/wsvn/pkg-php/pear/php-xml-parser/trunk diff -u php-xml-parser-1.3.2/debian/changelog php-xml-parser-1.3.2/debian/changelog --- php-xml-parser-1.3.2/debian/changelog +++ php-xml-parser-1.3.2/debian/changelog @@ -1,3 +1,13 @@ +php-xml-parser (1.3.2-1.1) unstable; urgency=low + + * Non-maintainer upload. + * Fixes PHP 5.3.x warning due to ereg() and return of a reference, which are +now deprecated (Closes: #580383). + * Bumps Standard-Version to 3.9.1. + * Added debian/source/format and debian/README.source + + -- Thomas Goirand z...@debian.org Wed, 01 Sep 2010 02:02:16 +0800 + php-xml-parser (1.3.2-1) unstable; urgency=low * New upstream release. only in patch2: unchanged: --- php-xml-parser-1.3.2.orig/debian/README.source +++ php-xml-parser-1.3.2/debian/README.source @@ -0,0 +1,14 @@ +This package uses dpatch to maintain a Debian correction, so +that XML_Parser can run in PHP 5.3.x without producing warnings. + +To apply all patches that have been added in Debian, just do: + +dpatch apply-all + +To remove these patches, do: + +dpatch deapply-all + +Enjoy! + +Thomas Goirand (z...@debian.org) only in patch2: unchanged: --- php-xml-parser-1.3.2.orig/debian/source/format +++ php-xml-parser-1.3.2/debian/source/format @@ -0,0 +1 @@ +1.0 only in patch2: unchanged: --- php-xml-parser-1.3.2.orig/debian/patches/001parser.php_compat_php_5.3.x.dpatch +++ php-xml-parser-1.3.2/debian/patches/001parser.php_compat_php_5.3.x.dpatch @@ -0,0 +1,39 @@ +#!/bin/sh /usr/share/dpatch/dpatch-run +## 001parser.php_compat_php_5.3.x.dpatch by Thomas Goirand z...@debian.org +## +## DP: This patch makes php-xml-parser work with PHP 5.3.x that is +## DP: currently the new version in Debian. It removes a return by +## DP: reference, and replaces ereg() calls by preg, as both are +## DP: deprecated in php 5.3.x, which makes PHP produces some nasty +## DP: warnings that could be annoying when outputing XML documents. + +...@dpatch@ +--- php-xml-parser-1.3.2.orig/XML_Parser-1.3.2/Parser.php 2010-09-01 18:49:24.0 +0800 php-xml-parser-1.3.2/XML_Parser-1.3.2/Parser.php 2010-09-03 17:04:52.0 +0800 +@@ -417,7 +417,7 @@ + /** + * check, if file is a remote file + */ +-if (eregi('^(http|ftp)://', substr($file, 0, 10))) { ++if (preg_match('/^(http|ftp):\/\//i', substr($file, 0, 10))) { + if (!ini_get('allow_url_fopen')) { + return $this- + raiseError('Remote files cannot be parsed, as safe mode is enabled.', +@@ -474,7 +474,7 @@ + if (is_resource($fp)) { + $this-fp = $fp; + return true; +-} elseif (eregi('^[a-z]+://', substr($fp, 0, 10))) { ++} elseif (preg_match('/^[a-z]+:\/\//i', substr($fp, 0, 10))) { + // see if it's an absolute URL (has a scheme at the beginning) + return $this-setInputFile($fp); + } elseif (file_exists($fp)) { +@@
Bug#580383: [php-maint] Bug#580383: Bug#580383: php-xml-parser uses deprecated eregi and reference of new object
On Fri, September 3, 2010 11:28, Thomas Goirand wrote: I made a much much smaller patch for the package. Could you please have a look at the interdiff, and let me know what you think before I upload? Also, should I put myself in the Uploaders: list rather than doing it as an NMU? Let me know. Diff looks fine. If you want to become responsible for the package please add yourself as an Uploader. P.S: I've submit 2 other bugs for php-xml-serializer and libnusoap-php that suffer from the same kind of issue (return of a new by reference). These will have to be fixed as well. I'll *try* to find time to work on them too. I still think it's debatable whether they're actually RC, but fixing is obviously the best way out so I'll leave you to that for now. Cheers, Thijs -- To UNSUBSCRIBE, email to debian-bugs-rc-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Bug#580383: [php-maint] Bug#580383: Bug#580383: php-xml-parser uses deprecated eregi and reference of new object
On Tue, August 31, 2010 23:28, Thomas Goirand wrote: Because of upstream insisting to support ante-diluvian version of php, and my will to have the patch upstreamed. preg_match has been available since PHP 3.0, relased 1998. cheers, Thijs -- To UNSUBSCRIBE, email to debian-bugs-rc-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Bug#580383: [php-maint] Bug#580383: Bug#580383: php-xml-parser uses deprecated eregi and reference of new object
Thijs Kinkhorst wrote: On Tue, August 31, 2010 23:28, Thomas Goirand wrote: Because of upstream insisting to support ante-diluvian version of php, and my will to have the patch upstreamed. preg_match has been available since PHP 3.0, relased 1998. cheers, Thijs Thanks for letting me know. I'll write a new patch then. Thomas -- To UNSUBSCRIBE, email to debian-bugs-rc-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Bug#580383: [php-maint] Bug#580383: Bug#580383: php-xml-parser uses deprecated eregi and reference of new object
Thijs Kinkhorst wrote: Two questions: 1) Why is it needed to pass the object by reference? It looks like it could just as well be passed by value. 2) Why is this bug of grave severity? As I understand it, using this only generates notices of level E_DEPRECATED. The code functions just as it did before. Cheers, Thijs Hi Thijs, I have made the necessary corrections to the package. Attached is an interdiff between the 2 versions. Please have a quick look/review, and let me know if you think it's ok that I upload the amended version. Also, I maintain all of my php PEAR packages in Git. Would it make sense to add that one in /git/pkg-php as well? Do you want me to do so after this upload? Please let me know, this package really is a blocker for me. Cheers, Thomas Goirand (zigo) diff -u php-xml-parser-1.3.2/debian/rules php-xml-parser-1.3.2/debian/rules --- php-xml-parser-1.3.2/debian/rules +++ php-xml-parser-1.3.2/debian/rules @@ -1,5 +1,7 @@ #!/usr/bin/make -f +include /usr/share/dpatch/dpatch.make + DEB_VERSION := $(shell dpkg-parsechangelog | egrep '^Version:' | cut -f 2 -d ' ') DEB_NOEPOCH_VERSION := $(shell echo $(DEB_VERSION) | cut -d: -f2-) DEB_UPSTREAM_VERSION := $(shell echo $(DEB_NOEPOCH_VERSION) | sed 's/-[^-]*$$//') @@ -17,9 +19,10 @@ build-stamp: configure-stamp dh_testdir + dpatch apply-all touch build-stamp -clean: +clean: unpatch dh_testdir dh_testroot if [ -f $(pear_pkg)/package.xml ]; then \ diff -u php-xml-parser-1.3.2/debian/control php-xml-parser-1.3.2/debian/control --- php-xml-parser-1.3.2/debian/control +++ php-xml-parser-1.3.2/debian/control @@ -3,8 +3,8 @@ Priority: optional Maintainer: Debian PHP Maintainers pkg-php-ma...@lists.alioth.debian.org Uploaders: Thijs Kinkhorst th...@debian.org -Build-Depends: debhelper (= 7) -Standards-Version: 3.8.4 +Build-Depends: debhelper (= 7), dpatch +Standards-Version: 3.9.1 Build-Depends-Indep: php-pear Vcs-Svn: svn://svn.debian.org/pkg-php/pear/php-xml-parser/trunk Vcs-Browser: http://svn.debian.org/wsvn/pkg-php/pear/php-xml-parser/trunk diff -u php-xml-parser-1.3.2/debian/changelog php-xml-parser-1.3.2/debian/changelog --- php-xml-parser-1.3.2/debian/changelog +++ php-xml-parser-1.3.2/debian/changelog @@ -1,3 +1,13 @@ +php-xml-parser (1.3.2-1.1) unstable; urgency=low + + * Non-maintainer upload. + * Fixes PHP 5.3.x warning due to ereg() and return of a reference, which are +now deprecated (Closes: #580383). + * Bumps Standard-Version to 3.9.1. + * Added debian/source/format and debian/README.source + + -- Thomas Goirand z...@debian.org Wed, 01 Sep 2010 02:02:16 +0800 + php-xml-parser (1.3.2-1) unstable; urgency=low * New upstream release. only in patch2: unchanged: --- php-xml-parser-1.3.2.orig/debian/README.source +++ php-xml-parser-1.3.2/debian/README.source @@ -0,0 +1,14 @@ +This package uses dpatch to maintain a Debian correction, so +that XML_Parser can run in PHP 5.3.x without producing warnings. + +To apply all patches that have been added in Debian, just do: + +dpatch apply-all + +To remove these patches, do: + +dpatch deapply-all + +Enjoy! + +Thomas Goirand (z...@debian.org) only in patch2: unchanged: --- php-xml-parser-1.3.2.orig/debian/source/format +++ php-xml-parser-1.3.2/debian/source/format @@ -0,0 +1 @@ +1.0 only in patch2: unchanged: --- php-xml-parser-1.3.2.orig/debian/patches/001parser.php_compat_php_5.3.x.dpatch +++ php-xml-parser-1.3.2/debian/patches/001parser.php_compat_php_5.3.x.dpatch @@ -0,0 +1,74 @@ +#!/bin/sh /usr/share/dpatch/dpatch-run +## 001parser.php_compat_php_5.3.x.dpatch by Thomas Goirand z...@debian.org +## +## DP: This patch makes php-xml-parser work with PHP 5.3.x that is +## DP: currently the new version in Debian. It removes a return by +## DP: reference, and replaces ereg() calls by preg, as both are +## DP: deprecated in php 5.3.x, which makes PHP produces some nasty +## DP: warnings that could be annoying when outputing XML documents. + +...@dpatch@ +--- php-xml-parser-1.3.2.orig/XML_Parser-1.3.2/Parser.php 2010-09-01 01:52:06.0 +0800 php-xml-parser-1.3.2/XML_Parser-1.3.2/Parser.php 2010-09-01 01:52:58.0 +0800 +@@ -417,7 +417,15 @@ + /** + * check, if file is a remote file + */ +-if (eregi('^(http|ftp)://', substr($file, 0, 10))) { ++ $regexp = '^(http|ftp)://'; ++ $file_start = substr($file, 0, 10); ++ if (version_compare( phpversion(), '5.3.0') = 0){ ++ $check_result = prereg_match( / . $regexp . /i , $file_start); ++ }else{ ++ $check_result = eregi( $regexp , $file_start); ++ } ++ ++if ( $check_result ) { + if (!ini_get('allow_url_fopen')) { + return $this- + raiseError('Remote files cannot be parsed, as safe mode is enabled.', +@@ -474,16 +482,25 @@ + if (is_resource($fp)) { + $this-fp = $fp; +
Bug#580383: [php-maint] Bug#580383: Bug#580383: php-xml-parser uses deprecated eregi and reference of new object
On Tue, August 31, 2010 20:16, Thomas Goirand wrote: Thijs Kinkhorst wrote: Two questions: 1) Why is it needed to pass the object by reference? It looks like it could just as well be passed by value. 2) Why is this bug of grave severity? As I understand it, using this only generates notices of level E_DEPRECATED. The code functions just as it did before. Cheers, Thijs Hi Thijs, I have made the necessary corrections to the package. Attached is an interdiff between the 2 versions. Please have a quick look/review, and let me know if you think it's ok that I upload the amended version. You're using prereg_match which I think is a misspelling of the preg_match function. Did you test it? I was wondering apart from this why you keep the ereg(i) calls. All versions of PHP also support preg_match, so you can just replace them with preg_match calls unconditionally. Cheers, Thijs -- To UNSUBSCRIBE, email to debian-bugs-rc-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Bug#580383: [php-maint] Bug#580383: Bug#580383: php-xml-parser uses deprecated eregi and reference of new object
- Original message - You're using prereg_match which I think is a misspelling of the preg_match function. Did you test it? Wooops!!! :( I was wondering apart from this why you keep the ereg(i) calls. All versions of PHP also support preg_match, so you can just replace them with preg_match calls unconditionally. Cheers, Thijs Because of upstream insisting to support ante-diluvian version of php, and my will to have the patch upstreamed. Thomas -- To UNSUBSCRIBE, email to debian-bugs-rc-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Bug#580383: [php-maint] Bug#580383: Bug#580383: php-xml-parser uses deprecated eregi and reference of new object
Hi, On woansdei 5 Maaie 2010, Thomas Goirand wrote: Replying to myself, as I didn't know it would go back to the list! :) My patch fixes the eregi calls, but not this one: $err = new XML_Parser_Error($msg, $ecode); return parent::raiseError($err); What's the way to fix for php 5.3.x? Two questions: 1) Why is it needed to pass the object by reference? It looks like it could just as well be passed by value. 2) Why is this bug of grave severity? As I understand it, using this only generates notices of level E_DEPRECATED. The code functions just as it did before. Cheers, Thijs signature.asc Description: This is a digitally signed message part.
Bug#580383: [php-maint] Bug#580383: Bug#580383: php-xml-parser uses deprecated eregi and reference of new object
Thijs Kinkhorst wrote: Hi, On woansdei 5 Maaie 2010, Thomas Goirand wrote: Replying to myself, as I didn't know it would go back to the list! :) My patch fixes the eregi calls, but not this one: $err = new XML_Parser_Error($msg, $ecode); return parent::raiseError($err); What's the way to fix for php 5.3.x? Two questions: 1) Why is it needed to pass the object by reference? It looks like it could just as well be passed by value. Are you saying that just removing the sign will be enough to have it 100% working? I was feeling it was the case, but I wasn't sure that I was right, and that this wouldn't create other issues. If that is the case, then I can NMU a fix within few hours (this package is very important for me). As for the other issue with the deprecated ereg calls, it's trivial, and I already talked about it with upstream. I'll generate a full patch and send it to him. 2) Why is this bug of grave severity? As I understand it, using this only generates notices of level E_DEPRECATED. The code functions just as it did before. The thing is, this code is likely used when generating / parsing XML. In few corner cases, having a big warning on top of an XML document can totally break things, which is why I raised it to Grave (I have such an issue). Also, despite my repeated calls for comments, nobody replied, and I thought that the only way to bring attention was to promote it to RC bug. Thanks for your comments, now I'll fix it. Thomas Goirand (zigo) -- To UNSUBSCRIBE, email to debian-bugs-rc-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org