Bug #70428 [ReO->Fbk]: Opcache crashes with SIGSEGV

[email protected]
Newsgroups php.bugs
Message-ID <[email protected]>
Edit report at https://bugs.php.net/bug.php?id=70428&edit=1

 ID:                 70428
 Updated by:         [email protected]
 Reported by:        christian at rishoj dot net
 Summary:            Opcache crashes with SIGSEGV
-Status:             Re-Opened
+Status:             Feedback
 Type:               Bug
 Package:            opcache
 Operating System:   Ubuntu 14.04
 PHP Version:        5.6.12
 Block user comment: N
 Private report:     N

 New Comment:

@viking:
> $this->{self::TEST_CONST}();
That will cause PHP to call testConst() repeatedly until the process eventually runs out of stack space and crashes. This is expected behavior.

Do you have a test case that is related to @christian's problem with opcache and the opcache.interned_strings_buffer setting?


Previous Comments:
------------------------------------------------------------------------
[2015-12-23 08:57:15] viking at xakep dot ru

No, it not that bug. So this is one, but floating reproduction. Always reproduce after first crash of php_fpm
TestClass.php >>
<?php
class TestClass {
	public function __get($field)
	{}

	public function someMethodName()
	{
		return $this->someMethodName;
	}
}
?>
-----------------------
baseClass.php >>
spl_autoload_register(function($className){
	$fileName = $className . '.php';
	include $fileName;
});
class baseClass extends TestClass{
	const TEST_CONST = 'testConst';
	private function testConst()
	{
		if ( true) {
			$this->{self::TEST_CONST}();

		}
	}
}
$class = new baseClass();
?>


php 5.6.12 on 3.10.0-229.7.2.el7.x86_64

------------------------------------------------------------------------
[2015-12-21 09:34:38] christian at rishoj dot net

Thanks, but are you sure this test case reproduces the opcache bug?

It causes the PHP CLI interpreter to crash with SIGSEGV regardless of whether opcache is enabled or not. 

Also, judging from a back trace, the crash does not not seem to involve the opcache.

------------------------------------------------------------------------
[2015-12-21 08:32:48] viking at xakep dot ru

i've isolated minimal test case.

<?php
spl_autoload_register(function($className){
	$fileName = $className . '.php';
	include $fileName;
	unlink($fileName);
});
$symbols = array_merge(range('a', 'z'), range('A', 'Z'), ['_']);
class baseClass {
	public $arr = [];
}
$oldClassName = 'baseClass';
for ($k=0; $k < 10000; ++$k) {
	$className = '';
	do {
		for ($len = rand(10, 22); $len > 0; --$len) {
			$className .= $symbols[rand(0, count($symbols) - 1)];
		}
	} while (class_exists($className, false));
	$className = trim($className, '_ ');
	$code = '<?php
	class ' . $className . ' extends ' . $oldClassName . '{}';
	file_put_contents($className . '.php', $code);
	$oldClassName = $className;
}
$class = new $className($class);

var_dump($class);

------------------------------------------------------------------------
[2015-10-18 04:22:21] php-bugs at lists dot php dot net

No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.

------------------------------------------------------------------------
[2015-10-04 06:26:04] [email protected]

Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves. 

A proper reproducing script starts with <?php and ends with ?>,
is max. 10-20 lines long and does not require any external 
resources such as databases, etc. If the script requires a 
database to demonstrate the issue, please make sure it creates 
all necessary tables, stored procedures etc.

Please avoid embedding huge scripts into the report.



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


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=70428


--
Edit this bug report at https://bugs.php.net/bug.php?id=70428&edit=1
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.