Bug #81652 [Ver->Csd]: The value of error_reporting() gets overridden

From: Date: Wed, 24 Nov 2021 14:21:18 +0000
Subject: Bug #81652 [Ver->Csd]: The value of error_reporting() gets overridden
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-237965@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=81652&edit=1

 ID:                 81652
 Updated by:         git@php.net
 Reported by:        joupicky at gmail dot com
 Summary:            The value of error_reporting() gets overridden
-Status:             Verified
+Status:             Closed
 Type:               Bug
 Package:            opcache
 Operating System:   Ubuntu 20.04.3 LTS
 PHP Version:        8.0.13
 Block user comment: N
 Private report:     N

 New Comment:

Automatic comment on behalf of nikic
Revision: https://github.com/php/php-src/commit/be271f277eb5a9a3fc35f20bffb85b0d4957f4a6
Log: Fix bug #81652


Previous Comments:
------------------------------------------------------------------------
[2021-11-24 14:03:56] nikic@php.net

The QM_ASSIGN to T0 is eliminated, even though there is a read of T0 in between:

Foo::bar:
     ; (lines=10, args=0, vars=0, tmps=2, ssa_vars=3, no_loops)
     ; (after dce pass)
     ; /home/nikic/php/php-src/t484.php:6-8
     ; return  [null] RANGE[0..0]
BB0:
     ; start exit lines=[0-9]
     ; level=0
0000 #0.T0 [long] = BEGIN_SILENCE
0001 INIT_FCALL 2 112 string("random_int")
0002 SEND_VAL int(0) 1
0003 SEND_VAL int(100) 2
0004 #1.V1 [long] = DO_ICALL
0005 END_SILENCE #0.T0 [long]
0006 #2.T0 [long] = QM_ASSIGN #1.V1 [long]
0007 ASSIGN_OBJ THIS string("a")
0008 OP_DATA #2.T0 [long]
0009 RETURN null

Foo::bar:
     ; (lines=9, args=0, vars=0, tmps=2, ssa_vars=3, no_loops)
     ; (after dfa pass)
     ; /home/nikic/php/php-src/t484.php:6-8
     ; return  [null] RANGE[0..0]
BB0:
     ; start exit lines=[0-8]
     ; level=0
0000 #0.T0 [long] = BEGIN_SILENCE
0001 INIT_FCALL 2 112 string("random_int")
0002 SEND_VAL int(0) 1
0003 SEND_VAL int(100) 2
0004 #2.T0 [long] = DO_ICALL
0005 END_SILENCE #0.T0 [long]
0006 ASSIGN_OBJ THIS string("a")
0007 OP_DATA #2.T0 [long]
0008 RETURN null

------------------------------------------------------------------------
[2021-11-24 11:36:48] nikic@php.net

I can repro with opcache.

------------------------------------------------------------------------
[2021-11-24 11:34:44] cmb@php.net

Do you have OPcache enabled?  Maybe even JIT?  Is it reproducible
without OPcache?

------------------------------------------------------------------------
[2021-11-24 00:03:04] james at gogo dot co dot nz

Final note, I can also reproduce in PHP 8.1 (adjust reproduction script as appropriate).

------------------------------------------------------------------------
[2021-11-23 23:58:42] james at gogo dot co dot nz

I'll add also that the test case can be simplified to

----------

<?php

error_reporting(E_ALL);

echo "Should Equal 32767: " . error_reporting() . "\n";

$a = true;
$b = $a ? @random_int(0,100) : false;

echo "Should Equal 32767: " . error_reporting() . "\n";

----------


It seems to the ternary which is the critical factor in producing the error.

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


The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at

    https://bugs.php.net/bug.php?id=81652


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


Thread (10 messages)

« previous php.bugs (#237965) next »