php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #78874 'opcache.preload' fires function magically with stange param
Submitted: 2019-11-27 15:51 UTC Modified: 2019-12-13 14:21 UTC
From: bugreport at example dot com Assigned:
Status: Open Package: opcache
PHP Version: 7.4Git-2019-11-27 (Git) OS:
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: bugreport at example dot com
New email:
PHP Version: OS:

 

 [2019-11-27 15:51 UTC] bugreport at example dot com
Description:
------------
that below is a simplified version of our 'opcache.preload' with no active code

our build-environemt is calling 4 cli scripts and a forground httpd using the same php.ini under the same user  and global_preload_msg() is called multiple times with an arbitary string for $preload_file

sometimes this happens only one time, sometimes every start of a cli-script triggers global_preload_msg()

in normal operations the function receives the return value of opcache_compile_file and the full path compiled file

besides that strange calls of global_preload_msg() everything is working fine meaning all invocations of the cli-scripts and the webserver are logging success for each expected call of opcache_compile_file()

so the question why global_preload_msg() is executed at all even when the 'opcache.preload' only contains the function itself which so couldn't fire

for now i wrapped a file_exists() around the whole function code to silence it

that is pretty new and didn't happen with older git-snapshots

Test script:
---------------
<?php declare(strict_types=1);
function global_preload_msg(string $preload_file, bool $status): void
{
 if($status === FALSE )
 {
  switch($status)
  {
   case TRUE:  $status_out = 'OK'; break;
   case FALSE: $status_out = 'FAILED'; break;
  }
  error_log("PHP-PRELOAD " . strtoupper(PHP_SAPI) . ": $status_out '" . str_replace(__DIR__, '', $preload_file) . "'");
 }
}
?>

Expected result:
----------------
empty error log

Actual result:
--------------
error_log after the code-coverage run:

[27-Nov-2019 12:21:05 UTC] PHP-PRELOAD CLI: FAILED '07f6aea80a'
[27-Nov-2019 12:21:05 UTC] PHP-PRELOAD CLI: FAILED '8903342d78'
[27-Nov-2019 12:21:06 UTC] PHP-PRELOAD CLI: FAILED '0337428158'
[27-Nov-2019 12:21:07 UTC] PHP-PRELOAD CLI: FAILED '3afe1bdd1d'

Patches

Add a Patch

Pull Requests

Pull requests:

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2019-11-28 07:49 UTC] lsukaca at gmail dot com
The following pull request has been associated:

Patch Name: Remove PhptOverrideManager
On GitHub:  https://github.com/php/pftt2/pull/78
Patch:      https://github.com/php/pftt2/pull/78.patch
 [2019-12-13 10:10 UTC] nikic@php.net
-Status: Open +Status: Feedback
 [2019-12-13 10:10 UTC] nikic@php.net
We've fixed quite a few issues with preloading in the last few days, so it would be nice to recheck whether the issue has been resolved.
 [2019-12-13 14:19 UTC] bugreport at example dot com
still present as soon as i remove the enclosing file_exists() from the function

latest PHP 7l.4 snapshot
https://git.php.net/?p=php-src.git;a=commit;h=0f2cdbf214efd98b4bdaf5ca41728faf00e7c037

PROFILE START: 13.12.2019 15:16:26
PROFILE STOP:  13.12.2019 15:16:51

PROFILING: 00:25 (25 Sec)

[13-Dec-2019 15:16:36 Europe/Vienna] PHP-PRELOAD: FAILED 'c80ea739f0'
[13-Dec-2019 15:16:37 Europe/Vienna] PHP-PRELOAD: FAILED 'ed6f310bb3'
[13-Dec-2019 15:16:38 Europe/Vienna] PHP-PRELOAD: FAILED '183fc0d84a
 [2019-12-13 14:21 UTC] nikic@php.net
-Status: Feedback +Status: Open
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Apr 16 16:01:28 2024 UTC