php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #78015 Incorrect evaluation of expressions involving partials array in SCCP
Submitted: 2019-05-15 11:10 UTC Modified: 2019-05-15 12:32 UTC
From: andrejs dot verza at gmail dot com Assigned: nikic (profile)
Status: Closed Package: opcache
PHP Version: 7.3.5 OS: Ubuntu 18.04
Private report: No CVE-ID: None
 [2019-05-15 11:10 UTC] andrejs dot verza at gmail dot com
Description:
------------
PHP 7.3.5 throws a "Fatal error: Uncaught Error: Unsupported operand types ..." when opcache is enabled in php.ini on Ubuntu Linux 16.04, 18.04, 19.04.

Notes:
- The error is only thrown on a first http request after server started or restarted (the following requests work as expected). 
- The error is thrown on Apache web server as well as on a PHP built-in web server.
- The error is not present on Windows.

Workaround:
Set opcache.optimization_level=0x7FFFBFDF in php.ini (instead of the default value 0x7FFFBFFF).

Test script:
---------------
index.php:
<?php require_once 'simple.php'; ?>

simple.php:
<?php

$x = 1;

function f() {
	global $x;

	$a = ['b' => [$x], 'c' => [$x]];
	$d = $a['b'] + $a['c'];
}


Expected result:
----------------
Empty output, no PHP errors.

Actual result:
--------------
Fatal error: Uncaught Error: Unsupported operand types in /var/www/html/index.php:1 Stack trace: #0 {main} thrown in /var/www/html/index.php on line 1

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2019-05-15 11:15 UTC] nikic@php.net
-Status: Open +Status: Verified
 [2019-05-15 11:15 UTC] nikic@php.net
The "require" seems to be necessary to reproduce this, for some reason.
 [2019-05-15 11:36 UTC] nikic@php.net
-Assigned To: +Assigned To: nikic
 [2019-05-15 12:32 UTC] nikic@php.net
-Summary: Fatal error when Opcache enabled on PHP 7.3.5 under Linux +Summary: Incorrect evaluation of expressions involving partials array in SCCP
 [2019-05-15 12:37 UTC] nikic@php.net
Automatic comment on behalf of nikita.ppv@gmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=9d76fbd0c4ae71df2a476ce7529728fa19b37549
Log: Fixed bug #78015
 [2019-05-15 12:37 UTC] nikic@php.net
-Status: Verified +Status: Closed
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Nov 21 09:01:32 2024 UTC