Bug #55382 [Opn->Fbk]: Crash on GLOBALS inside traits
| From: | felipe@php.net | Date: | Mon, 08 Aug 2011 22:18:46 +0000 |
| Subject: | Bug #55382 [Opn->Fbk]: Crash on GLOBALS inside traits | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-162473@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=55382&edit=1
ID: 55382
Updated by: felipe@php.net
Reported by: ava3ar at gmail dot com
Summary: Crash on GLOBALS inside traits
-Status: Open
+Status: Feedback
Type: Bug
Package: Unknown/Other Function
Operating System: Gentoo
PHP Version: 5.4SVN-2011-08-08 (SVN)
Block user comment: N
Private report: N
New Comment:
Thank you for this bug report. To properly diagnose the problem, we
need a backtrace to see what is happening behind the scenes. To
find out how to generate a backtrace, please read
http://bugs.php.net/bugs-generating-backtrace.php
for *NIX and
http://bugs.php.net/bugs-generating-backtrace-win32.php
for Win32
Once you have generated a backtrace, please submit it to this bug
report and change the status back to "Open". Thank you for helping
us make PHP better.
Previous Comments:
------------------------------------------------------------------------
[2011-08-08 15:18:31] ava3ar at gmail dot com
If you change the test trait to
<?php
trait test {
function tester($cCookie) {
if ($cCookie) {
if (isset($_COOKIE[$cCookie])) {
return $_COOKIE[$cCookie];
}
}
return false;
}
}
//
you get a zend_mm_corrupt
------------------------------------------------------------------------
[2011-08-08 15:17:10] ava3ar at gmail dot com
Description:
------------
if you use GLOBAL variables inside traits, e.g. $_COOKIE, it segfaults
Test script:
---------------
<?php
trait test {
function tester($cCookie = false) {
if ($cCookie) {
if (isset($_COOKIE[$cCookie])) {
return $_COOKIE[$cCookie];
}
}
return false;
}
}
<?php
class asda {
use test;
function beep() {
$this->tester("test");
}
}
$a = new asda();
echo $a->beep();
Expected result:
----------------
false, or contents
Actual result:
--------------
Segfault
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=55382&edit=1