[php-src] Issue #23700: Missing NULL check on zend_get_called_scope() in PhpToken::tokenize() (ext/tokenizer/tokenizer.c)

From: Date: Wed, 16 Sep 2026 09:04:26 +0000
Subject: [php-src] Issue #23700: Missing NULL check on zend_get_called_scope() in PhpToken::tokenize() (ext/tokenizer/tokenizer.c)
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-252742@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/23700 Author: ushevchenko ### Description This is not a reproducible runtime bug in the classic sense — I have not found a PHP-level call path that currently triggers a crash or wrong output. It's a defensive-check gap found via static analysis (Svace checker DEREF_OF_NULL.RET.STAT, a statistical checker: 10 of 11 other call sites of zend_get_called_scope() in this codebase check the result for NULL before dereferencing it; this one doesn't). Code in question (ext/tokenizer/tokenizer.c, PHP_METHOD(PhpToken, tokenize)): ​```c token_class = zend_get_called_scope(execute_data); /* Check construction preconditions in advance, so these are not repeated for each token. */ if (token_class->ce_flags & ZEND_ACC_EXPLICIT_ABSTRACT_CLASS) { ​``` token_class is dereferenced immediately without a NULL check. If this path is known to be unreachable in practice, feel free to close as not-a-bug — otherwise a defensive NULL check, consistent with the other call sites, would be a small low-risk hardening fix. ### PHP Version ```plain PHP 8.3.24 (ALT php8.3 package, snapshot 8.3.24-alt1); also confirmed present in the current upstream master branch. ``` ### Operating System Not OS-specific source-level defect

« previous php.bugs (#252742) next »