|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2016-06-22 11:56 UTC] brupje at gmail dot com
Description:
------------
I am using the ondrej-php compiled 7.0.7 packages on a up-to-date Ubuntu 14.04 LTS. I was doing some bad coding practises as per our current cms when a coredump occurred. I was able to create a test script that will reproducibly on my system will coredump apache.
The original code was much longer and more complex with subclasses, but I was able to minimize it to the code below. Basically what I did was put the class into a global variable and the use that global variable to call a non-existing function. It coredumps at creating the class in constructor.
Constructing the class you are currently constructing into a global is a one thing that should not be allowed I think, which would fix this particular issue at least.
Test script:
---------------
<?php
class foo {
public function __construct() {
$_GLOBAL['bar'] = new foo();
}
}
$foo = new foo();
?>
Expected result:
----------------
Error that you can't create the partial class in the constructor.
Actual result:
--------------
Coredump in apache child
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2026 The PHP GroupAll rights reserved. |
Last updated: Tue Oct 06 11:00:02 2026 UTC |
This code is the same than: function foo(){foo();} Endless recursion leading to stack exhaustion and crash.