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

Accessors: SIGSEGV on basic usage #3

Closed
Majkl578 opened this issue Nov 7, 2012 · 2 comments
Closed

Accessors: SIGSEGV on basic usage #3

Majkl578 opened this issue Nov 7, 2012 · 2 comments

Comments

@Majkl578
Copy link

Majkl578 commented Nov 7, 2012

Hello,
I wanted to experiment a bit with property accessors. I compiled you fork (master, c3a33e8), but I am not able to test anything since it segfaults.
Here is a simple PHP script:

<?php

class User
{
    public $name {
        get;
        set;
    }
}

This fails with a message Warning: String is not zero-terminated and ends with parse error. Here is an output from gdb:

$ gdb --args ./sapi/cli/php /www/temp.php
GNU gdb (GDB) 7.4.1-debian
Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /storage/build/php/php-src@cpriest/sapi/cli/php...done.
(gdb) run
Starting program: /storage/build/php/php-src@cpriest/sapi/cli/php /www/temp.php
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

Warning: String is not zero-terminated (return $this->name !== NULL) (source: Zend/zend_language_scanner.l:796) in /www/temp.php on line 8

Warning: Unexpected character in input:  ' in /www/temp.php on line 8

Parse error: syntax error, unexpected end of file in /www/temp.php on line 8

Program received signal SIGSEGV, Segmentation fault.
0x00000000007c5aac in _zend_is_inconsistent (ht=0xb8, file=0xcbd1b8 "/storage/build/php/php-src@cpriest/Zend/zend_hash.c", line=946) at /storage/build/php/php-src@cpriest/Zend/zend_hash.c:54
54      if (ht->inconsistent==HT_OK) {
(gdb) bt
#0  0x00000000007c5aac in _zend_is_inconsistent (ht=0xb8, file=0xcbd1b8 "/storage/build/php/php-src@cpriest/Zend/zend_hash.c", line=946)
    at /storage/build/php/php-src@cpriest/Zend/zend_hash.c:54
#1  0x00000000007c8750 in zend_hash_quick_find (ht=0xb8, arKey=0x7ffff7fc09f0 "name", nKeyLength=5, h=210721608966, pData=0x7fffffff8368)
    at /storage/build/php/php-src@cpriest/Zend/zend_hash.c:946
#2  0x0000000000784ffd in zend_do_begin_accessor_declaration (function_token=0x7fffffff8440, var_name=0x7fffffff87b0, modifiers=0x7fffffff8470, return_reference=0)
    at /storage/build/php/php-src@cpriest/Zend/zend_compile.c:1702
#3  0x0000000000785fe4 in zend_finalize_accessor (var_name=0x7fffffff87b0) at /storage/build/php/php-src@cpriest/Zend/zend_compile.c:1913
#4  0x0000000000758638 in zendparse () at /storage/build/php/php-src@cpriest/Zend/zend_language_parser.y:759
#5  0x000000000075df1b in compile_file (file_handle=0x7fffffffdf70, type=8) at Zend/zend_language_scanner.l:584
#6  0x0000000000604227 in phar_compile_file (file_handle=0x7fffffffdf70, type=8) at /storage/build/php/php-src@cpriest/ext/phar/phar.c:3388
#7  0x00000000007b65ed in zend_execute_scripts (type=8, retval=0x0, file_count=3) at /storage/build/php/php-src@cpriest/Zend/zend.c:1302
#8  0x00000000007285da in php_execute_script (primary_file=0x7fffffffdf70) at /storage/build/php/php-src@cpriest/main/main.c:2468
#9  0x0000000000910f96 in do_cli (argc=2, argv=0x7fffffffe318) at /storage/build/php/php-src@cpriest/sapi/cli/php_cli.c:988
#10 0x0000000000911f51 in main (argc=2, argv=0x7fffffffe318) at /storage/build/php/php-src@cpriest/sapi/cli/php_cli.c:1364

If you need anything more, just ping me back.


Do you think it is still possible to make this into 5.5? It would be really a killer-feature. 👍

@cpriest
Copy link
Owner

cpriest commented Nov 10, 2012

Hey Michael,

I've been sick for a few days, so just getting back to my email. I'll
check into this and let you know what's up.

-Clint

On 11/7/2012 8:50 AM, Michael Moravec wrote:

Hello,
I wanted to experiment a bit with property accessors. I compiled you
fork (master, c3a33e8
c3a33e806), but I am not
able to test anything since it segfaults.
Here is a simple PHP script:

name !== NULL) (source: Zend/zend_language_scanner.l:796) in /www/temp.php on line 8 Warning: Unexpected character in input: ' in /www/temp.php on line 8 Parse error: syntax error, unexpected end of file in /www/temp.php on line 8 Program received signal SIGSEGV, Segmentation fault. 0x00000000007c5aac in _zend_is_inconsistent (ht=0xb8, file=0xcbd1b8 "/storage/build/php/php-src@cpriest/Zend/zend_hash.c", line=946) at /storage/build/php/php-src@cpriest/Zend/zend_hash.c:54 54 if (ht->inconsistent==HT_OK) { (gdb) bt #0 0x00000000007c5aac in _zend_is_inconsistent (ht=0xb8, file=0xcbd1b8 "/storage/build/php/php-src@cpriest/Zend/zend_hash.c", line=946) at /storage/build/php/php-src@cpriest/Zend/zend_hash.c:54 #1 0x00000000007c8750 in zend_hash_quick_find (ht=0xb8, arKey=0x7ffff7fc09f0 "name", nKeyLength=5, h=210721608966, pData=0x7fffffff8368) at /storage/build/php/php-src@cpriest/Zend/zend_hash.c:946 #2 0x0000000000784ffd in zend_do_begin_accessor_declaration (function_token=0x7fffffff8440, var_name=0x7fffffff87b0, modifiers=0x7fffffff8470, return_reference=0) at /storage/build/php/php-src@cpriest/Zend/zend_compile.c:1702 #3 0x0000000000785fe4 in zend_finalize_accessor (var_name=0x7fffffff87b0) at /storage/build/php/php-src@cpriest/Zend/zend_compile.c:1913 #4 0x0000000000758638 in zendparse () at /storage/build/php/php-src@cpriest/Zend/zend_language_parser.y:759 #5 0x000000000075df1b in compile_file (file_handle=0x7fffffffdf70, type=8) at Zend/zend_language_scanner.l:584 #6 0x0000000000604227 in phar_compile_file (file_handle=0x7fffffffdf70, type=8) at /storage/build/php/php-src@cpriest/ext/phar/phar.c:3388 #7 0x00000000007b65ed in zend_execute_scripts (type=8, retval=0x0, file_count=3) at /storage/build/php/php-src@cpriest/Zend/zend.c:1302 #8 0x00000000007285da in php_execute_script (primary_file=0x7fffffffdf70) at /storage/build/php/php-src@cpriest/main/main.c:2468 #9 0x0000000000910f96 in do_cli (argc=2, argv=0x7fffffffe318) at /storage/build/php/php-src@cpriest/sapi/cli/php_cli.c:988 #10 0x0000000000911f51 in main (argc=2, argv=0x7fffffffe318) at /storage/build/php/php-src@cpriest/sapi/cli/php_cli.c:1364 | If you need anything more, just ping me back. --- Do you think it is possible to make this into 5.5? It would be really a killer-feature. 👍 — Reply to this email directly or view it on GitHub https://github.com//issues/3.

-Clint

@cpriest
Copy link
Owner

cpriest commented Nov 18, 2012

Hey Michael,

Sorry for the delay, this was caused by the change from != to !== for
auto-implemented isset(), I had forgotten to increase the fixed buffer
length and because I had moved my tests to a new location my test
scripts were not actually running my own tests as I had thought before
committing.

This should be fixed in the latest push.

-Clint

On 11/7/2012 8:50 AM, Michael Moravec wrote:

Hello,
I wanted to experiment a bit with property accessors. I compiled you
fork (master, c3a33e8
c3a33e806), but I am not
able to test anything since it segfaults.
Here is a simple PHP script:

name !== NULL) (source: Zend/zend_language_scanner.l:796) in /www/temp.php on line 8 Warning: Unexpected character in input: ' in /www/temp.php on line 8 Parse error: syntax error, unexpected end of file in /www/temp.php on line 8 Program received signal SIGSEGV, Segmentation fault. 0x00000000007c5aac in _zend_is_inconsistent (ht=0xb8, file=0xcbd1b8 "/storage/build/php/php-src@cpriest/Zend/zend_hash.c", line=946) at /storage/build/php/php-src@cpriest/Zend/zend_hash.c:54 54 if (ht->inconsistent==HT_OK) { (gdb) bt #0 0x00000000007c5aac in _zend_is_inconsistent (ht=0xb8, file=0xcbd1b8 "/storage/build/php/php-src@cpriest/Zend/zend_hash.c", line=946) at /storage/build/php/php-src@cpriest/Zend/zend_hash.c:54 #1 0x00000000007c8750 in zend_hash_quick_find (ht=0xb8, arKey=0x7ffff7fc09f0 "name", nKeyLength=5, h=210721608966, pData=0x7fffffff8368) at /storage/build/php/php-src@cpriest/Zend/zend_hash.c:946 #2 0x0000000000784ffd in zend_do_begin_accessor_declaration (function_token=0x7fffffff8440, var_name=0x7fffffff87b0, modifiers=0x7fffffff8470, return_reference=0) at /storage/build/php/php-src@cpriest/Zend/zend_compile.c:1702 #3 0x0000000000785fe4 in zend_finalize_accessor (var_name=0x7fffffff87b0) at /storage/build/php/php-src@cpriest/Zend/zend_compile.c:1913 #4 0x0000000000758638 in zendparse () at /storage/build/php/php-src@cpriest/Zend/zend_language_parser.y:759 #5 0x000000000075df1b in compile_file (file_handle=0x7fffffffdf70, type=8) at Zend/zend_language_scanner.l:584 #6 0x0000000000604227 in phar_compile_file (file_handle=0x7fffffffdf70, type=8) at /storage/build/php/php-src@cpriest/ext/phar/phar.c:3388 #7 0x00000000007b65ed in zend_execute_scripts (type=8, retval=0x0, file_count=3) at /storage/build/php/php-src@cpriest/Zend/zend.c:1302 #8 0x00000000007285da in php_execute_script (primary_file=0x7fffffffdf70) at /storage/build/php/php-src@cpriest/main/main.c:2468 #9 0x0000000000910f96 in do_cli (argc=2, argv=0x7fffffffe318) at /storage/build/php/php-src@cpriest/sapi/cli/php_cli.c:988 #10 0x0000000000911f51 in main (argc=2, argv=0x7fffffffe318) at /storage/build/php/php-src@cpriest/sapi/cli/php_cli.c:1364 | If you need anything more, just ping me back. --- Do you think it is possible to make this into 5.5? It would be really a killer-feature. 👍 — Reply to this email directly or view it on GitHub https://github.com//issues/3.

-Clint

@cpriest cpriest closed this as completed Dec 28, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants