php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #77492 function return empty
Submitted: 2019-01-20 16:41 UTC Modified: 2019-01-21 12:23 UTC
From: poiuty at lepus dot su Assigned:
Status: Duplicate Package: opcache
PHP Version: 7.3.1 OS: debian 9
Private report: No CVE-ID: None
 [2019-01-20 16:41 UTC] poiuty at lepus dot su
Description:
------------
[opcache]
opcache.enable=1
opcache.enable_cli=1
opcache.interned_strings_buffer=8
opcache.max_accelerated_files=4000

# php -v
PHP 7.3.1-1+0~20190113101756.25+stretch~1.gbp15aaa9 (cli) (built: Jan 13 2019 10:17:57) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.1, Copyright (c) 1998-2018 Zend Technologies
    with Zend OPcache v7.3.1-1+0~20190113101756.25+stretch~1.gbp15aaa9, Copyright (c) 1999-2018, by Zend Technologies




Test script:
---------------
function testB(){
	$x = ['a' => '', 'b' => '']; 
	$num = range(0, 9); 
	foreach($num as $k){
		$x['a'] .= $k;
	}
	return $x;
}
function testA(){
	$x = ['a' => '', 'b' => '']; 
	$num = range(0, 9); 
	foreach($num as $k){
		$x['a'] .= $k;
	}
	return $x['a'];
}
// if opcache.enable=1 => string(0) ""
// if opcache.enable=0 => string(10) "0123456789"
// if call first testB() => string(10) "0123456789"
//var_dump(testB());
var_dump(testA());

full script: https://gist.github.com/poiuty/9759972fcc6bee42bbb250c03ef43e77


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2019-01-21 12:23 UTC] nikic@php.net
-Status: Open +Status: Duplicate
 [2019-01-21 12:23 UTC] nikic@php.net
This is the issue mentioned in the comments of bug #77310 and will be fixed in PHP 7.3.2.
 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Sun Oct 25 20:01:23 2020 UTC