From:             
Operating system: Windows
PHP version:      5.2.14
Package:          Filesystem function related
Bug Type:         Bug
Bug description:bugs on : Phar::interceptFileFuncs 

Description:
------------
run attached file



relative path file name



function fails



file_get_contents

or

file_exists



on Phar

Test script:
---------------
<?php



/*

PHP Version 5.2.14

PHP Version 5.3.3



 bugs on : Phar::interceptFileFuncs 

 bugs: file_exists and file_get_contents on phar.

*/



/*

.htaccess

#AddHandler php5-script  .php

#AddHandler php5_3-script  .php

#AddHandler php6-script  .php

*/



if (ini_get('phar.readonly'))

   exit('error : php.ini : phar.readonly is true. '."\n"

       .' php -d phar.readonly=0 '.basename($argv[0])."\n"

           );



$pack_top_dir_name = 'php-bug-file';

$target_phar_name  = 'test_php-bug-file.phar';

$target_phar_filename = $target_phar_name.'.php';



if (file_exists($target_phar_filename)) @unlink($target_phar_filename);



try {

 $phar = new Phar($target_phar_filename);

 $phar->startBuffering();



$test_file_get_contents = <<<ENDTEXT

<?php

  header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1

  header("Expires: Sat, 26 Jul 1997 05:00:00 GMT");   // 



  // this is relative path.

  print "this is relative path.<br>\\n";

  foreach( array('','./') as \$filename ) 

  {

    \$filename .= 'test/file_get_contents';

  printf("test :: file_exists('\$filename') : %s <br>\\n",
(file_exists(\$filename) ? 'true' : '<b>false</b>' ) );

  \$s = file_get_contents(\$filename);

  printf("test :: file_get_contents('\$filename') : %s <br>\\n", (\$s
!==false ? \$s : '<b>false</b>' ) );

  \$s = file_get_contents(\$filename , FILE_USE_INCLUDE_PATH);

  printf("test :: file_get_contents('\$filename' ,FILE_USE_INCLUDE_PATH) :
%s <br>\\n", (\$s !==false ? \$s : '<b>false</b>' ) );

  print "<br>\\n";

  }

  print "PHP version : ".phpversion()."<br>\\n";

?>

ENDTEXT;



 $phar[basename($pack_top_dir_name)."/test/file_get_contents"] = 'test :
file_get_contents is ok.';

 $phar[basename($pack_top_dir_name)."/index.php"] =
$test_file_get_contents;

 $phar->setStub('<?php '."\n"

     . 'Phar::interceptFileFuncs();'."\n"

     .
'Phar::mungServer(array("REQUEST_URI","PHP_SELF","SCRIPT_NAME","SCRIPT_FILENAME"));'."\n"

     . sprintf('Phar::webPhar("%s", "%s/index.php");', $target_phar_name ,
basename($pack_top_dir_name))."\n"

     . '__HALT_COMPILER();'."\n"

     .'?>');

 $phar->stopBuffering();

 } catch (Exception $e) {

    echo 'error: phar : '.$target_phar_filename.' : ', $e;

 }



$phar->extractTo("./test-php-bug/");





?>



Expected result:
----------------
function is success.

Actual result:
--------------
function return false

-- 
Edit bug report at http://bugs.php.net/bug.php?id=53250&edit=1
-- 
Try a snapshot (PHP 5.2):            
http://bugs.php.net/fix.php?id=53250&r=trysnapshot52
Try a snapshot (PHP 5.3):            
http://bugs.php.net/fix.php?id=53250&r=trysnapshot53
Try a snapshot (trunk):              
http://bugs.php.net/fix.php?id=53250&r=trysnapshottrunk
Fixed in SVN:                        
http://bugs.php.net/fix.php?id=53250&r=fixed
Fixed in SVN and need be documented: 
http://bugs.php.net/fix.php?id=53250&r=needdocs
Fixed in release:                    
http://bugs.php.net/fix.php?id=53250&r=alreadyfixed
Need backtrace:                      
http://bugs.php.net/fix.php?id=53250&r=needtrace
Need Reproduce Script:               
http://bugs.php.net/fix.php?id=53250&r=needscript
Try newer version:                   
http://bugs.php.net/fix.php?id=53250&r=oldversion
Not developer issue:                 
http://bugs.php.net/fix.php?id=53250&r=support
Expected behavior:                   
http://bugs.php.net/fix.php?id=53250&r=notwrong
Not enough info:                     
http://bugs.php.net/fix.php?id=53250&r=notenoughinfo
Submitted twice:                     
http://bugs.php.net/fix.php?id=53250&r=submittedtwice
register_globals:                    
http://bugs.php.net/fix.php?id=53250&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=53250&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=53250&r=dst
IIS Stability:                       
http://bugs.php.net/fix.php?id=53250&r=isapi
Install GNU Sed:                     
http://bugs.php.net/fix.php?id=53250&r=gnused
Floating point limitations:          
http://bugs.php.net/fix.php?id=53250&r=float
No Zend Extensions:                  
http://bugs.php.net/fix.php?id=53250&r=nozend
MySQL Configuration Error:           
http://bugs.php.net/fix.php?id=53250&r=mysqlcfg

Reply via email to