From:             gregbenner1 at gmail dot com
Operating system: CentOS 6.4
PHP version:      5.4.17
Package:          Reproducible crash
Bug Type:         Bug
Bug description:get_defined_constants() causes PHP to crash in a very limited 
case.

Description:
------------
The function get_defined_constants(); (with or without the bool parameter)
causes 
PHP to segfault when used in the same script as a Class that uses a Trait
which 
has the __CLASS__ magic constant somewhere in it.

If you replace __CLASS__ with get_called_class() it works fine.

Test script:
---------------
<?php

trait TestTrait
{
    public static function testStaticFunction()
    {
        return __CLASS__;
    }
}
class Tester
{
    use TestTrait;
}
$tester = Tester::testStaticFunction();

get_defined_constants();
echo "It Worked!";

Expected result:
----------------
The text "It Worked!" output.

Actual result:
--------------
PHP crashes and the following is left in my Apache error log:
[Thu Jul 18 13:22:33 2013] [notice] child pid ##### exit signal
Segmentation fault 
(11)

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

Reply via email to