-
Notifications
You must be signed in to change notification settings - Fork 7.9k
opcache: Improve error messages when “temporarily enabling OPcache” #19619
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
Merged
+106
−2
Merged
Changes from 2 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
115cd6f
opcache: Do not emit “temporary enabling” message when OPcache is alr…
TimWolla fb1f245
opcache: Improve error message when OPcache is enabled dynamically
TimWolla a533f7e
opcache: Fix typo in warning message
TimWolla 0fc9bbf
opcache: Use more formal language in warning message
TimWolla 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
--TEST-- | ||
Dynamically setting opcache.enable does not warn when noop | ||
--INI-- | ||
opcache.enable=1 | ||
opcache.enable_cli=1 | ||
--EXTENSIONS-- | ||
opcache | ||
--FILE-- | ||
<?php | ||
|
||
echo "Should not warn:", PHP_EOL; | ||
ini_set('opcache.enable', 1); | ||
echo "Disabling:", PHP_EOL; | ||
ini_set('opcache.enable', 0); | ||
echo "Should warn:", PHP_EOL; | ||
ini_set('opcache.enable', 1); | ||
|
||
?> | ||
--EXPECTF-- | ||
Should not warn: | ||
Disabling: | ||
Should warn: | ||
|
||
Warning: Zend OPcache can't be temporary enabled (it may be only disabled till the end of request) in %s on line %d |
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,18 @@ | ||
--TEST-- | ||
Dynamically setting opcache.enable warns when not a noop | ||
--INI-- | ||
opcache.enable=0 | ||
opcache.enable_cli=1 | ||
--EXTENSIONS-- | ||
opcache | ||
--FILE-- | ||
<?php | ||
|
||
echo "Should warn, since the INI was initialized to 0:", PHP_EOL; | ||
ini_set('opcache.enable', 1); | ||
|
||
?> | ||
--EXPECTF-- | ||
Should warn, since the INI was initialized to 0: | ||
|
||
Warning: Zend OPcache can't be temporary enabled (it may be only disabled till the end of request) in %s on line %d |
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,49 @@ | ||
--TEST-- | ||
Setting opcache.enable via php_admin_value fails gracefully | ||
--SKIPIF-- | ||
<?php include "skipif.inc"; ?> | ||
--FILE-- | ||
<?php | ||
|
||
require_once "tester.inc"; | ||
|
||
$cfg = <<<EOT | ||
[global] | ||
error_log = {{FILE:LOG}} | ||
[unconfined] | ||
listen = {{ADDR}} | ||
pm = static | ||
pm.max_children = 1 | ||
catch_workers_output = yes | ||
php_admin_value[opcache.enable] = On | ||
php_admin_flag[display_errors] = On | ||
php_admin_flag[display_startup_errors] = On | ||
php_admin_flag[log_errors] = On | ||
EOT; | ||
|
||
$code = <<<EOT | ||
<?php | ||
var_dump(error_get_last()); | ||
EOT; | ||
|
||
$tester = new FPM\Tester($cfg, $code); | ||
$tester->start(iniEntries: [ | ||
'opcache.enable' => '0', | ||
'opcache.log_verbosity_level' => '2', | ||
]); | ||
$tester->expectLogStartNotices(); | ||
$tester->expectLogPattern("/Zend OPcache can't be temporary enabled. Are you using php_admin_value\\[opcache.enable\\]=1 in an individual pool's configuration?/"); | ||
echo $tester | ||
->request() | ||
->getBody(); | ||
$tester->terminate(); | ||
$tester->close(); | ||
|
||
?> | ||
--EXPECT-- | ||
NULL | ||
--CLEAN-- | ||
<?php | ||
require_once "tester.inc"; | ||
FPM\Tester::clean(); | ||
?> |
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.