]> granicus.if.org Git - php/commitdiff
MFH: fixed isset() on sub-directories (isset("blah") if file "blah/foo.php" exists)
authorGreg Beaver <cellog@php.net>
Fri, 5 Jun 2009 04:46:49 +0000 (04:46 +0000)
committerGreg Beaver <cellog@php.net>
Fri, 5 Jun 2009 04:46:49 +0000 (04:46 +0000)
NEWS
ext/phar/phar_object.c
ext/phar/tests/phar_oo_011.phpt

diff --git a/NEWS b/NEWS
index 773421b51199d7d87b84f7ac90d51b15ea85d24c..0fe25e09fb15347b2e8aae5404de1a4d303116f8 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -23,6 +23,8 @@ PHP                                                                        NEWS
   PDO_PGSQL). (Matteo)
 - Fixed bug #38802 (max_redirects and ignore_errors).
   (patch by datibbaw@php.net)
+- Fixed isset() on sub-directories (isset("blah") if file "blah/foo.php" exists).
+  (Greg)
 - Fixed security vulnerability in phar's handling of long tar filenames. (Greg)
 - Fixed potential segfault with converting phars containing metadata to other
   formats. (Greg)
index 6b03e62a459dc9f429d743114d0a81b4cdafb3b0..a529c50eabbed1e8923ba8ab03ae3710ba4f759a 100755 (executable)
@@ -3526,6 +3526,9 @@ PHP_METHOD(Phar, offsetExists)
                }
                RETURN_TRUE;
        } else {
+               if (zend_hash_exists(&phar_obj->arc.archive->virtual_dirs, fname, (uint) fname_len)) {
+                       RETURN_TRUE;
+               }
                RETURN_FALSE;
        }
 }
index 236009b7e4278356a4222059c3c4cb5ec579e046..cfbab702ad8c849d5e6d42dc1bc2f03de9b5d263 100644 (file)
@@ -16,9 +16,10 @@ require_once 'files/phar_oo_test.inc';
 $phar = new Phar($fname);
 $phar->setInfoClass('SplFileObject');
 
-$phar['f.php'] = 'hi';
-var_dump(isset($phar['f.php']));
-echo $phar['f.php'];
+$phar['hi/f.php'] = 'hi';
+var_dump(isset($phar['hi']));
+var_dump(isset($phar['hi/f.php']));
+echo $phar['hi/f.php'];
 echo "\n";
 
 ?>
@@ -30,5 +31,6 @@ __halt_compiler();
 ?>
 --EXPECT--
 bool(true)
+bool(true)
 hi
 ===DONE===