|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #76535 Opcache does not replay compile-time warnings
Submitted: 2018-06-27 09:00 UTC Modified: 2020-05-20 09:21 UTC
From: Assigned: nikic (profile)
Status: Closed Package: opcache
PHP Version: Irrelevant OS:
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
New email:
PHP Version: OS:


 [2018-06-27 09:00 UTC]
If opcache is enabled, non-fatal compile-time diagnostics are only emitted on first compile, not when the file is fetched from cache.

It would be nice if we would register an error handler that records all the emitted warnings and then emit them when the file is loaded.

Main motivation is testing: Currently if you want to test a file cache compile&load cycle, you have to filter out many tests that always fail due to warning differences. It's hard to spot regressions because of that.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2018-06-28 04:40 UTC]
on the other hand, warnings should be killed anyway....

so I am not sure if it is worthy to do this...
 [2018-06-28 08:49 UTC]
@laruence: My main use for this is testing. To test file cache, you need to run something like

    sapi/cli/php run-tests.php -P -c php.ini -d opcache.file_cache=/tmp Zend/
    sapi/cli/php run-tests.php -P -c php.ini -d opcache.file_cache=/tmp -d opcache.validate_timestamps=0 Zend/

However, this causes a lot of test failures even if every thing works "correctly", due to differences in warnings.

Unless by killing warnings you mean that we have plans to remove them from PHP entirely, I think it makes sense to implement this.
 [2018-06-28 09:36 UTC]
I mean that if there is warning, people(php users) should fix it in there own codes...

anyway, I understand your point, maybe just disable opcache while test warnings?

I was concern that we need pay some costs, like performance reduce to achieve this... like save_cwd...

if it cost little, then I have no problems....
 [2018-06-28 09:39 UTC]
If there is a performance concern, I'd be fine with having this behind an ini flag like opcache.replay_warnings=1.
 [2019-10-07 08:43 UTC] hrvoje dot novosel at gmail dot com
When testing our project on PHP 7.4 I noticed the curly braces deprecation appears only on 1st page load. I'm guessing this is the same thing as this bug report... are there plans to fix this or will it stay as is?
 [2019-10-07 16:02 UTC]
Yes, that's the same problem. I expect this will get fixed eventually, but nobody is actively working on it :)
 [2020-05-20 09:21 UTC]
-Status: Open +Status: Closed -Assigned To: +Assigned To: nikic
 [2020-05-20 09:21 UTC]
Implemented in behind a default disabled opcache.record_warnings setting.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Mar 05 12:01:29 2024 UTC