Category
Stdlib · php-src-strict · constant categorization (re-#22337 / #19113 / #18303)
Problem
With no user define(), Zend’s get_defined_constants(true) has no user bucket when ext/snmp is not loaded. VM still emits a user bucket (~24 names) whose keys are almost entirely SNMP_* constants. Those names are also defined() / extension_loaded('snmp') / class_exists('SNMP') true on VM while Zend (this host, no snmp) reports all false and has no snmp category bucket either.
#22337 closed the FTP/mysqli mis-bucket case; SNMP is the same class of leak.
Probed 2026-07-24 (host PHP 8.2.32 without snmp vs php bin/vm.php).
| Repro |
Zend 8.2+ (no snmp) |
VM (2026-07-24) |
isset(get_defined_constants(true)['user']) before any define() |
false |
true (user=24) |
user keys starting with SNMP_ |
n/a |
13 |
defined('SNMP_VERSION_1') |
false |
true |
extension_loaded('snmp') |
false |
true |
class_exists('SNMP', false) |
false |
true |
isset(...['snmp']) |
false |
false (constants dumped into user instead) |
php-src reference
PHP implementation target
Repro
./script/docker-exec.sh -- bash -lc 'php test/repro/get_defined_constants_snmp_user_bucket.php'
./script/docker-exec.sh -- bash -lc 'php bin/vm.php test/repro/get_defined_constants_snmp_user_bucket.php'
Done when
Category
Stdlib· php-src-strict · constant categorization (re-#22337 / #19113 / #18303)Problem
With no user
define(), Zend’sget_defined_constants(true)has nouserbucket whenext/snmpis not loaded. VM still emits auserbucket (~24 names) whose keys are almost entirelySNMP_*constants. Those names are alsodefined()/extension_loaded('snmp')/class_exists('SNMP')true on VM while Zend (this host, no snmp) reports all false and has nosnmpcategory bucket either.#22337 closed the FTP/mysqli mis-bucket case; SNMP is the same class of leak.
Probed 2026-07-24 (host PHP 8.2.32 without snmp vs
php bin/vm.php).isset(get_defined_constants(true)['user'])before anydefine()user=24)userkeys starting withSNMP_defined('SNMP_VERSION_1')extension_loaded('snmp')class_exists('SNMP', false)isset(...['snmp'])userinstead)php-src reference
Zend/zend_builtin_functions.c—zif_get_defined_constantscategorized bucketsext/snmp/snmp.c— SNMP_* registration only when ext/snmp loadedPHP implementation target
ext/standardconstant-group / extension advertisement (same path as Regression: get_defined_constants(true) spurious user bucket — FTP/mysqli constants (re-#19113, ext/standard/basic_functions.c) #22337 fix for FTP/mysqli) — map SNMP_* into ansnmpbucket only when snmp is honestly loaded; otherwise do not define or categorize them underuserextension_loaded('snmp')/class_exists('SNMP')gates so introspection matches Zendext//lib/; no newruntime/*.clogicRepro
Done when
define(),get_defined_constants(true)has nouserbucket on the default/reference profile when snmp is not loaded (Zend match)SNMP_*are notdefined()andextension_loaded('snmp')/class_exists('SNMP')are false in that configurationsnmp(notuser).phptguard undertest/compliance/cases/