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 <[email protected]>
Uploaders: Thijs Kinkhorst <[email protected]>
-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 <[email protected]> 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 ([email protected])
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 <[email protected]>
+##
+## 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.000000000 +0800
++++ php-xml-parser-1.3.2/XML_Parser-1.3.2/Parser.php 2010-09-01
01:52:58.000000000 +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;
+ return true;
+- } elseif (eregi('^[a-z]+://', 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)) {
+- // see if it's a local file
+- return $this->setInputFile($fp);
+- } else {
+- // it must be a string
+- $this->fp = $fp;
+- return true;
++ }else{
++ $regexp = '^[a-z]+://';
++ $check_string = substr($fp, 0, 10);
++ if (version_compare( phpversion(), '5.3.0') >= 0){
++ $check_result = prereg_match( "/" . $regexp . "/i" ,
$check_string);
++ }else{
++ $check_result = eregi( $regexp , $check_string);
++ }
++ if ($check_result) {
++ // see if it's an absolute URL (has a scheme at the
beginning)
++ return $this->setInputFile($fp);
++ } elseif (file_exists($fp)) {
++ // see if it's a local file
++ return $this->setInputFile($fp);
++ } else {
++ // it must be a string
++ $this->fp = $fp;
++ return true;
++ }
+ }
+
+ return $this->raiseError('Illegal input format',
+@@ -613,7 +630,7 @@
+ function &raiseError($msg = null, $ecode = 0)
+ {
+ $msg = !is_null($msg) ? $msg : $this->parser;
+- $err = &new XML_Parser_Error($msg, $ecode);
++ $err = new XML_Parser_Error($msg, $ecode);
+ return parent::raiseError($err);
+ }
+
only in patch2:
unchanged:
--- php-xml-parser-1.3.2.orig/debian/patches/00list
+++ php-xml-parser-1.3.2/debian/patches/00list
@@ -0,0 +1 @@
+001parser.php_compat_php_5.3.x.dpatch