php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #62234 PHP crashes if a trait + alias is used.
Submitted: 2012-06-05 16:00 UTC Modified: 2015-09-20 04:22 UTC
Votes:1
Avg. Score:1.0 ± 0.0
Reproduced:0 of 1 (0.0%)
From: manchokapitancho at gmail dot com Assigned: cmb (profile)
Status: No Feedback Package: Reproducible crash
PHP Version: 5.4.4 OS: win 7
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: manchokapitancho at gmail dot com
New email:
PHP Version: OS:

 

 [2012-06-05 16:00 UTC] manchokapitancho at gmail dot com
Description:
------------
I am using Apache 2.2 + PHP 5.4.

After several crash situations (from apache log "Parent: child process exited 
with status 1 -- Restarting."), I've managed to isolate a problem. Since I don't 
know what it is exactly, here I list the symptoms:
1. It's not related to a specific code fragment. I am able to reproduce the 
crash by adding different code in different files.
2. Too much code leads to a crash. If I have a working code and I add for 
example 30 more functions to a class, I get a crash.
3. Adding more data does not affect the situation. By data I mean actions like 
changing $a = [1,2,3] to $a=[1,2,3, ....1000].
4. The entire script is executed till the end and then the crash happens. I 
asume this happen when the cleanup routines are executed.
5. The crashes are not memory related. I saw cases when the crash happens at 
around 612K and others when the script run ok at around 619K.
6. I've tested with xdebug on and off. No significant difference is present. If 
I don't have xdebug active, I need a few more empty functions into the code in 
order to reproduce the crash.

Here I've put some interesting observations that I've had.
http://crop-factor.net/php54crash.png

phpinfo says:

System	Windows NT 6.1 build 7600 (Windows 7 Enterprise Edition) i586
Build Date	May 8 2012 00:47:34
Compiler	MSVC9 (Visual C++ 2008)
Architecture	x86
Configure Command	cscript /nologo configure.js "--enable-snapshot-build" 
"--disable-isapi" "--enable-debug-pack" "--without-mssql" "--without-pdo-mssql" 
"--without-pi3web" "--with-pdo-oci=C:\php-sdk\oracle\instantclient10\sdk,shared" 
"--with-oci8=C:\php-sdk\oracle\instantclient10\sdk,shared" "--with-oci8-
11g=C:\php-sdk\oracle\instantclient11\sdk,shared" "--enable-object-out-
dir=../obj/" "--enable-com-dotnet" "--with-mcrypt=static" "--disable-static-
analyze" "--with-pgo"
Server API	Apache 2.0 Handler
PHP API	20100412
PHP Extension	20100525
Zend Extension	220100525
Zend Extension Build	API220100525,TS,VC9
PHP Extension Build	API20100525,TS,VC9
Debug Build	no
Thread Safety	enabled



Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2012-06-06 05:54 UTC] manchokapitancho at gmail dot com
Reproduced in CLI mode. Ran the same code and simulated some $_SERVER values. I 
get 1:1 result so it is not Apache related. The message I get at the end of the 
script is: zend_mm_heap corrupted.
 [2012-06-06 06:06 UTC] manchokapitancho at gmail dot com
-Status: Open +Status: Closed
 [2012-06-06 06:06 UTC] manchokapitancho at gmail dot com
My bug seems to be a duplicate of this one.
https://bugs.php.net/bug.php?id=61998

I had 3 occurrences of use X as Y. After removing them, there were no more 
crashes.
I tried the latest snapshot and I have no more problems with the original code.
 [2012-06-06 06:31 UTC] manchokapitancho at gmail dot com
-Summary: PHP crashes if a load of code is loaded. +Summary: PHP crashes if a trait + alias is used. -Status: Closed +Status: Assigned -Package: Scripting Engine problem +Package: Reproducible crash -PHP Version: 5.4.3 +PHP Version: 5.4.5-dev
 [2012-06-06 06:31 UTC] manchokapitancho at gmail dot com
Sorry, my fault. The bug is still there. If I don't have aliases, everything is 
fine. But once I uncomment one, the error is back. 
Tried 5.5.0-dev and 5.4.5-dev.

class XXX {
 use \logi\tile\html\feature { getTemplateNames as getTemplateNamesBase; }
 protected function getTemplateNames() {
    $tpls = (array)$this->getTemplateNamesBase();
    array_push ($tpls, "/listing\\template");
    array_push ($tpls, "admin\\listing\\template");
    return $tpls;
 }
}

It is worth mentioning that the trait is autoloaded.
 [2012-06-06 06:32 UTC] manchokapitancho at gmail dot com
-Status: Assigned +Status: Open
 [2012-06-06 06:32 UTC] manchokapitancho at gmail dot com
Reopening...
 [2012-06-06 08:09 UTC] laruence@php.net
-Status: Open +Status: Feedback
 [2012-06-06 08:09 UTC] laruence@php.net
Please try using this snapshot:

  http://snaps.php.net/php-trunk-latest.tar.gz
 
For Windows:

  http://windows.php.net/snapshots/


 [2012-06-06 12:02 UTC] manchokapitancho at gmail dot com
-Status: Feedback +Status: Open
 [2012-06-06 12:02 UTC] manchokapitancho at gmail dot com
Tried this one: For Windows: http://windows.php.net/snapshots/
But when I click on the link (VC9 x86 Thread Safe Zip [15.27MB]) I get the 
following error:
The page cannot be found.

I hope that someone will fix the windows build links. Then I can try again.
 [2012-06-11 02:10 UTC] j dot amend at gmail dot com
The Windows snapshots page seems to be broken since the git migration (https://bugs.php.net/bug.php?id=61712). I found the latest snapshot here though:
http://windows.php.net/downloads/snaps/php-5.4/r51a5e98/php-5.4-nts-windows-vc9-x86-r51a5e98.zip
 [2012-06-11 11:03 UTC] manchokapitancho at gmail dot com
-PHP Version: 5.4.5-dev +PHP Version: 5.4.4-snap
 [2012-06-11 11:03 UTC] manchokapitancho at gmail dot com
Thanks! Tried this one too. Still crashing when I uncomment the use ... as ... 
code.
 [2012-06-14 20:12 UTC] manchokapitancho at gmail dot com
-PHP Version: 5.4.4-snap +PHP Version: 5.4.4
 [2012-06-14 20:12 UTC] manchokapitancho at gmail dot com
The bug is STILL present. Tried on the official PHP 5.4.4 TS apache version.
 [2015-09-08 20:46 UTC] cmb@php.net
-Status: Open +Status: Feedback -Assigned To: +Assigned To: cmb
 [2015-09-08 20:46 UTC] cmb@php.net
Does this issue still persist with current PHP versions (such as
PHP 5.6.13)?
 [2015-09-20 04:22 UTC] 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.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 26 05:01:30 2024 UTC