From:             r dot wilczek at web-appz dot de
Operating system: Linux
PHP version:      5.4.6
Package:          Reflection related
Bug Type:         Bug
Bug description:ReflectionClass::getTraitAliases crashes on importing trait 
methods as private

Description:
------------
When importing a traitmethod 'as private',
ReflectionClass::getTraitAliases() segfaults.

Test script:
---------------
File testme.php:
<?php
trait myTrait {
    public function run() {}
}
class myClass {
    use myTrait {
        MyTrait::run as private;
    }
}
$class = new \ReflectionClass('myClass');
$class->getTraitAliases();
?>

Commandline:
/usr/bin/php testme.php

Expected result:
----------------
no segmentation fault 

Actual result:
--------------
Segmentation fault

gdb /usr/bin/php core

...
This GDB was configured as "x86_64-suse-linux".
...
Reading symbols from /usr/bin/php...done.
[New LWP 27460]
...
Core was generated by `php testme.php'.
Program terminated with signal 11, Segmentation fault.
#0  0x00000000009c7c66 in zend_symtable_update (ht=0x7f907f86f918,
arKey=0x0, nKeyLength=1515870811, pData=0x7ffff0ad0990, nDataSize=8,
pDest=0x0)
    at /root/php-5.4.6/Zend/zend_hash.h:350
350     /root/php-5.4.6/Zend/zend_hash.h: Datei oder Verzeichnis nicht
gefunden.
        in /root/php-5.4.6/Zend/zend_hash.h


bt

#0  0x00000000009c7c66 in zend_symtable_update (ht=0x7f907f86f918,
arKey=0x0, nKeyLength=1515870811, pData=0x7ffff0ad0990, nDataSize=8,
pDest=0x0)
    at /root/php-5.4.6/Zend/zend_hash.h:350
#1  0x00000000009ccc81 in add_assoc_stringl_ex (arg=0x7f907f86f1c0,
key=0x0, key_len=1515870811, str=0x7f907f86f238 "MyTrait::run", length=12,
duplicate=0)
    at /root/php-5.4.6/Zend/zend_API.c:1234
#2  0x000000000074373e in zim_reflection_class_getTraitAliases (ht=0,
return_value=0x7f907f86f1c0, return_value_ptr=0x0, this_ptr=0x7f90855eeed0,

    return_value_used=0) at
/root/php-5.4.6/ext/reflection/php_reflection.c:4475
#3  0x0000000000a05c70 in zend_do_fcall_common_helper_SPEC
(execute_data=0x7f90855b20e8) at
/root/php-5.4.6/Zend/zend_vm_execute.h:642
#4  0x0000000000a06b1d in ZEND_DO_FCALL_BY_NAME_SPEC_HANDLER
(execute_data=0x7f90855b20e8) at
/root/php-5.4.6/Zend/zend_vm_execute.h:752
#5  0x0000000000a0464f in execute (op_array=0x7f90855efec8) at
/root/php-5.4.6/Zend/zend_vm_execute.h:410
#6  0x00000000009c792a in zend_execute_scripts (type=8, retval=0x0,
file_count=3) at /root/php-5.4.6/Zend/zend.c:1289
#7  0x000000000093c7e4 in php_execute_script (primary_file=0x7ffff0ad4290)
at /root/php-5.4.6/main/main.c:2473
#8  0x0000000000b0d616 in do_cli (argc=2, argv=0x7ffff0ad4648) at
/root/php-5.4.6/sapi/cli/php_cli.c:988
#9  0x0000000000b0e6be in main (argc=2, argv=0x7ffff0ad4648) at
/root/php-5.4.6/sapi/cli/php_cli.c:1364

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

Reply via email to