Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initialized array in class causes SIGSEGV #143

Open
pbiggar opened this issue Jun 3, 2015 · 3 comments
Open

Initialized array in class causes SIGSEGV #143

pbiggar opened this issue Jun 3, 2015 · 3 comments

Comments

@pbiggar
Copy link
Owner

pbiggar commented Jun 3, 2015

What steps will reproduce the problem?
1. Compile phc -c myclass.php -o myclass
2.Execute

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

SIGSEGV error

What version of the product are you using? On what operating system?

0.2.0 on FreeBSD 7.0

Please provide any additional information below.


This code is an example. Initializing the array in the constructor eliminates the problem.
But it was very difficult to isolate the problem.

<?
/*
        my_class.php
*/
        class foobar {
                var $stuff = array (
                        'foo' => 1,
                        'bar' => 2
                );
                function foobar() {
                        // empty constructor
                }
        }
        $foobar = new foobar;

        foreach ($foobar->stuff as $key => $val)
                echo "$key => $val\n";
?>

Original issue reported on code.google.com by dennis.etinc on 2011-06-23 12:02:12

@pbiggar
Copy link
Owner Author

pbiggar commented Jun 3, 2015

I would suggest trying the version from svn, rather than 0.2.0. Code gen support is
significantly improved, though I don't know for sure if it fixes this problem.

Original issue reported on code.google.com by paul.biggar on 2011-06-23 17:19:43

@pbiggar
Copy link
Owner Author

pbiggar commented Jun 3, 2015

Testcase crashes for me with trunk version, too.


Program received signal SIGSEGV, Segmentation fault.
0x0000000000403f89 in persistent_clone (in=0xa9e9fc4589, destroy_in=1)
(gdb) bt
#0  0x0000000000403f89 in persistent_clone (in=0xa9e9fc4589, destroy_in=1)
#1  0x000000000040409d in persistent_clone (in=0x754e38, destroy_in=1)
#2  0x000000000040416d in phc_declare_property (ce=0x784bd0,
    name=0x4084ce "stuff", name_length=5, property=0x754e38, access_type=256)
#3  0x0000000000407d2d in zm_startup_app (type=1, module_number=23)
#4  0x00007ffff7a1e46f in zend_startup_module_ex (module=0x7849d0)
    at /home/oliver/php-5.2.10/Zend/zend_API.c:1472
#5  0x00007ffff7a227f6 in zend_startup_module (module=<value optimized out>)
    at /home/oliver/php-5.2.10/Zend/zend_API.c:1896
#6  0x0000000000407eea in main (argc=1, argv=0x7fffffffe628)

Original issue reported on code.google.com by oliver.metz on 2011-08-19 14:34:30

@pbiggar
Copy link
Owner Author

pbiggar commented Jun 3, 2015

Would love to see a patch for this, but I haven't got time to do it myself :(

Original issue reported on code.google.com by paul.biggar on 2011-08-22 08:35:12

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant