pajoye                                   Tue, 04 May 2010 08:48:58 +0000

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

Log:
- Fixed bug #51732, Fileinfo __construct or open does not work with NULL

Bug: http://bugs.php.net/51732 (Bogus) Fileinfo __construct with explicit magic 
file
      
Changed paths:
    U   php/php-src/branches/PHP_5_3/NEWS
    U   php/php-src/branches/PHP_5_3/ext/fileinfo/fileinfo.c
    U   php/php-src/branches/PHP_5_3/ext/fileinfo/tests/finfo_open_001.phpt
    U   php/php-src/trunk/ext/fileinfo/fileinfo.c
    U   php/php-src/trunk/ext/fileinfo/tests/finfo_open_001.phpt

Modified: php/php-src/branches/PHP_5_3/NEWS
===================================================================
--- php/php-src/branches/PHP_5_3/NEWS   2010-05-04 08:28:38 UTC (rev 298946)
+++ php/php-src/branches/PHP_5_3/NEWS   2010-05-04 08:48:58 UTC (rev 298947)
@@ -39,6 +39,8 @@
   requests (Fixes CVE-2010-0397, bug #51288). (Raphael Geissert)
 - Fixed 64-bit integer overflow in mhash_keygen_s2k(). (Clément LECIGNE, Stas)

+- Fixed bug #51732 (Fileinfo __construct or open does not work with NULL).
+  (Pierre)
 - Fixed bug #51723 (Content-length header is limited to 32bit integer with
   Apache2 on Windows). (Pierre)
 - Fixed bug #51690 (Phar::setStub looks for case-sensitive

Modified: php/php-src/branches/PHP_5_3/ext/fileinfo/fileinfo.c
===================================================================
--- php/php-src/branches/PHP_5_3/ext/fileinfo/fileinfo.c        2010-05-04 
08:28:38 UTC (rev 298946)
+++ php/php-src/branches/PHP_5_3/ext/fileinfo/fileinfo.c        2010-05-04 
08:48:58 UTC (rev 298947)
@@ -291,7 +291,9 @@
                RETURN_FALSE;
        }

-       if (file && *file) { /* user specified file, perform open_basedir 
checks */
+       if (file_len == 0) {
+               file = NULL;
+       } else if (file && *file) { /* user specified file, perform 
open_basedir checks */
                if (!VCWD_REALPATH(file, resolved_path)) {
                        RETURN_FALSE;
                }

Modified: php/php-src/branches/PHP_5_3/ext/fileinfo/tests/finfo_open_001.phpt
===================================================================
--- php/php-src/branches/PHP_5_3/ext/fileinfo/tests/finfo_open_001.phpt 
2010-05-04 08:28:38 UTC (rev 298946)
+++ php/php-src/branches/PHP_5_3/ext/fileinfo/tests/finfo_open_001.phpt 
2010-05-04 08:48:58 UTC (rev 298947)
@@ -16,12 +16,8 @@
 --EXPECTF--
 Warning: finfo_open(): Failed to load magic database at ''. in %s on line %d
 bool(false)
-
-Warning: finfo_open(): Failed to load magic database at ''. in %s on line %d
+resource(%d) of type (file_info)
+resource(%d) of type (file_info)
 bool(false)
-
-Warning: finfo_open(): Failed to load magic database at ''. in %s on line %d
 bool(false)
 bool(false)
-bool(false)
-bool(false)

Modified: php/php-src/trunk/ext/fileinfo/fileinfo.c
===================================================================
--- php/php-src/trunk/ext/fileinfo/fileinfo.c   2010-05-04 08:28:38 UTC (rev 
298946)
+++ php/php-src/trunk/ext/fileinfo/fileinfo.c   2010-05-04 08:48:58 UTC (rev 
298947)
@@ -291,7 +291,9 @@
                RETURN_FALSE;
        }

-       if (file && *file) { /* user specified file, perform open_basedir 
checks */
+       if (file_len == 0) {
+               file = NULL;
+       } else if (file && *file) { /* user specified file, perform 
open_basedir checks */
                if (!VCWD_REALPATH(file, resolved_path)) {
                        RETURN_FALSE;
                }

Modified: php/php-src/trunk/ext/fileinfo/tests/finfo_open_001.phpt
===================================================================
--- php/php-src/trunk/ext/fileinfo/tests/finfo_open_001.phpt    2010-05-04 
08:28:38 UTC (rev 298946)
+++ php/php-src/trunk/ext/fileinfo/tests/finfo_open_001.phpt    2010-05-04 
08:48:58 UTC (rev 298947)
@@ -16,12 +16,8 @@
 --EXPECTF--
 Warning: finfo_open(): Failed to load magic database at ''. in %s on line %d
 bool(false)
-
-Warning: finfo_open(): Failed to load magic database at ''. in %s on line %d
+resource(%d) of type (file_info)
+resource(%d) of type (file_info)
 bool(false)
-
-Warning: finfo_open(): Failed to load magic database at ''. in %s on line %d
 bool(false)
 bool(false)
-bool(false)
-bool(false)

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to