Bug #72469 [NEW]: Coredump while constructing the class in the constructor

From: Date: Wed, 22 Jun 2016 11:56:59 +0000
Subject: Bug #72469 [NEW]: Coredump while constructing the class in the constructor
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-201795@lists.php.net to get a copy of this message
From:             brupje at gmail dot com
Operating system: Ubuntu 14.04.4 LTS
PHP version:      7.0.7
Package:          Reproducible crash
Bug Type:         Bug
Bug description:Coredump while constructing the class in the constructor

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

-- 
Edit bug report at https://bugs.php.net/bug.php?id=72469&edit=1
-- 
Try a snapshot (PHP 5.4):   https://bugs.php.net/fix.php?id=72469&r=trysnapshot54
Try a snapshot (PHP 5.5):   https://bugs.php.net/fix.php?id=72469&r=trysnapshot55
Try a snapshot (trunk):     https://bugs.php.net/fix.php?id=72469&r=trysnapshottrunk
Fixed in SVN:               https://bugs.php.net/fix.php?id=72469&r=fixed
Fixed in release:           https://bugs.php.net/fix.php?id=72469&r=alreadyfixed
Need backtrace:             https://bugs.php.net/fix.php?id=72469&r=needtrace
Need Reproduce Script:      https://bugs.php.net/fix.php?id=72469&r=needscript
Try newer version:          https://bugs.php.net/fix.php?id=72469&r=oldversion
Not developer issue:        https://bugs.php.net/fix.php?id=72469&r=support
Expected behavior:          https://bugs.php.net/fix.php?id=72469&r=notwrong
Not enough info:            https://bugs.php.net/fix.php?id=72469&r=notenoughinfo
Submitted twice:            https://bugs.php.net/fix.php?id=72469&r=submittedtwice
register_globals:           https://bugs.php.net/fix.php?id=72469&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=72469&r=php4
Daylight Savings:           https://bugs.php.net/fix.php?id=72469&r=dst
IIS Stability:              https://bugs.php.net/fix.php?id=72469&r=isapi
Install GNU Sed:            https://bugs.php.net/fix.php?id=72469&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=72469&r=float
No Zend Extensions:         https://bugs.php.net/fix.php?id=72469&r=nozend
MySQL Configuration Error:  https://bugs.php.net/fix.php?id=72469&r=mysqlcfg



Thread (2 messages)

« previous php.bugs (#201795) next »