Edit report at https://bugs.php.net/bug.php?id=53250&edit=1

 ID:                 53250
 Updated by:         [email protected]
 Reported by:        popon8947 at gmail dot com
 Summary:            bugs on : Phar::interceptFileFuncs
-Status:             Open
+Status:             Feedback
 Type:               Bug
 Package:            PHAR related
 Operating System:   Windows
 PHP Version:        5.2.14
 Block user comment: N
 Private report:     N

 New Comment:

Please try using this snapshot:

  http://snaps.php.net/php5.3-latest.tar.gz
 
For Windows:

  http://windows.php.net/snapshots/




Previous Comments:
------------------------------------------------------------------------
[2010-11-07 05:34:37] popon8947 at gmail dot com

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 this bug report at https://bugs.php.net/bug.php?id=53250&edit=1

Reply via email to