pbiggar / phc

A compiler for PHP

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

PHC SIGSEGV received when magic method __sleep used

pbiggar opened this issue · comments

What steps will reproduce the problem?
1. See attached example
2. phc -c dns-class.php -o test
3. ./test

What is the expected output? What do you see instead?

phc -O3 -c dns-class.php -o test
Warning: The optimizer has failed for the following reason:
src/optimize/Class_info.cpp:104:
Magic method '__sleep is not supported

[securegateway-devel]~# ./test
SIGSEGV received!
This could be a bug in phc. If you suspect it is, please email
a bug report to phc-general@phpcompiler.org.


What version of the product are you using? On what operating system?
Latest PHC SVN version.
Running on Slackware Linux 13.1 buildroot 2.6.33.4-smp #1 SMP Wed May 12 21:39:37 CDT
2010 i686 QEMU Virtual CPU version 0.12.5 AuthenticAMD GNU/Linux

Please provide any additional information below.

Original issue reported on code.google.com by cassiano%polaco.pro.br@gtempaccount.com on 2011-01-24 11:31:57


- _Attachment: [dns-class.php](https://storage.googleapis.com/google-code-attachments/phc/issue-133/comment-0/dns-class.php)_
Just a note, it only crashes when optimization flag is set.

-O0 works fine
-O1 crashes
-O2 crashes
-O3 crashes

Original issue reported on code.google.com by cassiano%polaco.pro.br@gtempaccount.com on 2011-01-24 11:34:38

We don't support any magic methods at the moment.

Actually, I'm surprised this works in the -O0 case.

Original issue reported on code.google.com by paul.biggar on 2011-01-24 20:33:12

I also tested with a simple class, like this:

class x
{
   private $y;
}

$z = new x();

It also segfaults when using -O3

Original issue reported on code.google.com by cassiano%polaco.pro.br@gtempaccount.com on 2011-01-24 22:49:43

I think we don't support variable modifiers ('private'). It should work without that.

Original issue reported on code.google.com by paul.biggar on 2011-01-24 23:06:16