1
0
mirror of https://github.com/php/php-src.git synced 2026-04-22 15:38:49 +02:00
Files
archived-php-src/Zend/zend_builtin_functions.stub.php
T
Nikita Popov 53eee290b6 Completely remove disabled functions from function table
Currently, disabling a function only replaces the internal
function handler with one that throws a warning, and a few
places in the engine special-case such functions, such as
function_exists. This leaves us with a Schrödinger's function,
which both does not exist (function_exists returns false) and
does exist (you cannot define a function with the same name).
In particular, this prevents the implementation of robust
polyfills, as reported in https://bugs.php.net/bug.php?id=79382:

    if (!function_exists('getallheaders')) {
        function getallheaders(...) { ... }
    }

If getallheaders() is a disabled function, this code will break.

This patch changes disable_functions to remove the functions from
the function table completely. For all intents and purposes, it
will look like the function does not exist.

This also renders two bits of PHP functionality obsolete and thus
deprecated:

 * ReflectionFunction::isDisabled(), as it will no longer be
   possible to construct the ReflectionFunction of a disabled
   function in the first place.
 * get_defined_functions() with $exclude_disabled=false, as
   get_defined_functions() now never returns disabled functions.

Fixed bug #79382.

Closes GH-5473.
2020-04-30 09:53:57 +02:00

123 lines
3.3 KiB
PHP

<?php
/** @generate-function-entries */
function zend_version(): string {}
function func_num_args(): int {}
/** @return mixed */
function func_get_arg(int $arg_num) {}
function func_get_args(): array {}
function strlen(string $str): int {}
function strcmp(string $str1, string $str2): int {}
function strncmp(string $str1, string $str2, int $len): int {}
function strcasecmp(string $str1, string $str2): int {}
function strncasecmp(string $str1, string $str2, int $len): int {}
function error_reporting($new_error_level = UNKNOWN): int {}
function define(string $constant_name, $value, bool $case_insensitive = false): bool {}
function defined(string $constant_name): bool {}
function get_class(object $object = UNKNOWN): string {}
function get_called_class(): string {}
function get_parent_class($object = UNKNOWN): string|false {}
function is_subclass_of($object, string $class_name, bool $allow_string = true): bool {}
function is_a($object, string $class_name, bool $allow_string = false): bool {}
function get_class_vars(string $class_name): array|false {}
function get_object_vars(object $obj): array {}
function get_mangled_object_vars(object $obj): array {}
function get_class_methods($class): ?array {}
function method_exists($object_or_class, string $method): bool {}
function property_exists($object_or_class, string $property_name): bool {}
function class_exists(string $classname, bool $autoload = true): bool {}
function interface_exists(string $classname, bool $autoload = true): bool {}
function trait_exists(string $traitname, bool $autoload = true): bool {}
function function_exists(string $function_name): bool {}
function class_alias(string $user_class_name, string $alias_name, bool $autoload = true): bool {}
function get_included_files(): array {}
/** @alias get_included_files */
function get_required_files(): array {}
function trigger_error(string $message, int $error_type = E_USER_NOTICE): bool {}
/** @alias trigger_error */
function user_error(string $message, int $error_type = E_USER_NOTICE): bool {}
/** @return mixed */
function set_error_handler($error_handler, int $error_types = E_ALL) {}
function restore_error_handler(): bool {}
/** @return mixed */
function set_exception_handler($exception_handler) {}
function restore_exception_handler(): bool {}
function get_declared_classes(): array {}
function get_declared_traits(): array {}
function get_declared_interfaces(): array {}
function get_defined_functions(bool $exclude_disabled = true): array {}
function get_defined_vars(): array {}
function get_resource_type($res): string {}
function get_resources(string $type = UNKNOWN): array {}
function get_loaded_extensions(bool $zend_extensions = false): array {}
function get_defined_constants(bool $categorize = false): array {}
function debug_backtrace(int $options = DEBUG_BACKTRACE_PROVIDE_OBJECT, int $limit = 0): array {}
function debug_print_backtrace(int $options = 0, int $limit = 0): void {}
function extension_loaded(string $extension_name): bool {}
function get_extension_funcs(string $extension_name): array|false {}
#if ZEND_DEBUG && defined(ZTS)
function zend_thread_id(): int {}
#endif
function gc_mem_caches(): int {}
function gc_collect_cycles(): int {}
function gc_enabled(): bool {}
function gc_enable(): void {}
function gc_disable(): void {}
function gc_status(): array {}