svn: /pear/pear-core/trunk/PEAR/ PackageFile.php

[email protected] (Helgi Þormar Þorbjörnsson) Tue, 08 Mar 2011 21:21:59 +0000
Newsgroups php.pear.cvs,php.pear.core
Message-ID <[email protected]>
dufuz                                    Tue, 08 Mar 2011 21:21:59 +0000

Revision: http://svn.php.net/viewvc?view=revision&revision=309038

Log:
Fixed Bug #18349: package.xml version not recognized when single quoted [dufuz]

# Port from Tag 1.9.3

Bug: http://pear.php.net/bugs/18349 (unknown) 
      
Changed paths:
    U   pear/pear-core/trunk/PEAR/PackageFile.php

Modified: pear/pear-core/trunk/PEAR/PackageFile.php
===================================================================
--- pear/pear-core/trunk/PEAR/PackageFile.php	2011-03-08 21:21:40 UTC (rev 309037)
+++ pear/pear-core/trunk/PEAR/PackageFile.php	2011-03-08 21:21:59 UTC (rev 309038)
@@ -186,7 +186,7 @@
      */
     function &fromXmlString($data, $state, $file, $archive = false)
     {
-        if (preg_match('/<package[^>]+version="([0-9]+\.[0-9]+)"/', $data, $packageversion)) {
+        if (preg_match('/<package[^>]+version=[\'"]([0-9]+\.[0-9]+)[\'"]/', $data, $packageversion)) {
             if (!in_array($packageversion[1], array('1.0', '2.0', '2.1'))) {
                 return PEAR::raiseError('package.xml version "' . $packageversion[1] .
                     '" is not supported, only 1.0, 2.0, and 2.1 are supported.');
@@ -232,7 +232,7 @@
             }

             return $pf;
-        } elseif (preg_match('/<package[^>]+version="([^"]+)"/', $data, $packageversion)) {
+        } elseif (preg_match('/<package[^>]+version=[\'"]([^"\']+)[\'"]/', $data, $packageversion)) {
             $a = PEAR::raiseError('package.xml file "' . $file .
                 '" has unsupported package.xml <package> version "' . $packageversion[1] . '"');
             return $a;
@@ -430,7 +430,6 @@
         return $ret;
     }

-
     /**
      * Create a PEAR_PackageFile_v* from a .tgz archive or package.xml file.
      *