Bug #78874 [Opn->Fbk]: 'opcache.preload' fires function magically with stange param

From: Date: Fri, 13 Dec 2019 10:10:29 +0000
Subject: Bug #78874 [Opn->Fbk]: 'opcache.preload' fires function magically with stange param
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-224259@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=78874&edit=1

 ID:                 78874
 Updated by:         nikic@php.net
 Reported by:        bugreport at example dot com
 Summary:            'opcache.preload' fires function magically with
                     stange param
-Status:             Open
+Status:             Feedback
 Type:               Bug
 Package:            opcache
 PHP Version:        7.4Git-2019-11-27 (Git)
 Block user comment: N
 Private report:     N

 New Comment:

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.


Previous Comments:
------------------------------------------------------------------------
[2019-11-28 07:49:45] 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-11-27 15:51:53] 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'


------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=78874&edit=1


Thread (5 messages)

« previous php.bugs (#224259) next »