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.000000000 +0800
++++ php-xml-parser-1.3.2/XML_Parser-1.3.2/Parser.php   2010-09-03 
17:04:52.000000000 +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)) {
+@@ -613,7 +613,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

Reply via email to