php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login | |
Patch spl.autoload_extensions for SPL related Bug #50871Patch version 2010-03-04 12:37 UTC Return to Bug #50871 | Download this patchThis patch is obsolete Obsoleted by patches: Patch Revisions:Developer: kalle@php.netIndex: ext/spl/php_spl.c =================================================================== --- ext/spl/php_spl.c (revision 295819) +++ ext/spl/php_spl.c (working copy) @@ -51,6 +51,12 @@ #define SPL_DEFAULT_FILE_EXTENSIONS ".inc,.php" +/* {{{ PHP_INI_BEGIN */ +PHP_INI_BEGIN() + PHP_INI_ENTRY("spl.autoload_extensions", SPL_DEFAULT_FILE_EXTENSIONS, PHP_INI_ALL, NULL) +PHP_INI_END() +/* }}} */ + /* {{{ PHP_GINIT_FUNCTION */ static PHP_GINIT_FUNCTION(spl) @@ -886,10 +892,19 @@ PHP_RINIT_FUNCTION(spl) /* {{{ */ { + zval *autoload_extensions = NULL; + HashTable *configuration_hash = php_ini_get_configuration_hash(); + SPL_G(autoload_extensions) = NULL; SPL_G(autoload_extensions_len) = 0; SPL_G(autoload_functions) = NULL; SPL_G(hash_mask_init) = 0; + + if (zend_hash_find(configuration_hash, "spl.autoload_extensions", strlen("spl.autoload_extensions") + 1, (void **) &autoload_extensions) == SUCCESS) { + SPL_G(autoload_extensions) = estrndup(Z_STRVAL_P(autoload_extensions), Z_STRLEN_P(autoload_extensions)); + SPL_G(autoload_extensions_len) = Z_STRLEN_P(autoload_extensions); + } + return SUCCESS; } /* }}} */ Index: ext/spl/tests/spl_autoload_extensions_001.phpt =================================================================== --- ext/spl/tests/spl_autoload_extensions_001.phpt (revision 0) +++ ext/spl/tests/spl_autoload_extensions_001.phpt (revision 0) @@ -0,0 +1,13 @@ +--TEST-- +SPL: spl_autoload_extensions INI test +--INI-- +spl.autoload_extensions=.phtml +--FILE-- +<?php + +var_dump(spl_autoload_extensions()); + +exit(0); +?> +--EXPECTF-- +string(6) ".phtml" Index: php.ini-development =================================================================== --- php.ini-development (revision 295819) +++ php.ini-development (working copy) @@ -1033,6 +1033,12 @@ [sqlite3] ;sqlite3.extension_dir = +[spl] +; Default extensions to autoload. This is equal to calling +; the spl_autoload_extensions() function at runtime. +; +; spl.autoload_extensions = ".inc,.php" + [Pcre] ;PCRE library backtracking limit. ; http://php.net/pcre.backtrack-limit Index: php.ini-production =================================================================== --- php.ini-production (revision 295819) +++ php.ini-production (working copy) @@ -1033,6 +1033,12 @@ [sqlite3] ;sqlite3.extension_dir = +[spl] +; Default extensions to autoload. This is equal to calling +; the spl_autoload_extensions() function at runtime. +; +; spl.autoload_extensions = ".inc,.php" + [Pcre] ;PCRE library backtracking limit. ; http://php.net/pcre.backtrack-limit |
Copyright © 2001-2025 The PHP Group All rights reserved. |
Last updated: Thu Jan 02 12:01:29 2025 UTC |