php.net |  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: nikic@php.net Assigned: nikic (profile)
Status: Closed Package: opcache
PHP Version: Irrelevant OS:
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: nikic@php.net
New email:
PHP Version: OS:

 

 [2018-06-27 09:00 UTC] nikic@php.net
Description:
------------
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.


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2018-06-28 04:40 UTC] laruence@php.net
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] nikic@php.net
@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] laruence@php.net
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] nikic@php.net
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] nikic@php.net
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] nikic@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: nikic
 [2020-05-20 09:21 UTC] nikic@php.net
Implemented in https://github.com/php/php-src/commit/0a74da385dd1cf25cf7870fdc82cbe1c7256fab3 behind a default disabled opcache.record_warnings setting.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Oct 13 20:01:26 2024 UTC