[PHP-CVS] [php-src] master: snmp: move stubs into an explicit global namespace

[email protected] (Gina Peter Banyard)
Newsgroups php.cvs
Message-ID <[email protected]>
Author: Gina Peter Banyard (Girgias)
Date: 2026-08-22T15:20:26+01:00

Commit: https://github.com/php/php-src/commit/d3fa8bb497bf6b9877ea0c35fe7bb30115c3f53b
Raw diff: https://github.com/php/php-src/commit/d3fa8bb497bf6b9877ea0c35fe7bb30115c3f53b.diff

snmp: move stubs into an explicit global namespace

In preparation for https://wiki.php.net/rfc/snmp_improvements_2026#implement_more_mib_parsing_and_value_output_controls

Changed paths:
  M  ext/snmp/snmp.stub.php
  M  ext/snmp/snmp_arginfo.h


Diff:

diff --git a/ext/snmp/snmp.stub.php b/ext/snmp/snmp.stub.php
index 0f939b5b23fd..b40a2fcd9f20 100644
--- a/ext/snmp/snmp.stub.php
+++ b/ext/snmp/snmp.stub.php
@@ -1,257 +1,259 @@
 <?php
 
 /** @generate-class-entries */
-
-/**
- * @var int
- * @cvalue NETSNMP_OID_OUTPUT_SUFFIX
- */
-const SNMP_OID_OUTPUT_SUFFIX = UNKNOWN;
-/**
- * @var int
- * @cvalue NETSNMP_OID_OUTPUT_MODULE
- */
-const SNMP_OID_OUTPUT_MODULE = UNKNOWN;
-/**
- * @var int
- * @cvalue NETSNMP_OID_OUTPUT_FULL
- */
-const SNMP_OID_OUTPUT_FULL = UNKNOWN;
-/**
- * @var int
- * @cvalue NETSNMP_OID_OUTPUT_NUMERIC
- */
-const SNMP_OID_OUTPUT_NUMERIC = UNKNOWN;
-/**
- * @var int
- * @cvalue NETSNMP_OID_OUTPUT_UCD
- */
-const SNMP_OID_OUTPUT_UCD = UNKNOWN;
-/**
- * @var int
- * @cvalue NETSNMP_OID_OUTPUT_NONE
- */
-const SNMP_OID_OUTPUT_NONE = UNKNOWN;
-
-/**
- * @var int
- * @cvalue SNMP_VALUE_LIBRARY
- */
-const SNMP_VALUE_LIBRARY = UNKNOWN;
-/**
- * @var int
- * @cvalue SNMP_VALUE_PLAIN
- */
-const SNMP_VALUE_PLAIN = UNKNOWN;
-/**
- * @var int
- * @cvalue SNMP_VALUE_OBJECT
- */
-const SNMP_VALUE_OBJECT = UNKNOWN;
-
-/**
- * @var int
- * @cvalue ASN_BIT_STR
- */
-const SNMP_BIT_STR = UNKNOWN;
-/**
- * @var int
- * @cvalue ASN_OCTET_STR
- */
-const SNMP_OCTET_STR = UNKNOWN;
-/**
- * @var int
- * @cvalue ASN_OPAQUE
- */
-const SNMP_OPAQUE = UNKNOWN;
-/**
- * @var int
- * @cvalue ASN_NULL
- */
-const SNMP_NULL = UNKNOWN;
-/**
- * @var int
- * @cvalue ASN_OBJECT_ID
- */
-const SNMP_OBJECT_ID = UNKNOWN;
-/**
- * @var int
- * @cvalue ASN_IPADDRESS
- */
-const SNMP_IPADDRESS = UNKNOWN;
-/**
- * @var int
- * @cvalue ASN_GAUGE
- */
-const SNMP_COUNTER = UNKNOWN;
-/**
- * @var int
- * @cvalue ASN_UNSIGNED
- */
-const SNMP_UNSIGNED = UNKNOWN;
-/**
- * @var int
- * @cvalue ASN_TIMETICKS
- */
-const SNMP_TIMETICKS = UNKNOWN;
-/**
- * @var int
- * @cvalue ASN_UINTEGER
- */
-const SNMP_UINTEGER = UNKNOWN;
-/**
- * @var int
- * @cvalue ASN_INTEGER
- */
-const SNMP_INTEGER = UNKNOWN;
-/**
- * @var int
- * @cvalue ASN_COUNTER64
- */
-const SNMP_COUNTER64 = UNKNOWN;
-
-function snmpget(string $hostname, string $community, array|string $object_id, int $timeout = -1, int $retries = -1): mixed {}
-
-function snmpgetnext(string $hostname, string $community, array|string $object_id, int $timeout = -1, int $retries = -1): mixed {}
-
-function snmpwalk(string $hostname, string $community, array|string $object_id, int $timeout = -1, int $retries = -1): array|false {}
-
-function snmprealwalk(string $hostname, string $community, array|string $object_id, int $timeout = -1, int $retries = -1): array|false {}
-
-/** @alias snmprealwalk */
-function snmpwalkoid(string $hostname, string $community, array|string $object_id, int $timeout = -1, int $retries = -1): array|false {}
-
-function snmpset(string $hostname, string $community, array|string $object_id, array|string $type, array|string $value, int $timeout = -1, int $retries = -1): bool {}
-
-function snmp_get_quick_print(): bool {}
-
-function snmp_set_quick_print(bool $enable): true {}
-
-function snmp_set_enum_print(bool $enable): true {}
-
-function snmp_set_oid_output_format(int $format): true {}
-
-/** @alias snmp_set_oid_output_format */
-function snmp_set_oid_numeric_print(int $format): true {}
-
-function snmp2_get(string $hostname, string $community, array|string $object_id, int $timeout = -1, int $retries = -1): mixed {}
-
-function snmp2_getnext(string $hostname, string $community, array|string $object_id, int $timeout = -1, int $retries = -1): mixed {}
-
-function snmp2_walk(string $hostname, string $community, array|string $object_id, int $timeout = -1, int $retries = -1): array|false {}
-
-function snmp2_real_walk(string $hostname, string $community, array|string $object_id, int $timeout = -1, int $retries = -1): array|false {}
-
-function snmp2_set(string $hostname, string $community, array|string $object_id, array|string $type, array|string $value, int $timeout = -1, int $retries = -1): bool {}
-
-function snmp3_get(
-    string $hostname, string $security_name, string $security_level,
-    string $auth_protocol, string $auth_passphrase,
-    string $privacy_protocol, string $privacy_passphrase,
-    array|string $object_id, int $timeout = -1, int $retries = -1): mixed {}
-
-function snmp3_getnext(
-    string $hostname, string $security_name, string $security_level,
-    string $auth_protocol, string $auth_passphrase,
-    string $privacy_protocol, string $privacy_passphrase,
-    array|string $object_id, int $timeout = -1, int $retries = -1): mixed {}
-
-function snmp3_walk(
-    string $hostname, string $security_name, string $security_level,
-    string $auth_protocol, string $auth_passphrase,
-    string $privacy_protocol, string $privacy_passphrase,
-    array|string $object_id, int $timeout = -1, int $retries = -1): array|false {}
-
-function snmp3_real_walk(
-    string $hostname, string $security_name, string $security_level,
-    string $auth_protocol, string $auth_passphrase,
-    string $privacy_protocol, string $privacy_passphrase,
-    array|string $object_id, int $timeout = -1, int $retries = -1): array|false {}
-
-function snmp3_set(
-    string $hostname, string $security_name, string $security_level,
-    string $auth_protocol, string $auth_passphrase,
-    string $privacy_protocol, string $privacy_passphrase,
-    array|string $object_id, array|string $type, array|string $value,
-    int $timeout = -1, int $retries = -1): bool {}
-
-function snmp_set_valueretrieval(int $method): true {}
-
-function snmp_get_valueretrieval(): int {}
-
-function snmp_read_mib(string $filename): bool {}
-
-function snmp_init_mib(?string $mibdirs): void {}
-
-/** @not-serializable */
-class SNMP
+namespace
 {
-    /** @cvalue SNMP_VERSION_1 */
-    public const int VERSION_1 = UNKNOWN;
-    /** @cvalue SNMP_VERSION_2c */
-    public const int VERSION_2c = UNKNOWN;
-    /** @cvalue SNMP_VERSION_2c */
-    public const int VERSION_2C = UNKNOWN;
-    /** @cvalue SNMP_VERSION_3 */
-    public const int VERSION_3 = UNKNOWN;
-
-    /** @cvalue PHP_SNMP_ERRNO_NOERROR */
-    public const int ERRNO_NOERROR = UNKNOWN;
-    /** @cvalue PHP_SNMP_ERRNO_ANY */
-    public const int ERRNO_ANY = UNKNOWN;
-    /** @cvalue PHP_SNMP_ERRNO_GENERIC */
-    public const int ERRNO_GENERIC = UNKNOWN;
-    /** @cvalue PHP_SNMP_ERRNO_TIMEOUT */
-    public const int ERRNO_TIMEOUT = UNKNOWN;
-    /** @cvalue PHP_SNMP_ERRNO_ERROR_IN_REPLY */
-    public const int ERRNO_ERROR_IN_REPLY = UNKNOWN;
-    /** @cvalue PHP_SNMP_ERRNO_OID_NOT_INCREASING */
-    public const int ERRNO_OID_NOT_INCREASING = UNKNOWN;
-    /** @cvalue PHP_SNMP_ERRNO_OID_PARSING_ERROR */
-    public const int ERRNO_OID_PARSING_ERROR = UNKNOWN;
-    /** @cvalue PHP_SNMP_ERRNO_MULTIPLE_SET_QUERIES */
-    public const int ERRNO_MULTIPLE_SET_QUERIES = UNKNOWN;
-
-    /** @readonly */
-    public array $info;
-    public ?int $max_oids;
-    public int $valueretrieval;
-    public bool $quick_print;
-    public bool $enum_print;
-    public int $oid_output_format;
-    public bool $oid_increasing_check;
-    public int $exceptions_enabled;
-
-    public function __construct(int $version, string $hostname, string $community, int $timeout = -1, int $retries = -1) {}
-
-    /** @tentative-return-type */
-    public function close(): bool {}
-
-    /** @tentative-return-type */
-    public function setSecurity(
-        string $securityLevel, string $authProtocol = "", string $authPassphrase = "",
-        string $privacyProtocol = "", string $privacyPassphrase = "",
-        string $contextName = "", string $contextEngineId = ""): bool {}
-
-    /** @tentative-return-type */
-    public function get(array|string $objectId, bool $preserveKeys = false): mixed {}
-
-    /** @tentative-return-type */
-    public function getnext(array|string $objectId): mixed {}
-
-    /** @tentative-return-type */
-    public function walk(array|string $objectId, bool $suffixAsKey = false, int $maxRepetitions = -1, int $nonRepeaters = -1): array|false {}
-
-    /** @tentative-return-type */
-    public function set(array|string $objectId, array|string $type, array|string $value): bool {}
-
-    /** @tentative-return-type */
-    public function getErrno(): int {}
-
-    /** @tentative-return-type */
-    public function getError(): string {}
-}
+    /**
+     * @var int
+     * @cvalue NETSNMP_OID_OUTPUT_SUFFIX
+     */
+    const SNMP_OID_OUTPUT_SUFFIX = UNKNOWN;
+    /**
+     * @var int
+     * @cvalue NETSNMP_OID_OUTPUT_MODULE
+     */
+    const SNMP_OID_OUTPUT_MODULE = UNKNOWN;
+    /**
+     * @var int
+     * @cvalue NETSNMP_OID_OUTPUT_FULL
+     */
+    const SNMP_OID_OUTPUT_FULL = UNKNOWN;
+    /**
+     * @var int
+     * @cvalue NETSNMP_OID_OUTPUT_NUMERIC
+     */
+    const SNMP_OID_OUTPUT_NUMERIC = UNKNOWN;
+    /**
+     * @var int
+     * @cvalue NETSNMP_OID_OUTPUT_UCD
+     */
+    const SNMP_OID_OUTPUT_UCD = UNKNOWN;
+    /**
+     * @var int
+     * @cvalue NETSNMP_OID_OUTPUT_NONE
+     */
+    const SNMP_OID_OUTPUT_NONE = UNKNOWN;
+
+    /**
+     * @var int
+     * @cvalue SNMP_VALUE_LIBRARY
+     */
+    const SNMP_VALUE_LIBRARY = UNKNOWN;
+    /**
+     * @var int
+     * @cvalue SNMP_VALUE_PLAIN
+     */
+    const SNMP_VALUE_PLAIN = UNKNOWN;
+    /**
+     * @var int
+     * @cvalue SNMP_VALUE_OBJECT
+     */
+    const SNMP_VALUE_OBJECT = UNKNOWN;
+
+    /**
+     * @var int
+     * @cvalue ASN_BIT_STR
+     */
+    const SNMP_BIT_STR = UNKNOWN;
+    /**
+     * @var int
+     * @cvalue ASN_OCTET_STR
+     */
+    const SNMP_OCTET_STR = UNKNOWN;
+    /**
+     * @var int
+     * @cvalue ASN_OPAQUE
+     */
+    const SNMP_OPAQUE = UNKNOWN;
+    /**
+     * @var int
+     * @cvalue ASN_NULL
+     */
+    const SNMP_NULL = UNKNOWN;
+    /**
+     * @var int
+     * @cvalue ASN_OBJECT_ID
+     */
+    const SNMP_OBJECT_ID = UNKNOWN;
+    /**
+     * @var int
+     * @cvalue ASN_IPADDRESS
+     */
+    const SNMP_IPADDRESS = UNKNOWN;
+    /**
+     * @var int
+     * @cvalue ASN_GAUGE
+     */
+    const SNMP_COUNTER = UNKNOWN;
+    /**
+     * @var int
+     * @cvalue ASN_UNSIGNED
+     */
+    const SNMP_UNSIGNED = UNKNOWN;
+    /**
+     * @var int
+     * @cvalue ASN_TIMETICKS
+     */
+    const SNMP_TIMETICKS = UNKNOWN;
+    /**
+     * @var int
+     * @cvalue ASN_UINTEGER
+     */
+    const SNMP_UINTEGER = UNKNOWN;
+    /**
+     * @var int
+     * @cvalue ASN_INTEGER
+     */
+    const SNMP_INTEGER = UNKNOWN;
+    /**
+     * @var int
+     * @cvalue ASN_COUNTER64
+     */
+    const SNMP_COUNTER64 = UNKNOWN;
+
+    function snmpget(string $hostname, string $community, array|string $object_id, int $timeout = -1, int $retries = -1): mixed {}
+
+    function snmpgetnext(string $hostname, string $community, array|string $object_id, int $timeout = -1, int $retries = -1): mixed {}
+
+    function snmpwalk(string $hostname, string $community, array|string $object_id, int $timeout = -1, int $retries = -1): array|false {}
+
+    function snmprealwalk(string $hostname, string $community, array|string $object_id, int $timeout = -1, int $retries = -1): array|false {}
+
+    /** @alias snmprealwalk */
+    function snmpwalkoid(string $hostname, string $community, array|string $object_id, int $timeout = -1, int $retries = -1): array|false {}
+
+    function snmpset(string $hostname, string $community, array|string $object_id, array|string $type, array|string $value, int $timeout = -1, int $retries = -1): bool {}
+
+    function snmp_get_quick_print(): bool {}
+
+    function snmp_set_quick_print(bool $enable): true {}
+
+    function snmp_set_enum_print(bool $enable): true {}
+
+    function snmp_set_oid_output_format(int $format): true {}
+
+    /** @alias snmp_set_oid_output_format */
+    function snmp_set_oid_numeric_print(int $format): true {}
+
+    function snmp2_get(string $hostname, string $community, array|string $object_id, int $timeout = -1, int $retries = -1): mixed {}
+
+    function snmp2_getnext(string $hostname, string $community, array|string $object_id, int $timeout = -1, int $retries = -1): mixed {}
+
+    function snmp2_walk(string $hostname, string $community, array|string $object_id, int $timeout = -1, int $retries = -1): array|false {}
+
+    function snmp2_real_walk(string $hostname, string $community, array|string $object_id, int $timeout = -1, int $retries = -1): array|false {}
+
+    function snmp2_set(string $hostname, string $community, array|string $object_id, array|string $type, array|string $value, int $timeout = -1, int $retries = -1): bool {}
+
+    function snmp3_get(
+        string $hostname, string $security_name, string $security_level,
+        string $auth_protocol, string $auth_passphrase,
+        string $privacy_protocol, string $privacy_passphrase,
+        array|string $object_id, int $timeout = -1, int $retries = -1): mixed {}
+
+    function snmp3_getnext(
+        string $hostname, string $security_name, string $security_level,
+        string $auth_protocol, string $auth_passphrase,
+        string $privacy_protocol, string $privacy_passphrase,
+        array|string $object_id, int $timeout = -1, int $retries = -1): mixed {}
+
+    function snmp3_walk(
+        string $hostname, string $security_name, string $security_level,
+        string $auth_protocol, string $auth_passphrase,
+        string $privacy_protocol, string $privacy_passphrase,
+        array|string $object_id, int $timeout = -1, int $retries = -1): array|false {}
+
+    function snmp3_real_walk(
+        string $hostname, string $security_name, string $security_level,
+        string $auth_protocol, string $auth_passphrase,
+        string $privacy_protocol, string $privacy_passphrase,
+        array|string $object_id, int $timeout = -1, int $retries = -1): array|false {}
+
+    function snmp3_set(
+        string $hostname, string $security_name, string $security_level,
+        string $auth_protocol, string $auth_passphrase,
+        string $privacy_protocol, string $privacy_passphrase,
+        array|string $object_id, array|string $type, array|string $value,
+        int $timeout = -1, int $retries = -1): bool {}
+
+    function snmp_set_valueretrieval(int $method): true {}
+
+    function snmp_get_valueretrieval(): int {}
+
+    function snmp_read_mib(string $filename): bool {}
+
+    function snmp_init_mib(?string $mibdirs): void {}
+
+    /** @not-serializable */
+    class SNMP
+    {
+        /** @cvalue SNMP_VERSION_1 */
+        public const int VERSION_1 = UNKNOWN;
+        /** @cvalue SNMP_VERSION_2c */
+        public const int VERSION_2c = UNKNOWN;
+        /** @cvalue SNMP_VERSION_2c */
+        public const int VERSION_2C = UNKNOWN;
+        /** @cvalue SNMP_VERSION_3 */
+        public const int VERSION_3 = UNKNOWN;
+
+        /** @cvalue PHP_SNMP_ERRNO_NOERROR */
+        public const int ERRNO_NOERROR = UNKNOWN;
+        /** @cvalue PHP_SNMP_ERRNO_ANY */
+        public const int ERRNO_ANY = UNKNOWN;
+        /** @cvalue PHP_SNMP_ERRNO_GENERIC */
+        public const int ERRNO_GENERIC = UNKNOWN;
+        /** @cvalue PHP_SNMP_ERRNO_TIMEOUT */
+        public const int ERRNO_TIMEOUT = UNKNOWN;
+        /** @cvalue PHP_SNMP_ERRNO_ERROR_IN_REPLY */
+        public const int ERRNO_ERROR_IN_REPLY = UNKNOWN;
+        /** @cvalue PHP_SNMP_ERRNO_OID_NOT_INCREASING */
+        public const int ERRNO_OID_NOT_INCREASING = UNKNOWN;
+        /** @cvalue PHP_SNMP_ERRNO_OID_PARSING_ERROR */
+        public const int ERRNO_OID_PARSING_ERROR = UNKNOWN;
+        /** @cvalue PHP_SNMP_ERRNO_MULTIPLE_SET_QUERIES */
+        public const int ERRNO_MULTIPLE_SET_QUERIES = UNKNOWN;
 
-class SNMPException extends RuntimeException
-{
+        /** @readonly */
+        public array $info;
+        public ?int $max_oids;
+        public int $valueretrieval;
+        public bool $quick_print;
+        public bool $enum_print;
+        public int $oid_output_format;
+        public bool $oid_increasing_check;
+        public int $exceptions_enabled;
+
+        public function __construct(int $version, string $hostname, string $community, int $timeout = -1, int $retries = -1) {}
+
+        /** @tentative-return-type */
+        public function close(): bool {}
+
+        /** @tentative-return-type */
+        public function setSecurity(
+            string $securityLevel, string $authProtocol = "", string $authPassphrase = "",
+            string $privacyProtocol = "", string $privacyPassphrase = "",
+            string $contextName = "", string $contextEngineId = ""): bool {}
+
+        /** @tentative-return-type */
+        public function get(array|string $objectId, bool $preserveKeys = false): mixed {}
+
+        /** @tentative-return-type */
+        public function getnext(array|string $objectId): mixed {}
+
+        /** @tentative-return-type */
+        public function walk(array|string $objectId, bool $suffixAsKey = false, int $maxRepetitions = -1, int $nonRepeaters = -1): array|false {}
+
+        /** @tentative-return-type */
+        public function set(array|string $objectId, array|string $type, array|string $value): bool {}
+
+        /** @tentative-return-type */
+        public function getErrno(): int {}
+
+        /** @tentative-return-type */
+        public function getError(): string {}
+    }
+
+    class SNMPException extends RuntimeException
+    {
+    }
 }
diff --git a/ext/snmp/snmp_arginfo.h b/ext/snmp/snmp_arginfo.h
index 85b9a1131f1c..d2faf5056b51 100644
--- a/ext/snmp/snmp_arginfo.h
+++ b/ext/snmp/snmp_arginfo.h
@@ -1,5 +1,5 @@
 /* This is a generated file, edit snmp.stub.php instead.
- * Stub hash: 18e6ffa1acd3c1b6d1c962be97f36e9a46a317a2 */
+ * Stub hash: 7d535318f2334eed04806a7e670ab7c806b286ea */
 
 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_snmpget, 0, 3, IS_MIXED, 0)
 	ZEND_ARG_TYPE_INFO(0, hostname, IS_STRING, 0)
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.