-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Feature Request #28790 Add php.ini option to disable stat cache #5894
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
814bbc7
Fix bug #28790
lyda e624ec0
Add tests for bug 28790 fix
lyda c0273b5
Docs for bug 28790 fix
lyda eb06387
Merge remote-tracking branch 'upstream/master' into disable_stat_cache
lyda ef58777
Try to properly escape backslashes
lyda 745a83b
Give up escaping file name
lyda eef8edd
Revert "Give up escaping file name"
lyda 56e73b1
Another pass at Windows path separator problems in test
lyda 690c961
Use INI section to simplify test
lyda f12b4e2
Change option to enable_stat_cache
lyda 6fc8c13
Merge remote-tracking branch 'upstream/master' into disable_stat_cache
lyda e209f0d
Correct the indents in .phpt file
lyda 8e0b280
Update Zend/zend_virtual_cwd.h
lyda 8140ef1
Update Zend/zend_virtual_cwd.c
lyda fac99c9
Clean up docs, indents and credits
lyda e3674fb
Merge branch 'master' into disable_stat_cache
lyda d07ff72
Explain tests better
lyda fac83f2
Make the impossible file impossibler.
lyda c91980b
And now more succinctly impossibler.
lyda File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
--TEST-- | ||
Bug #28790: Add php.ini option to disable stat cache (with cache) | ||
--FILE-- | ||
<?php | ||
|
||
$php = '"'.getenv('TEST_PHP_EXECUTABLE').'"'; | ||
$phpfile = getenv('TEST_PHP_EXECUTABLE'); | ||
$impossiblefile = __FILE__.DIRECTORY_SEPARATOR.'bug28790.impossible'; | ||
$testfile = __DIR__.DIRECTORY_SEPARATOR.'bug28790.file'; | ||
|
||
function all_the_stats($filename, $message) { | ||
if (@lstat($filename)) { | ||
print("lstat: $message.\n"); | ||
} | ||
if (@stat($filename)) { | ||
print("stat: $message.\n"); | ||
} | ||
} | ||
|
||
# Windows can use / for dir separators, so let's do that. | ||
$qtestfile = str_replace("\\", "/", "$testfile"); | ||
|
||
# This creates a file and should emit stat & lstat messages. | ||
passthru($php.' -n -r "touch(\\"'.$qtestfile.'\\");"'); | ||
all_the_stats("$testfile", "testfile exists"); | ||
|
||
# This deletes the file and shouldn't emit stat & lstat messages (but does). | ||
passthru($php.' -n -r "unlink(\\"'.$qtestfile.'\\");"'); | ||
all_the_stats("$testfile", "testfile exists (it shouldn't)"); | ||
|
||
# This stats a non-existent file; still stat/lstats the deleted testfile (shouldn't). | ||
if (!@stat("$impossiblefile")) { | ||
print("stat impossiblefile does not exist.\n"); | ||
} | ||
all_the_stats("$testfile", "testfile exists (it shouldn't)"); | ||
|
||
# This is_files an existing file; still can lstat the deleted testfile (shouldn't). | ||
if (is_file("$phpfile")) { | ||
print("is_file(stat): php binary exists.\n"); | ||
} | ||
all_the_stats("$testfile", "testfile exists (it shouldn't)"); | ||
|
||
# This lstats an existing file; finally can't stat or lstat the deleted testfile. | ||
if (lstat("$phpfile")) { | ||
print("lstat: php binary exists.\n"); | ||
} | ||
all_the_stats("$testfile", "testfile exists (it shouldn't)"); | ||
|
||
?> | ||
--EXPECT-- | ||
lstat: testfile exists. | ||
stat: testfile exists. | ||
lstat: testfile exists (it shouldn't). | ||
stat: testfile exists (it shouldn't). | ||
stat impossiblefile does not exist. | ||
lstat: testfile exists (it shouldn't). | ||
stat: testfile exists (it shouldn't). | ||
is_file(stat): php binary exists. | ||
lstat: testfile exists (it shouldn't). | ||
lstat: php binary exists. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
--TEST-- | ||
Bug #28790: Add php.ini option to disable stat cache (without cache) | ||
--INI-- | ||
enable_stat_cache = False | ||
--FILE-- | ||
<?php | ||
lyda marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
$php = '"'.getenv('TEST_PHP_EXECUTABLE').'"'; | ||
$phpfile = getenv('TEST_PHP_EXECUTABLE'); | ||
$impossiblefile = __FILE__.DIRECTORY_SEPARATOR.'bug28790.impossible'; | ||
$testfile = __DIR__.DIRECTORY_SEPARATOR.'bug28790.file'; | ||
|
||
function all_the_stats($filename, $message) { | ||
if (@lstat($filename)) { | ||
print("lstat: $message.\n"); | ||
} | ||
if (@stat($filename)) { | ||
print("stat: $message.\n"); | ||
} | ||
} | ||
|
||
# Windows can use / for dir separators, so let's do that. | ||
$qtestfile = str_replace("\\", "/", "$testfile"); | ||
|
||
# This creates a file and should emit stat & lstat messages. | ||
passthru($php.' -n -r "touch(\\"'.$qtestfile.'\\");"'); | ||
all_the_stats("$testfile", "testfile exists"); | ||
|
||
# This deletes the file and shouldn't emit stat or lstat messages. | ||
passthru($php.' -n -r "unlink(\\"'.$qtestfile.'\\");"'); | ||
all_the_stats("$testfile", "testfile exists (it shouldn't)"); | ||
|
||
# This stats a non-existent file; still no testfile stat or lstat messages. | ||
if (!@stat("$impossiblefile")) { | ||
print("stat impossiblefile does not exist.\n"); | ||
} | ||
all_the_stats("$testfile", "testfile exists (it shouldn't)"); | ||
|
||
# This is_files an existing file; still no testfile stat or lstat messages. | ||
if (is_file("$phpfile")) { | ||
print("is_file(stat): php binary exists.\n"); | ||
} | ||
all_the_stats("$testfile", "testfile exists (it shouldn't)"); | ||
|
||
# This lstats an existing file; still no testfile stat or lstat messages. | ||
if (lstat("$phpfile")) { | ||
print("lstat: php binary exists.\n"); | ||
} | ||
all_the_stats("$testfile", "testfile exists (it shouldn't)"); | ||
|
||
?> | ||
--EXPECT-- | ||
lstat: testfile exists. | ||
stat: testfile exists. | ||
stat impossiblefile does not exist. | ||
is_file(stat): php binary exists. | ||
lstat: php binary exists. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.