Bug #77743 [NEW]: Random evaluation
| From: | houman dot bakhtiari at groupe-gts dot fr | Date: | Thu, 14 Mar 2019 17:00:42 +0000 |
| Subject: | Bug #77743 [NEW]: Random evaluation | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-219966@lists.php.net to get a copy of this message | ||
From: houman dot bakhtiari at groupe-gts dot fr
Operating system: Debian (test on docker FPM 7.3)
PHP version: 7.2.16
Package: opcache
Bug Type: Bug
Bug description:Random evaluation
Description:
------------
Here is a bug coming from OPCACHE (I think because doesn't appears when
disabled). Random evaluation of a variable when OPCACHE is activated. At
first run I obtain "bool(false) bool(false) bool(false) bool(false)",
After some refresh I always obtain "bool(true) bool(true) bool(true)
bool(true)". This bug doesn't appear when all the scripts are in the
same file. The bug exists on all 7.2.x and 7.3.x.
Test script:
---------------
test.php :
===
<?php
require 'test2.php';
function myRet(){
return 45;
}
$toto = new Toto();
$toto->process1();
-----------------------
test2.php :
===
<?php
class Toto
{
public function process1()
{
$array_error = [];
$keep_products = [1, 2, 3, 4];
foreach ($keep_products as $k => $v)
{
$id_country = myRet();
if ($id_country === false && false)
{
}
var_dump($id_country === false);
}
}
}
---------------------
Dockerfile :
===
FROM php:7.2.0-fpm-alpine
RUN docker-php-ext-install opcache
WORKDIR /var/www
EXPOSE 9000
CMD ["php-fpm"]
Expected result:
----------------
bool(false) bool(false) bool(false) bool(false)
Actual result:
--------------
after fome refresh : bool(true) bool(true) bool(true) bool(true)
--
Edit bug report at https://bugs.php.net/bug.php?id=77743&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=77743&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=77743&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=77743&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=77743&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=77743&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=77743&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=77743&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=77743&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=77743&r=support
Expected behavior: https://bugs.php.net/fix.php?id=77743&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=77743&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=77743&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=77743&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=77743&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=77743&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=77743&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=77743&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=77743&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=77743&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=77743&r=mysqlcfg