Edit report at https://bugs.php.net/bug.php?id=55382&edit=1

 ID:                 55382
 Updated by:         fel...@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

Reply via email to