Bug #77743 [Asn->Csd]: Random evaluation
| From: | nikic@php.net | Date: | Mon, 18 Mar 2019 09:52:02 +0000 |
| Subject: | Bug #77743 [Asn->Csd]: Random evaluation | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-220028@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=77743&edit=1
ID: 77743
Updated by: nikic@php.net
Reported by: houman dot bakhtiari at groupe-gts dot fr
Summary: Random evaluation
-Status: Assigned
+Status: Closed
Type: Bug
Package: opcache
Operating System: Debian (test on docker FPM 7.3)
PHP Version: 7.2.16
Assigned To: nikic
Block user comment: N
Private report: N
New Comment:
Automatic comment on behalf of nikita.ppv@gmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=54bf8c820f4ac2c9204cd09b66fbe99c3db5939b
Log: Fixed bug #77743
Previous Comments:
------------------------------------------------------------------------
[2019-03-18 09:39:08] nikic@php.net
It looks like we're inserting incorrect pi nodes when a jmpznz has identical successors. The pi
nodes are supposed to apply only to one edge each, but as they're distinguished by predecessor
rather than edge that doesn't work.
------------------------------------------------------------------------
[2019-03-15 18:09:21] houman dot bakhtiari at groupe-gts dot fr
the bug also produces with this code :
<?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)
{
if (false){}
}
//var_dump($id_country);//interesting evaluation to test
var_dump($id_country === false);
}
}
}
------------------------------------------------------------------------
[2019-03-14 17:00:42] houman dot bakhtiari at groupe-gts dot fr
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 this bug report at https://bugs.php.net/bug.php?id=77743&edit=1