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

Fix static members null pointer exception #132

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

vtsykun
Copy link

@vtsykun vtsykun commented Feb 17, 2024

Fixes: #129

STR:

  1. create classes
if (\PHP_VERSION_ID >= 80000) {
    class TokenPolyfill extends \PhpToken {
    }
    return;
}

class TokenPolyfill {
private static array $identifierTokens;
}
  1. Create object
$req = new TokenPolyfill(\T_NULLSAFE_OBJECT_OPERATOR, '?->', 10, 10);
\meminfo_dump(\fopen('/tmp/mem_dump.json', 'w'));
  1. Segmentation fault
Program received signal SIGSEGV, Segmentation fault
0x00007ffff2b43fb6 in meminfo_browse_class_static_members (stream=stream@entry=0x7ffff54c2ee0, visited_items=visited_items@entry=0x7fffed5f8cf0, first_element=first_element@entry=0x7fffed5f8ce4)
    at /opt/progs/php-meminfo/extension/meminfo.c:147
147	        if (class_entry->default_static_members_count > 0 && CE_STATIC_MEMBERS(class_entry)) {
(gdb) bt 
#0  0x00007ffff2b43fb6 in meminfo_browse_class_static_members (stream=stream@entry=0x7ffff54c2ee0, visited_items=visited_items@entry=0x7fffed5f8cf0, first_element=first_element@entry=0x7fffed5f8ce4)
    at /opt/progs/php-meminfo/extension/meminfo.c:147
#1  0x00007ffff2b445be in zif_meminfo_dump (execute_data=<optimized out>, return_value=<optimized out>) at /opt/progs/php-meminfo/extension/meminfo.c:80
#2  0x00005555558a5d48 in execute_ex ()
#3  0x000055555582dcbc in zend_call_function ()
#4  0x00005555558d72c9 in ?? ()
#5  0x00005555558d82b2 in ?? ()
#6  0x00005555557d6287 in make_fcontext ()
#7  0x0000000000000000 in ?? ()

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

Successfully merging this pull request may close these issues.

Odd behaviour resulting in SIGSEGV
1 participant