|   | php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login | 
| 
 PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits              [2015-03-30 14:17 UTC] mike@php.net
 
-Status: Open
+Status: Not a bug
  [2015-03-30 14:17 UTC] mike@php.net
 | |||||||||||||||||||||||||||
|  Copyright © 2001-2025 The PHP Group All rights reserved. | Last updated: Fri Oct 31 01:00:01 2025 UTC | 
Description: ------------ Current implementation of Phar stub doesn't provide any way to disable impact of Phar::interceptFileFuncs(). If you tried to run the test script for text file in the same folder php my.phar test.txt: File:test.txt Path:C:\projects\PrimordialCode\php\glitches\open stat issue\test.txt is_file: is_readable: file_exists: file_get_contents:I'm the test text. The same execution for test.php: php my.phar test.php File:test.php Path:C:\projects\PrimordialCode\php\glitches\open stat issue\test.php is_file:1 is_readable:1 file_exists:1 file_get_contents:<?php $file = isset($argv[1]) ? $argv[1] : null; if(is_null($file)) exit('Please specify a file'); echo "\n File:" . $file; echo "\n Path:" . realpath($file); echo "\n is_file:" . is_file($file); echo "\n is_readable:" . is_readable($file); echo "\n file_exists:" . file_exists($file); echo "\n file_get_contents:" . file_get_contents($file); The issue caused by https://github.com/php/php-src/blob/master/ext/phar/stub.h E.g. line with Phar::interceptFileFuncs() hardcoded call: static const char newstub1_0[] = "';\n\nif (in_array('phar', stream_get_wrappers()) && class_exists('Phar', 0)) {\nPhar::interceptFileFuncs();\n .... Test script: --------------- <?php // Script to build phar $phar = new Phar("my.phar",0, "my.phar"); $phar["test.php"] = file_get_contents("test.php"); $phar->setStub($phar->createDefaultStub("test.php")); // Content of test.php <?php $file = isset($argv[1]) ? $argv[1] : null; if(is_null($file)) exit('Please specify a file'); echo "\n File:" . $file; echo "\n Path:" . realpath($file); echo "\n is_file:" . is_file($file); echo "\n is_readable:" . is_readable($file); echo "\n file_exists:" . file_exists($file); echo "\n file_get_contents:" . file_get_contents($file); Expected result: ---------------- Provide a switch to disable/enabled the function call or phar header customization. Actual result: -------------- Unexpected behavior of file lookup