From e11815113970a188f3b02e7fad8c2e0c8e21faa7 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Mon, 28 Jan 2019 10:34:31 +0100 Subject: [PATCH 01/51] Clear NEWS, UPGRADING and UPGRADING.INTERNALS --- NEWS | 82 +------------- UPGRADING | 261 +------------------------------------------- UPGRADING.INTERNALS | 175 +---------------------------- 3 files changed, 11 insertions(+), 507 deletions(-) diff --git a/NEWS b/NEWS index 50182c091e80b..687584aea5d25 100644 --- a/NEWS +++ b/NEWS @@ -1,86 +1,8 @@ PHP NEWS ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| -?? ??? ????, PHP 7.4.0alpha1 +?? ??? ????, PHP 8.0.0alpha1 - Core: - . Implemented request #76148 (Add array_key_exists() to the list of - specially compiled functions). (Majkl578) - -- CURL: - . Fixed bug #76480 (Use curl_multi_wait() so that timeouts are respected). - (Pierrick) - -- Date: - . Fixed bug #75232 (print_r of DateTime creating side-effect). (Nikita) - -- FFI: - . Added FFI extension. (Dmitry) - -- FPM: - . Implemented FR #72510 (systemd service should be hardened). (Craig Andrews) - -- GD: - . Fixed bug #73291 (imagecropauto() $threshold differs from external libgd). - (cmb) - . Fixed bug #76324 (cannot detect recent versions of freetype with - pkg-config). (Eli Schwartz) - . The bundled libgd behaves now like system libgd wrt. IMG_CROP_DEFAULT never - falling back to IMG_CROP_SIDES. - . The default $mode parameter of imagecropauto() has been changed to - IMG_CROP_DEFAULT; passing -1 is now deprecated. - . Added support for aspect ratio preserving scaling to a fixed height for - imagescale(). (Andreas Treichel) - -- Hash: - . The hash extension is now an integral part of PHP and cannot be disabled - as per RFC: https://wiki.php.net/rfc/permanent_hash_ext. (Kalle) - -- Intl: - . Raised requirements to ICU ≥ 50.1. (cmb) - . Changed default of $variant parameter of idn_to_ascii() and idn_to_utf8(). - (cmb) - -- Opcache: - . Implemented preloading RFC: https://wiki.php.net/rfc/preload. (Dmitry) - -- OpenSSL: - . Added openssl_x509_verify function. (Ben Scholzen) - . openssl_random_pseudo_bytes() now throws in error conditions. - (Sammy Kaye Powers) - -- PDO_OCI: - . Implemented FR #76908 (PDO_OCI getColumnMeta() not implemented). - (Valentin Collet, Chris Jones, Remi) - -- PDO_SQLite: - . Implemented sqlite_stmt_readonly in PDO_SQLite. (BohwaZ) - . Raised requirements to SQLite 3.5.0. (cmb) - -- Sockets: - . Fixed bug #67619 (Validate length on socket_write). (thiagooak) - -- SQLite3: - . Unbundled libsqlite. (cmb) - . Raised requirements to SQLite 3.7.4. (cmb) - . Forbid (un)serialization of SQLite3, SQLite3Stmt and SQLite3Result. (cmb) - . Added support for the SQLite @name notation. (cmb, BohwaZ) - . Added SQLite3Stmt::getSQL() to retrieve the SQL of the statement. (Bohwaz) - -- SPL: - . Fixed bug #77518 (SeekableIterator::seek() should accept 'int' typehint as - documented). (Nikita) - -- Standard: - . Fixed bug #74764 (Bindto IPv6 works with file_get_contents but fails with - stream_socket_client). (Ville Hukkamäki) - . Implemented FR #38301 (field enclosure behavior in fputcsv). (cmb) - . Implemented FR #51496 (fgetcsv should take empty string as an escape). (cmb) - -- Reflection: - . Fixed bug #76737 (Unserialized reflection objects are broken, they - shouldn't be serializable). (Nikita) - -- Tidy: - . Added TIDY_TAG_* constants for HTML5 elements. (cmb) + . Fixed bug #NNNNN (Summary). (Author) <<< NOTE: Insert NEWS from last stable release here prior to actual release! >>> diff --git a/UPGRADING b/UPGRADING index c735b4d521a42..7563dfdfb03c1 100644 --- a/UPGRADING +++ b/UPGRADING @@ -1,4 +1,4 @@ -PHP 7.4 UPGRADE NOTES +PHP 8.0 UPGRADE NOTES 1. Backward Incompatible Changes 2. New Features @@ -12,9 +12,8 @@ PHP 7.4 UPGRADE NOTES 10. New Global Constants 11. Changes to INI File Handling 12. Windows Support -12. Migration to pkg-config -14. Other Changes -15. Performance Improvements +13. Other Changes +14. Performance Improvements ======================================== @@ -22,109 +21,12 @@ PHP 7.4 UPGRADE NOTES ======================================== - Core: - . Referencing parent:: inside a class that does not have a parent will now - generate a compile-time error. Previously the error was only emitted at - run-time. - -- Curl: - . Attempting to serialize a CURLFile class will now generate an exception. - Previously the exception was only thrown on unserialization. - -- Date: - . Calling var_dump() or similar on a DateTime(Immutable) instance will no - longer leave behind accessible properties on the object. - -- Intl: - . The default parameter value of idn_to_ascii() and idn_to_utf8() is now - INTL_IDNA_VARIANT_UTS46 instead of the deprecated INTL_IDNA_VARIANT_2003. - -- Openssl: - . The openssl_random_pseudo_bytes() function will now throw an exception in - error situations, similar to random_bytes(). In particular, an Error is - thrown if the number of requested bytes is smaller *or equal* than zero, - and an Exception is thrown is sufficient randomness cannot be gathered. - The $crypto_strong output argument is guaranteed to always be true if the - function does not throw, so explicitly checking it is not necessary. - RFC: http://php.net/manual/de/function.openssl-random-pseudo-bytes.php - -- PDO: - . Attempting to serialize a PDO or PDOStatement instance will now generate - an Exception rather than a PDOException, consistent with other internal - classes which do not support serialization. - -- Reflection: - . Reflection objects will now generate an exception if an attempt is made - to serialize them. Serialization for reflection objects was never - supported and resulted in corrupted reflection objects. It has been - explicitly prohibited now. - -- SPL: - . Calling get_object_vars() on an ArrayObject instance will now always return - the properties of the ArrayObject itself (or a subclass). Previously it - returned the values of the wrapped array/object unless the STD_PROP_LIST - flag was specified. Other affected operations are: - - * ReflectionObject::getProperties() - * reset(), current(), etc. Use Iterator methods instead. - * Potentially others working on object properties as a list. - - (array) casts are *not* affected. They will continue to return either the - wrapped array, or the ArrayObject properties, depending on whether the - STD_PROP_LIST flag is used. - . SplPriorityQueue::setExtractFlags() will throw an exception if zero is - passed. Previously this would generate a recoverable fatal error on the - next extraction operation. - -- Standard: - . The "o" serialization format has been removed. As it is never produced by - PHP, this may only break unserialization of manually crafted strings. + . TBD ======================================== 2. New Features ======================================== -- Core: - . Added support for typed properties. For example: - - class User { - public int $id; - public string $name; - } - - This will enforce that $user->id can only be assigned integer and - $user->name can only be assigned strings. For more information see the - RFC: https://wiki.php.net/rfc/typed_properties_v2 - . Added support for coalesce assign (??=) operator. For example: - - $array['key'] ??= computeDefault(); - // is roughly equivalent to - if (!isset($array['key'])) { - $array['key'] = computeDefault(); - } - - RFC: https://wiki.php.net/rfc/null_coalesce_equal_operator - -- FFI: - . A new extension which provides a simple way to call native functions, access - native variables and create/access data structures defined in C libraries. - RFC: https://wiki.php.net/rfc/ffi - -- OPcache: - . Support for preloading code has been added. - RFC: https://wiki.php.net/rfc/preload - -- PDO_OCI: - . PDOStatement::getColumnMeta() is now available - -- PDO_SQLite: - . PDOStatement::getAttribute(PDO::SQLITE_ATTR_READONLY_STATEMENT) allows to - check whether this statement is read-only, i.e. whether it doesn't modify - the database. - -- Standard: - . strip_tags() now also accepts an array of allowed tags: Instead of - strip_tags($str, '

') you can now write strip_tags($str, ['a', 'p']). - ======================================== 3. Changes in SAPI modules ======================================== @@ -133,43 +35,14 @@ PHP 7.4 UPGRADE NOTES 4. Deprecated Functionality ======================================== -- Core: - . Unbinding $this of a non-static method through a combination of - ReflectionMethod::getClosure() and closure rebinding is deprecated. Doing - so is equivalent to calling a non-static method statically, which has been - deprecated since PHP 7.0. - ======================================== 5. Changed Functions ======================================== -- SPL: - . SplFileObject::fputcsv(), ::fgetcsv() and ::setCsvControl() now accept an - empty string as $escape argument, which disables the propriertary PHP - escaping mechanism. SplFileObject::getCsvControl() now may also return an - empty string for the third array element, accordingly. - -- Standard: - . fputcsv() and fgetcsv() now accept an empty string as $escape argument, - which disables the propriertary PHP escaping mechanism. The behavior of - str_getcsv() has been adjusted accordingly (formerly, an empty string was - identical to using the default). - ======================================== 6. New Functions ======================================== -- OpenSSL: - . Added openssl_x509_verify(mixed cert, mixed key) function that verifies the - signature of the certificate using a public key. A wrapper around the - OpenSSL's X509_verify() function. - See . - -- SQLite3: - . Added SQLite3Stmt::getSQL() to retrieve the SQL of the statement. If TRUE is - passed as parameter, query parameters will be replaced in the return value - by their currently bound value, if libsqlite ≥ 3.14 is used. - ======================================== 7. New Classes and Interfaces ======================================== @@ -182,80 +55,10 @@ PHP 7.4 UPGRADE NOTES 9. Other Changes to Extensions ======================================== -- GD: - . The behavior of imagecropauto() in the bundled libgd has been synced with - that of system libgd: - * IMG_CROP_DEFAULT is no longer falling back to IMG_CROP_SIDES - * Threshold-cropping now uses the algorithm of system libgd - . The default $mode parameter of imagecropauto() has been changed to - IMG_CROP_DEFAULT; passing -1 is now deprecated. - . imagescale() now supports aspect ratio preserving scaling to a fixed height - by passing -1 as $new_width. - -- Hash: - . The hash extension cannot be disabled anymore and is always an integral - part of any PHP build, similar to the date extension. - -- Intl: - . The Intl extension now requires at least ICU 50.1. - -- Libxml: - . All libxml based extensions now require libxml 2.7.6 or newer. - -- Reflection: - . Numeric value of class, property, function and constant modifiers was - changed. Don't filter methods and properties through - ReflectionClass::getMethods() and ReflectionClass::getProperties(), or test - results of Reflection...::getModifiers(), using hard-coded numeric values. - Use corresponding constants instead (e.g. ReflectionMethod::IS_PUBLIC). - -- SQLite3: - . The bundled libsqlite has been removed. To build the SQLite3 extension - a system libsqlite3 ≥ 3.7.4 is now required. To build the PDO_SQLite - extension a system libsqlite3 ≥ 3.5.0 is now required. - . (Un)serialization of SQLite3, SQLite3Stmt and SQLite3Result is now explicitly - forbidden. Formerly, serialization of instances of these classes was - possible, but unserialization yielded unusable objects. - . The @param notation can now also be used to denote SQL query parameters. - -- Zip: - . The bundled libzip library has been removed. A system libzip >= 0.11 is now - necessary to build the extension. - ======================================== 10. New Global Constants ======================================== -- Tidy: - . TIDY_TAG_ARTICLE - . TIDY_TAG_ASIDE - . TIDY_TAG_AUDIO - . TIDY_TAG_BDI - . TIDY_TAG_CANVAS - . TIDY_TAG_COMMAND - . TIDY_TAG_DATALIST - . TIDY_TAG_DETAILS - . TIDY_TAG_DIALOG - . TIDY_TAG_FIGCAPTION - . TIDY_TAG_FIGURE - . TIDY_TAG_FOOTER - . TIDY_TAG_HEADER - . TIDY_TAG_HGROUP - . TIDY_TAG_MAIN - . TIDY_TAG_MARK - . TIDY_TAG_MENUITEM - . TIDY_TAG_METER - . TIDY_TAG_NAV - . TIDY_TAG_OUTPUT - . TIDY_TAG_PROGRESS - . TIDY_TAG_SECTION - . TIDY_TAG_SOURCE - . TIDY_TAG_SUMMARY - . TIDY_TAG_TEMPLATE - . TIDY_TAG_TIME - . TIDY_TAG_TRACK - . TIDY_TAG_VIDEO - ======================================== 11. Changes to INI File Handling ======================================== @@ -264,63 +67,11 @@ PHP 7.4 UPGRADE NOTES 12. Windows Support ======================================== -- stat: - . The stat implementation has been refactored. - - An inode number is delivered and is based on the NTFS file index. - - The device number is now based on the volume serial number. - - Note, that both values derived from the system and provided as is on 64-bit - systems. On 32-bit system, these values might overflow the 32-bit integer in - PHP, so they're a fake. - -======================================== -13. Migration to pkg-config -======================================== - -A number of extensions have been migrated to exclusively use pkg-config for -the detection of library dependencies. Generally, this means that instead of -using --with-foo-dir=DIR or similar only --with-foo is used. Custom library -paths can be specified either by adding additional directories to -PKG_CONFIG_PATH or by explicitly specifying compilation options through -FOO_CFLAGS and FOO_LIBS. - -The following extensions are affected: - -- Curl: - . --with-curl no longer accepts a directory. - -- Intl: - . --with-icu-dir has been removed. If --enable-intl is passed, then libicu is - always required. - -- OpenSSL: - . --with-openssl no longer accepts a directory. - -- PCRE: - . --with-pcre-regex has been removed. Instead --with-external-pcre is provided - to opt into using an external PCRE library, rather than the bundled one. - -- GD: - . --with-gd becomes --enable-gd (whether to enable the extension at all) and - --with-external-gd (to opt into using an external libgd, rather than the - bundled one). - . --with-png-dir has been removed. libpng is required. - . --with-zlib-dir has been removed. zlib is required. - . --with-freetype-dir becomes --with-freetype. - . --with-jpeg-dir becomes --with-jpeg. - . --with-webp-dir becomes --with-webp. - . --with-xpm-dir becomes --with-xpm. - ======================================== -14. Other Changes +13. Other Changes ======================================== ======================================== -15. Performance Improvements +14. Performance Improvements ======================================== -- Core: - . A specialized VM opcode for the array_key_exists() function has been added, - which improves performance of this function if it can be statically - resolved. In namespaced code, this may require writing \array_key_exists() - or explicitly importing the function. diff --git a/UPGRADING.INTERNALS b/UPGRADING.INTERNALS index e4147f249cb70..48e166884517c 100644 --- a/UPGRADING.INTERNALS +++ b/UPGRADING.INTERNALS @@ -1,20 +1,7 @@ -PHP 7.4 INTERNALS UPGRADE NOTES +PHP 8.0 INTERNALS UPGRADE NOTES 1. Internal API changes - a. php_sys_symlink() and php_sys_link() - b. zend_lookup_class_ex() and zend_fetch_class_by_name() - c. Function/property/class flags - d. Removed zend_check_private() - e. php_win32_error_to_msg() memory management - f. get_properties_for() handler / Z_OBJDEBUG_P - g. Required object handlers - h. Immutable classes and op_arrays - i. php_fgetcsv() and php_fputcsv() - j. Removed add_get_assoc_*() and add_get_index_*() - k. Class declaration opcodes - l. HASH_FLAG_INITIALIZED - m. write_property return value - n. Assignments to references + a. TBD 2. Build system changes a. Abstract @@ -22,169 +9,20 @@ PHP 7.4 INTERNALS UPGRADE NOTES c. Windows build system changes 3. Module changes - a. ext/xml - b. ext/hash ======================== 1. Internal API changes ======================== - a. php_sys_symlink() and php_sys_link() portability macros have been - added, which behave like POSIX's symlink() and link(), respectively, on - POSIX compliant systems and on Windows. - - b. zend_lookup_class_ex() and zend_fetch_class_by_name() prototypes were - changed to accept optional lower-case class name as zend_string*, - instead of zval*. - - c. Function/property/class flags changes - - ZEND_ACC_CTOR and ZEND_ACC_DTOR are removed. It's possible to check if - method is a constructor/destructor using the following condition - (func->common.scope->constructor == func). - - ZEND_ACC_IMPLEMENTED_ABSTRACT is removed (it was used only internally - during inheritance). - - ZEND_ACC_IMPLICIT_PUBLIC is removed (it was used only for reflection) - - ZEND_ACC_SHADOW property flag is removed. Instead of creating shadow - clone, now we use the same private property_info, and should also - check property_info->ce (in the same way as with methods). - - ZEND_ACC_ANON_BOUND is replaced with ZEND_ACC_LINKED. This flag is set - not only during anonymous classes declaration, but also during any - run-time or compile-time class declaration. - - ZEND_ACC_NO_RT_ARENA renamed into ZEND_ACC_HEAP_RT_CACHE. Now it's used - not only for closures, but also for pseudo-main op_arrays. - - ZEND_ACC_... flags are re-numbered. - - d. zend_check_private() is removed. Use (func->common.scope == scope) instead. - - e. Pointers returned by php_win32_error_to_msg() have to be freed using - php_win32_error_msg_free(). Same regarding php_win_err() vs. - php_win_err_free(). - - f. A new, optional object handler with the signature - - HashTable *get_properties_for(zval *obj, zend_prop_purpose purpose) - - has been introduced, where zend_prop_purpose (currently) takes one of: - - ZEND_PROP_PURPOSE_DEBUG // var_dump etc. - ZEND_PROP_PURPOSE_ARRAY_CAST // (array) $obj - ZEND_PROP_PURPOSE_SERIALIZE // "O"-format serialization (__wakeup) - ZEND_PROP_PURPOSE_VAR_EXPORT // var_export (__set_state) - ZEND_PROP_PURPOSE_JSON // json_encode - - The handler returns a non-null HashTable with increased refcounted, and - the return value must be released using zend_release_properties(). - - This handler serves the same general function as get_properties(), but - provides more control over different property uses, while also making - it possible to return a temporary property table. - - get_properties() is still used in cases where none of the above purposes - apply, but overloading get_properties() is generally discouraged. If you - want to provide purposes for general usage rather than just debugging or - serialization, please prefer using properly declared properties. - - get_debug_info() is superseded by get_properties_for() with the - ZEND_PROP_PURPOSE_DEBUG purpose, but remains available for backwards- - compatibility reasons. However, while it is fine to define this handler, - it should never be directly called by consuming code. - - The Z_OBJDEBUG_P macro has been removed. It should be replaced by calls to - zend_get_properties_for() with the ZEND_PROP_PURPOSE_DEBUG purpose: - - // OLD - int is_temp; - HashTable *ht = Z_OBJDEBUG_P(obj, is_temp); - // ... - if (is_temp) { - zend_hash_destroy(ht); - FREE_HASHTABLE(ht); - } - - // NEW - HashTable *ht = zend_get_properties_for(obj, ZEND_PROP_PURPOSE_DEBUG); - // ... - zend_release_properties(ht); - - g. The following object handlers are now required (must be non-NULL): - - * free_obj - * dtor_obj - * read_property - * write_property - * read_dimension - * write_dimension - * get_property_ptr_ptr - * has_property - * unset_property - * has_dimension - * unset_dimension - * get_properties - * get_method - * get_constructor - * get_class_name - * get_gc - - It is recommended to initialize object handler structures by copying the - std object handlers and only overwriting those you want to change. - - h. Opcache may make classes and op_arrays immutable. Such classes are marked - by ZEND_ACC_IMMUTABLE flag, they are not going to be copied from opcache - shared memory to process memory and must not be modified at all. - Few related data structures were changed to allow addressing mutable data - structures from immutable ones. This access is implemented through - ZEND_MAP_PTR... abstraction macros and, basically, uses additional level of - indirection. op_array->run_time_cache, op_array->static_variables_ptr and - class_entry->static_members_table now have to be accessed through - ZEND_MAP_PTR... macros. - It's also not allowed to change op_array->reserved[] handles of immutable - op_arrays. Instead, now you have to reserve op_array handle using - zend_get_op_array_extension_handle() during MINIT and access its value - using ZEND_OP_ARRAY_EXTENSION(op_array, handle). - - i. The type of the escape parameter of php_fgetcsv() and php_fputcsv() has - been changed from char to int. This allows to pass the new constant macro - PHP_CSV_NO_ESCAPE to this parameter, to disable PHP's proprietary escape - mechanism. - - j. add_get_assoc_*() and add_get_index_*() are removed. Use add_assoc*(), - add_index*() or zend_hash_*() API functions instead. - - k. Complex class declaration opcodes ZEND_ADD_INTERFACE, ZEND_ADD_TRAIT, - ZEND_BIND_TRAITS and ZEND_VERIFY_ABSTRACT_CLASS were removed. Information - about interfaces and traits is kept in zend_class_entry structure and - actual linked performed by ZEND_DECLARE_...CLASS... opcode(s). - Linked classes have ZEND_ACC_LINKED flag set. - - l. HASH_FLAG_INITIALIZED was reverted into HASH_FLAG_UNINITIALIZED. - Special HT_IS_INITIALIZED() and HT_INVALIDATE() macro were introduced - to hide implementation details. - - m. The write_property() object handler now returns the assigned value (after - possible type coercions) rather than void. For extensions, it should - usually be sufficient to return whatever was passed as the argument. - - n. Assignments to references now need to ensure that they respect property - types that affect the reference. This means that references should no - longer be directly assigned to, and instead a set of specialized macros - of the form ZEND_TRY_ASSIGN* needs to be used. You can find detailed - porting instructions as well as a compatibility shim in the wiki: - https://wiki.php.net/rfc/typed_properties_v2#assignments_to_references + a. TBD ======================== 2. Build system changes ======================== a. Abstract - - The hash extension is now always available, meaning the --enable-hash - configure argument has been removed. b. Unix build system changes - - configure --help now also outputs --program-suffix and --program-prefix - information by using the Autoconf AC_ARG_PROGRAM macro. - - Obsolescent macros AC_FUNC_VPRINTF and AC_FUNC_UTIME_NULL have been - removed. Symbols HAVE_VPRINTF and HAVE_UTIME_NULL are no longer defined - since they are not needed on the current systems. c. Windows build system changes @@ -192,10 +30,3 @@ PHP 7.4 INTERNALS UPGRADE NOTES 3. Module changes ======================== - a. ext/xml - - The public (internal) API of the ext/xml extension has been removed. All - functions and structures are private to the extension now. - - b. ext/hash - - The hash extension is now always available, allowing extensions to rely - on its functionality to be available without compile time checks. From e916a234be3015392313e274f783e4565da2f70c Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Mon, 28 Jan 2019 10:39:32 +0100 Subject: [PATCH 02/51] Upgrade branches in GIT-RULES --- README.GIT-RULES | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/README.GIT-RULES b/README.GIT-RULES index 7c58f968b1c33..5525e30e4da90 100644 --- a/README.GIT-RULES +++ b/README.GIT-RULES @@ -44,11 +44,14 @@ Having said that, here are the organizational rules:: Currently we have the following branches in use:: - master The active development branch. + master Active development branch for PHP 8.0, which is open for + backwards incompatible changes and major internal API changes. + + PHP-7.4 Active development branch for PHP 7.4, which is open for + new features and minor internal API changes. PHP-7.3 Is used to release the PHP 7.3.x series. This is a current - non stable version and is open for bugfixes and minor improvements - only. + stable version and is open for bugfixes only. PHP-7.2 Is used to release the PHP 7.2.x series. This is a current stable version and is open for bugfixes only. @@ -56,11 +59,9 @@ Currently we have the following branches in use:: PHP-7.1 Is used to release the PHP 7.1.x series. This is an old stable version and is open for security fixes only. - PHP-7.0 Is used to release the PHP 7.0.x series. This is an old - stable version and is open for security fixes only. + PHP-7.0 This branch is closed. - PHP-5.6 Is used to release the PHP 5.6.x series. This is an old - stable version and is open for security fixes only. + PHP-5.6 This branch is closed. PHP-5.5 This branch is closed. From 3c2e1b6bd51978dcb4c7c2d5946dd37115e7b575 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Mon, 28 Jan 2019 10:43:42 +0100 Subject: [PATCH 03/51] Bump API numbers These are of course not the final API numbers, but let's make sure they differ from the 7.4 branch for now. --- Zend/zend_extensions.h | 2 +- Zend/zend_modules.h | 2 +- main/php.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Zend/zend_extensions.h b/Zend/zend_extensions.h index cd4064994f05c..cb5b76b3343b7 100644 --- a/Zend/zend_extensions.h +++ b/Zend/zend_extensions.h @@ -44,7 +44,7 @@ You can use the following macro to check the extension API version for compatibi /* The first number is the engine version and the rest is the date (YYYYMMDD). * This way engine 2/3 API no. is always greater than engine 1 API no.. */ -#define ZEND_EXTENSION_API_NO 320180731 +#define ZEND_EXTENSION_API_NO 420190128 typedef struct _zend_extension_version_info { int zend_extension_api_no; diff --git a/Zend/zend_modules.h b/Zend/zend_modules.h index f73c3058e0c45..4a5e037dd25fa 100644 --- a/Zend/zend_modules.h +++ b/Zend/zend_modules.h @@ -31,7 +31,7 @@ #define ZEND_MODULE_INFO_FUNC_ARGS zend_module_entry *zend_module #define ZEND_MODULE_INFO_FUNC_ARGS_PASSTHRU zend_module -#define ZEND_MODULE_API_NO 20180731 +#define ZEND_MODULE_API_NO 20190128 #ifdef ZTS #define USING_ZTS 1 #else diff --git a/main/php.h b/main/php.h index 1c07d6eedcd46..5a8b2b7ff9489 100644 --- a/main/php.h +++ b/main/php.h @@ -24,7 +24,7 @@ #include #endif -#define PHP_API_VERSION 20180731 +#define PHP_API_VERSION 20190128 #define PHP_HAVE_STREAMS #define YYDEBUG 0 #define PHP_DEFAULT_CHARSET "UTF-8" From 8eeb1102d0f7caf2441ad92da3cfa6060e2e04fc Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Mon, 28 Jan 2019 11:26:45 +0100 Subject: [PATCH 04/51] Avoid mention of php7 in credits script --- ext/standard/credits_ext.h | 15 ++++++++------- ext/standard/credits_sapi.h | 6 +++--- scripts/dev/credits | 6 +++--- 3 files changed, 14 insertions(+), 13 deletions(-) diff --git a/ext/standard/credits_ext.h b/ext/standard/credits_ext.h index 07c4ba261038d..4af3f22f2c1a1 100644 --- a/ext/standard/credits_ext.h +++ b/ext/standard/credits_ext.h @@ -1,9 +1,9 @@ /* DO NOT EDIT THIS FILE! - it has been automatically created by php7/scripts/credits from - the information found in the various php7/ext/.../CREDITS and - php7/sapi/.../CREDITS files + it has been automatically created by scripts/dev/credits from + the information found in the various ext/.../CREDITS and + sapi/.../CREDITS files if you want to change an entry you have to edit the appropriate CREDITS file instead @@ -17,18 +17,19 @@ CREDIT_LINE("COM and .Net", "Wez Furlong"); CREDIT_LINE("ctype", "Hartmut Holzgraefe"); CREDIT_LINE("cURL", "Sterling Hughes"); CREDIT_LINE("Date/Time Support", "Derick Rethans"); -CREDIT_LINE("DB-LIB (MS SQL, Sybase)", "Wez Furlong, Frank M. Kromann, Adam Baratz"); CREDIT_LINE("DBA", "Sascha Schumann, Marcus Boerger"); +CREDIT_LINE("DB-LIB (MS SQL, Sybase)", "Wez Furlong, Frank M. Kromann, Adam Baratz"); CREDIT_LINE("DOM", "Christian Stocker, Rob Richards, Marcus Boerger"); CREDIT_LINE("enchant", "Pierre-Alain Joye, Ilia Alshanetsky"); CREDIT_LINE("EXIF", "Rasmus Lerdorf, Marcus Boerger"); +CREDIT_LINE("FFI", "Dmitry Stogov"); CREDIT_LINE("fileinfo", "Ilia Alshanetsky, Pierre Alain Joye, Scott MacVicar, Derick Rethans, Anatol Belski"); CREDIT_LINE("Firebird driver for PDO", "Ard Biesheuvel"); CREDIT_LINE("FTP", "Stefan Esser, Andrew Skalski"); CREDIT_LINE("GD imaging", "Rasmus Lerdorf, Stig Bakken, Jim Winstead, Jouni Ahto, Ilia Alshanetsky, Pierre-Alain Joye, Marcus Boerger"); CREDIT_LINE("GetText", "Alex Plotnick"); CREDIT_LINE("GNU GMP support", "Stanislav Malyshev"); -CREDIT_LINE("Iconv", "Rui Hirokawa, Stig Bakken, Moriyoshi Koizumi "); +CREDIT_LINE("Iconv", "Rui Hirokawa, Stig Bakken, Moriyoshi Koizumi"); CREDIT_LINE("IMAP", "Rex Logan, Mark Musone, Brian Wang, Kaj-Michael Lang, Antoni Pamies Olive, Rasmus Lerdorf, Andrew Skalski, Chuck Hagenbuch, Daniel R Kalowsky"); CREDIT_LINE("Input Filter", "Rasmus Lerdorf, Derick Rethans, Pierre-Alain Joye, Ilia Alshanetsky"); CREDIT_LINE("InterBase", "Jouni Ahto, Andrew Avdeev, Ard Biesheuvel"); @@ -66,17 +67,17 @@ CREDIT_LINE("SOAP", "Brad Lafountain, Shane Caraveo, Dmitry Stogov"); CREDIT_LINE("Sockets", "Chris Vandomelen, Sterling Hughes, Daniel Beulshausen, Jason Greene"); CREDIT_LINE("Sodium", "Frank Denis"); CREDIT_LINE("SPL", "Marcus Boerger, Etienne Kneuss"); -CREDIT_LINE("SQLite 3.x driver for PDO", "Wez Furlong"); CREDIT_LINE("SQLite3", "Scott MacVicar, Ilia Alshanetsky, Brad Dewar"); +CREDIT_LINE("SQLite 3.x driver for PDO", "Wez Furlong"); CREDIT_LINE("System V Message based IPC", "Wez Furlong"); CREDIT_LINE("System V Semaphores", "Tom May"); CREDIT_LINE("System V Shared Memory", "Christian Cartus"); CREDIT_LINE("tidy", "John Coggeshall, Ilia Alshanetsky"); CREDIT_LINE("tokenizer", "Andrei Zmievski, Johannes Schlueter"); CREDIT_LINE("WDDX", "Andrei Zmievski"); -CREDIT_LINE("XML", "Stig Bakken, Thies C. Arntzen, Sterling Hughes"); CREDIT_LINE("XMLReader", "Rob Richards"); CREDIT_LINE("xmlrpc", "Dan Libby"); +CREDIT_LINE("XML", "Stig Bakken, Thies C. Arntzen, Sterling Hughes"); CREDIT_LINE("XMLWriter", "Rob Richards, Pierre-Alain Joye"); CREDIT_LINE("XSL", "Christian Stocker, Rob Richards"); CREDIT_LINE("Zip", "Pierre-Alain Joye, Remi Collet"); diff --git a/ext/standard/credits_sapi.h b/ext/standard/credits_sapi.h index d5f5b81b2103b..d6553ea04c1e9 100644 --- a/ext/standard/credits_sapi.h +++ b/ext/standard/credits_sapi.h @@ -1,9 +1,9 @@ /* DO NOT EDIT THIS FILE! - it has been automatically created by php7/scripts/credits from - the information found in the various php7/ext/.../CREDITS and - php7/sapi/.../CREDITS files + it has been automatically created by scripts/dev/credits from + the information found in the various ext/.../CREDITS and + sapi/.../CREDITS files if you want to change an entry you have to edit the appropriate CREDITS file instead diff --git a/scripts/dev/credits b/scripts/dev/credits index df94e08aeaacb..bdeb2bce07e9b 100755 --- a/scripts/dev/credits +++ b/scripts/dev/credits @@ -10,9 +10,9 @@ do /* DO NOT EDIT THIS FILE! - it has been automatically created by php7/scripts/credits from - the information found in the various php7/ext/.../CREDITS and - php7/sapi/.../CREDITS files + it has been automatically created by scripts/dev/credits from + the information found in the various ext/.../CREDITS and + sapi/.../CREDITS files if you want to change an entry you have to edit the appropriate CREDITS file instead From dfa6c2046a8d7b66c4be52e46888f0fefccbcfd4 Mon Sep 17 00:00:00 2001 From: "Christoph M. Becker" Date: Mon, 28 Jan 2019 14:29:06 +0100 Subject: [PATCH 05/51] Remove deprecated image2wbmp() Cf. . --- NEWS | 3 +++ UPGRADING | 4 ++++ ext/gd/gd.c | 16 ---------------- ext/gd/gd_ctx.c | 3 +-- ext/gd/php_gd.h | 1 - ext/gd/tests/image2wbmp_error.phpt | 20 -------------------- 6 files changed, 8 insertions(+), 39 deletions(-) delete mode 100644 ext/gd/tests/image2wbmp_error.phpt diff --git a/NEWS b/NEWS index 687584aea5d25..cfa0abc5789d7 100644 --- a/NEWS +++ b/NEWS @@ -5,4 +5,7 @@ PHP NEWS - Core: . Fixed bug #NNNNN (Summary). (Author) +- GD: + . Removed deprecated image2wbmp(). (cmb) + <<< NOTE: Insert NEWS from last stable release here prior to actual release! >>> diff --git a/UPGRADING b/UPGRADING index 7563dfdfb03c1..87cd96a6d78f3 100644 --- a/UPGRADING +++ b/UPGRADING @@ -23,6 +23,10 @@ PHP 8.0 UPGRADE NOTES - Core: . TBD +- GD: + . The deprecated function image2wbmp() has been removed. + RFC: https://wiki.php.net/rfc/image2wbmp + ======================================== 2. New Features ======================================== diff --git a/ext/gd/gd.c b/ext/gd/gd.c index d4e4db1be6bdd..4455d8b8d4771 100644 --- a/ext/gd/gd.c +++ b/ext/gd/gd.c @@ -758,12 +758,6 @@ ZEND_BEGIN_ARG_INFO(arginfo_imagettftext, 0) ZEND_END_ARG_INFO() #endif -ZEND_BEGIN_ARG_INFO_EX(arginfo_image2wbmp, 0, 0, 1) - ZEND_ARG_INFO(0, im) - ZEND_ARG_INFO(0, filename) - ZEND_ARG_INFO(0, foreground) -ZEND_END_ARG_INFO() - #if defined(HAVE_GD_JPG) ZEND_BEGIN_ARG_INFO(arginfo_jpeg2wbmp, 0) ZEND_ARG_INFO(0, f_org) @@ -997,7 +991,6 @@ static const zend_function_entry gd_functions[] = { #if defined(HAVE_GD_PNG) PHP_DEP_FE(png2wbmp, arginfo_png2wbmp) #endif - PHP_DEP_FE(image2wbmp, arginfo_image2wbmp) PHP_FE(imagelayereffect, arginfo_imagelayereffect) PHP_FE(imagexbm, arginfo_imagexbm) @@ -2594,7 +2587,6 @@ static void _php_image_output(INTERNAL_FUNCTION_PARAMETERS, int image_type, char int argc = ZEND_NUM_ARGS(); int q = -1, i, t = 1; - /* The quality parameter for Wbmp stands for the foreground when called from image2wbmp() */ /* When called from imagewbmp() the quality parameter stands for the foreground color. Default: black. */ /* The quality parameter for gd2 stands for chunk size */ @@ -4067,14 +4059,6 @@ static void php_imagettftext_common(INTERNAL_FUNCTION_PARAMETERS, int mode, int /* }}} */ #endif /* ENABLE_GD_TTF */ -/* {{{ proto bool image2wbmp(resource im [, string filename [, int foreground]]) - Output WBMP image to browser or file */ -PHP_FUNCTION(image2wbmp) -{ - _php_image_output(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_GDIMG_CONVERT_WBM, "WBMP", NULL); -} -/* }}} */ - #if defined(HAVE_GD_JPG) /* {{{ proto bool jpeg2wbmp(string f_org, string f_dest, int d_height, int d_width, int threshold) Convert JPEG image to WBMP image */ diff --git a/ext/gd/gd_ctx.c b/ext/gd/gd_ctx.c index d1c3771f2354e..eae3aef255e49 100644 --- a/ext/gd/gd_ctx.c +++ b/ext/gd/gd_ctx.c @@ -93,8 +93,7 @@ static void _php_image_output_ctx(INTERNAL_FUNCTION_PARAMETERS, int image_type, php_stream *stream; int close_stream = 1; - /* The third (quality) parameter for Wbmp stands for the foreground when called from image2wbmp(). - * The third (quality) parameter for Wbmp and Xbm stands for the foreground color index when called + /* The third (quality) parameter for Wbmp and Xbm stands for the foreground color index when called * from imagey(). */ switch (image_type) { diff --git a/ext/gd/php_gd.h b/ext/gd/php_gd.h index 171c71191db9a..5c8aeb6e764bd 100644 --- a/ext/gd/php_gd.h +++ b/ext/gd/php_gd.h @@ -206,7 +206,6 @@ PHP_FUNCTION(imagettftext); PHP_FUNCTION(jpeg2wbmp); PHP_FUNCTION(png2wbmp); -PHP_FUNCTION(image2wbmp); PHP_FUNCTION(imagecolormatch); diff --git a/ext/gd/tests/image2wbmp_error.phpt b/ext/gd/tests/image2wbmp_error.phpt deleted file mode 100644 index 8d8d836ef74c0..0000000000000 --- a/ext/gd/tests/image2wbmp_error.phpt +++ /dev/null @@ -1,20 +0,0 @@ ---TEST-- -image2wbmp() is deprecated ---SKIPIF-- - ---FILE-- - -===DONE=== ---CLEAN-- - ---EXPECTF-- -Deprecated: Function image2wbmp() is deprecated in %s on line %d -===DONE=== From e9736638828f3037b1b04fc02718d8d04351f9e0 Mon Sep 17 00:00:00 2001 From: "Christoph M. Becker" Date: Mon, 28 Jan 2019 14:50:52 +0100 Subject: [PATCH 06/51] Remove deprecated png2wbmp() and jpeg2wbmp() Cf. --- NEWS | 1 + UPGRADING | 2 + ext/gd/gd.c | 237 -------------------------- ext/gd/php_gd.h | 3 - ext/gd/tests/jpeg2wbmp_error1.phpt | 46 ----- ext/gd/tests/jpeg2wbmp_error2-mb.phpt | 37 ---- ext/gd/tests/jpeg2wbmp_error2.phpt | 37 ---- ext/gd/tests/jpeg2wbmp_error3.phpt | 49 ------ ext/gd/tests/png2wbmp_error1-mb.phpt | 46 ----- ext/gd/tests/png2wbmp_error1.phpt | 46 ----- ext/gd/tests/png2wbmp_error2.phpt | 37 ---- ext/gd/tests/png2wbmp_error3.phpt | 49 ------ 12 files changed, 3 insertions(+), 587 deletions(-) delete mode 100644 ext/gd/tests/jpeg2wbmp_error1.phpt delete mode 100644 ext/gd/tests/jpeg2wbmp_error2-mb.phpt delete mode 100644 ext/gd/tests/jpeg2wbmp_error2.phpt delete mode 100644 ext/gd/tests/jpeg2wbmp_error3.phpt delete mode 100644 ext/gd/tests/png2wbmp_error1-mb.phpt delete mode 100644 ext/gd/tests/png2wbmp_error1.phpt delete mode 100644 ext/gd/tests/png2wbmp_error2.phpt delete mode 100644 ext/gd/tests/png2wbmp_error3.phpt diff --git a/NEWS b/NEWS index cfa0abc5789d7..f95cafb35f7e5 100644 --- a/NEWS +++ b/NEWS @@ -7,5 +7,6 @@ PHP NEWS - GD: . Removed deprecated image2wbmp(). (cmb) + . Removed deprecated png2wbmp() and jpeg2wbmp(). (cmb) <<< NOTE: Insert NEWS from last stable release here prior to actual release! >>> diff --git a/UPGRADING b/UPGRADING index 87cd96a6d78f3..7cf0ae73adb6c 100644 --- a/UPGRADING +++ b/UPGRADING @@ -26,6 +26,8 @@ PHP 8.0 UPGRADE NOTES - GD: . The deprecated function image2wbmp() has been removed. RFC: https://wiki.php.net/rfc/image2wbmp + . The deprecated functions png2wbmp() and jpeg2wbmp() have been removed. + RFC: https://wiki.php.net/rfc/deprecate-png-jpeg-2wbmp ======================================== 2. New Features diff --git a/ext/gd/gd.c b/ext/gd/gd.c index 4455d8b8d4771..1b1100801a915 100644 --- a/ext/gd/gd.c +++ b/ext/gd/gd.c @@ -132,7 +132,6 @@ static gdImagePtr _php_image_create_from_string (zval *Data, char *tn, gdImagePt static void _php_image_create_from(INTERNAL_FUNCTION_PARAMETERS, int image_type, char *tn, gdImagePtr (*func_p)(), gdImagePtr (*ioctx_func_p)()); static void _php_image_output(INTERNAL_FUNCTION_PARAMETERS, int image_type, char *tn, void (*func_p)()); static int _php_image_type(char data[12]); -static void _php_image_convert(INTERNAL_FUNCTION_PARAMETERS, int image_type); /* {{{ arginfo */ ZEND_BEGIN_ARG_INFO(arginfo_gd_info, 0) @@ -758,26 +757,6 @@ ZEND_BEGIN_ARG_INFO(arginfo_imagettftext, 0) ZEND_END_ARG_INFO() #endif -#if defined(HAVE_GD_JPG) -ZEND_BEGIN_ARG_INFO(arginfo_jpeg2wbmp, 0) - ZEND_ARG_INFO(0, f_org) - ZEND_ARG_INFO(0, f_dest) - ZEND_ARG_INFO(0, d_height) - ZEND_ARG_INFO(0, d_width) - ZEND_ARG_INFO(0, d_threshold) -ZEND_END_ARG_INFO() -#endif - -#if defined(HAVE_GD_PNG) -ZEND_BEGIN_ARG_INFO(arginfo_png2wbmp, 0) - ZEND_ARG_INFO(0, f_org) - ZEND_ARG_INFO(0, f_dest) - ZEND_ARG_INFO(0, d_height) - ZEND_ARG_INFO(0, d_width) - ZEND_ARG_INFO(0, d_threshold) -ZEND_END_ARG_INFO() -#endif - ZEND_BEGIN_ARG_INFO_EX(arginfo_imagefilter, 0, 0, 2) ZEND_ARG_INFO(0, im) ZEND_ARG_INFO(0, filtertype) @@ -985,12 +964,6 @@ static const zend_function_entry gd_functions[] = { PHP_FE(imagetypes, arginfo_imagetypes) -#if defined(HAVE_GD_JPG) - PHP_DEP_FE(jpeg2wbmp, arginfo_jpeg2wbmp) -#endif -#if defined(HAVE_GD_PNG) - PHP_DEP_FE(png2wbmp, arginfo_png2wbmp) -#endif PHP_FE(imagelayereffect, arginfo_imagelayereffect) PHP_FE(imagexbm, arginfo_imagexbm) @@ -4059,216 +4032,6 @@ static void php_imagettftext_common(INTERNAL_FUNCTION_PARAMETERS, int mode, int /* }}} */ #endif /* ENABLE_GD_TTF */ -#if defined(HAVE_GD_JPG) -/* {{{ proto bool jpeg2wbmp(string f_org, string f_dest, int d_height, int d_width, int threshold) - Convert JPEG image to WBMP image */ -PHP_FUNCTION(jpeg2wbmp) -{ - _php_image_convert(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_GDIMG_TYPE_JPG); -} -/* }}} */ -#endif - -#if defined(HAVE_GD_PNG) -/* {{{ proto bool png2wbmp(string f_org, string f_dest, int d_height, int d_width, int threshold) - Convert PNG image to WBMP image */ -PHP_FUNCTION(png2wbmp) -{ - _php_image_convert(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_GDIMG_TYPE_PNG); -} -/* }}} */ -#endif - -/* {{{ _php_image_convert - * _php_image_convert converts jpeg/png images to wbmp and resizes them as needed */ -static void _php_image_convert(INTERNAL_FUNCTION_PARAMETERS, int image_type ) -{ - char *f_org, *f_dest; - size_t f_org_len, f_dest_len; - zend_long height, width, threshold; - gdImagePtr im_org, im_dest, im_tmp; - char *fn_org = NULL; - char *fn_dest = NULL; - FILE *org, *dest; - int dest_height = -1; - int dest_width = -1; - int org_height, org_width; - int white, black; - int color, color_org, median; - int int_threshold; - int x, y; - float x_ratio, y_ratio; -#ifdef HAVE_GD_JPG - zend_long ignore_warning; -#endif - - if (zend_parse_parameters(ZEND_NUM_ARGS(), "pplll", &f_org, &f_org_len, &f_dest, &f_dest_len, &height, &width, &threshold) == FAILURE) { - return; - } - - fn_org = f_org; - fn_dest = f_dest; - dest_height = height; - dest_width = width; - int_threshold = threshold; - - /* Check threshold value */ - if (int_threshold < 0 || int_threshold > 8) { - php_error_docref(NULL, E_WARNING, "Invalid threshold value '%d'", int_threshold); - RETURN_FALSE; - } - - /* Check origin file */ - PHP_GD_CHECK_OPEN_BASEDIR(fn_org, "Invalid origin filename"); - - /* Check destination file */ - PHP_GD_CHECK_OPEN_BASEDIR(fn_dest, "Invalid destination filename"); - - /* Open origin file */ - org = VCWD_FOPEN(fn_org, "rb"); - if (!org) { - php_error_docref(NULL, E_WARNING, "Unable to open '%s' for reading", fn_org); - RETURN_FALSE; - } - - /* Open destination file */ - dest = VCWD_FOPEN(fn_dest, "wb"); - if (!dest) { - php_error_docref(NULL, E_WARNING, "Unable to open '%s' for writing", fn_dest); - fclose(org); - RETURN_FALSE; - } - - switch (image_type) { - -#ifdef HAVE_GD_JPG - case PHP_GDIMG_TYPE_JPG: - ignore_warning = INI_INT("gd.jpeg_ignore_warning"); - im_org = gdImageCreateFromJpegEx(org, ignore_warning); - if (im_org == NULL) { - php_error_docref(NULL, E_WARNING, "Unable to open '%s' Not a valid JPEG file", fn_dest); - fclose(org); - fclose(dest); - RETURN_FALSE; - } - break; -#endif /* HAVE_GD_JPG */ - -#ifdef HAVE_GD_PNG - case PHP_GDIMG_TYPE_PNG: - im_org = gdImageCreateFromPng(org); - if (im_org == NULL) { - php_error_docref(NULL, E_WARNING, "Unable to open '%s' Not a valid PNG file", fn_dest); - fclose(org); - fclose(dest); - RETURN_FALSE; - } - break; -#endif /* HAVE_GD_PNG */ - - default: - php_error_docref(NULL, E_WARNING, "Format not supported"); - fclose(org); - fclose(dest); - RETURN_FALSE; - break; - } - - fclose(org); - - org_width = gdImageSX (im_org); - org_height = gdImageSY (im_org); - - x_ratio = (float) org_width / (float) dest_width; - y_ratio = (float) org_height / (float) dest_height; - - if (x_ratio > 1 && y_ratio > 1) { - if (y_ratio > x_ratio) { - x_ratio = y_ratio; - } else { - y_ratio = x_ratio; - } - dest_width = (int) (org_width / x_ratio); - dest_height = (int) (org_height / y_ratio); - } else { - x_ratio = (float) dest_width / (float) org_width; - y_ratio = (float) dest_height / (float) org_height; - - if (y_ratio < x_ratio) { - x_ratio = y_ratio; - } else { - y_ratio = x_ratio; - } - dest_width = (int) (org_width * x_ratio); - dest_height = (int) (org_height * y_ratio); - } - - im_tmp = gdImageCreate (dest_width, dest_height); - if (im_tmp == NULL ) { - php_error_docref(NULL, E_WARNING, "Unable to allocate temporary buffer"); - fclose(dest); - gdImageDestroy(im_org); - RETURN_FALSE; - } - - gdImageCopyResized (im_tmp, im_org, 0, 0, 0, 0, dest_width, dest_height, org_width, org_height); - - gdImageDestroy(im_org); - - im_dest = gdImageCreate(dest_width, dest_height); - if (im_dest == NULL) { - php_error_docref(NULL, E_WARNING, "Unable to allocate destination buffer"); - fclose(dest); - gdImageDestroy(im_tmp); - RETURN_FALSE; - } - - white = gdImageColorAllocate(im_dest, 255, 255, 255); - if (white == -1) { - php_error_docref(NULL, E_WARNING, "Unable to allocate the colors for the destination buffer"); - fclose(dest); - gdImageDestroy(im_tmp); - gdImageDestroy(im_dest); - RETURN_FALSE; - } - - black = gdImageColorAllocate(im_dest, 0, 0, 0); - if (black == -1) { - php_error_docref(NULL, E_WARNING, "Unable to allocate the colors for the destination buffer"); - fclose(dest); - gdImageDestroy(im_tmp); - gdImageDestroy(im_dest); - RETURN_FALSE; - } - - int_threshold = int_threshold * 32; - - for (y = 0; y < dest_height; y++) { - for (x = 0; x < dest_width; x++) { - color_org = gdImageGetPixel (im_tmp, x, y); - median = (im_tmp->red[color_org] + im_tmp->green[color_org] + im_tmp->blue[color_org]) / 3; - if (median < int_threshold) { - color = black; - } else { - color = white; - } - gdImageSetPixel (im_dest, x, y, color); - } - } - - gdImageDestroy (im_tmp ); - - gdImageWBMP(im_dest, black , dest); - - fflush(dest); - fclose(dest); - - gdImageDestroy(im_dest); - - RETURN_TRUE; -} -/* }}} */ - /* Section Filters */ #define PHP_GD_SINGLE_RES \ zval *SIM; \ diff --git a/ext/gd/php_gd.h b/ext/gd/php_gd.h index 5c8aeb6e764bd..3dcffbbb4f509 100644 --- a/ext/gd/php_gd.h +++ b/ext/gd/php_gd.h @@ -204,9 +204,6 @@ PHP_FUNCTION(imagedashedline); PHP_FUNCTION(imagettfbbox); PHP_FUNCTION(imagettftext); -PHP_FUNCTION(jpeg2wbmp); -PHP_FUNCTION(png2wbmp); - PHP_FUNCTION(imagecolormatch); PHP_FUNCTION(imagelayereffect); diff --git a/ext/gd/tests/jpeg2wbmp_error1.phpt b/ext/gd/tests/jpeg2wbmp_error1.phpt deleted file mode 100644 index fcdef0bcb1fad..0000000000000 --- a/ext/gd/tests/jpeg2wbmp_error1.phpt +++ /dev/null @@ -1,46 +0,0 @@ ---TEST-- -Test jpeg2wbmp() function : wrong threshold value param ---CREDITS-- -Levi Fukumori -#testfest PHPSP on 2009-06-20 ---SKIPIF-- - ---FILE-- - ---EXPECTF-- -Deprecated: Function jpeg2wbmp() is deprecated in %s on line %d - -Warning: jpeg2wbmp(): Invalid threshold value '9' in %s on line %d - -Deprecated: Function jpeg2wbmp() is deprecated in %s on line %d - -Warning: jpeg2wbmp(): Invalid threshold value '-1' in %s on line %d ---CLEAN-- - diff --git a/ext/gd/tests/jpeg2wbmp_error2-mb.phpt b/ext/gd/tests/jpeg2wbmp_error2-mb.phpt deleted file mode 100644 index 4eeac126a4b44..0000000000000 --- a/ext/gd/tests/jpeg2wbmp_error2-mb.phpt +++ /dev/null @@ -1,37 +0,0 @@ ---TEST-- -Test jpeg2wbmp() function : wrong origin filename param ---CREDITS-- -Levi Fukumori -#testfest PHPSP on 2009-06-20 ---SKIPIF-- - ---FILE-- - ---EXPECTF-- -Deprecated: Function jpeg2wbmp() is deprecated in %s on line %d - -Warning: jpeg2wbmp(): Unable to open '' for reading in %s on line %d - -Deprecated: Function jpeg2wbmp() is deprecated in %s on line %d - -Warning: jpeg2wbmp(): Unable to open '' for reading in %s on line %d - -Deprecated: Function jpeg2wbmp() is deprecated in %s on line %d - -Warning: jpeg2wbmp(): Unable to open '' for reading in %s on line %d ---CLEAN-- - diff --git a/ext/gd/tests/jpeg2wbmp_error2.phpt b/ext/gd/tests/jpeg2wbmp_error2.phpt deleted file mode 100644 index 405eb8312919c..0000000000000 --- a/ext/gd/tests/jpeg2wbmp_error2.phpt +++ /dev/null @@ -1,37 +0,0 @@ ---TEST-- -Test jpeg2wbmp() function : wrong origin filename param ---CREDITS-- -Levi Fukumori -#testfest PHPSP on 2009-06-20 ---SKIPIF-- - ---FILE-- - ---EXPECTF-- -Deprecated: Function jpeg2wbmp() is deprecated in %s on line %d - -Warning: jpeg2wbmp(): Unable to open '' for reading in %s on line %d - -Deprecated: Function jpeg2wbmp() is deprecated in %s on line %d - -Warning: jpeg2wbmp(): Unable to open '' for reading in %s on line %d - -Deprecated: Function jpeg2wbmp() is deprecated in %s on line %d - -Warning: jpeg2wbmp(): Unable to open '' for reading in %s on line %d ---CLEAN-- - diff --git a/ext/gd/tests/jpeg2wbmp_error3.phpt b/ext/gd/tests/jpeg2wbmp_error3.phpt deleted file mode 100644 index 2662b7a86b3e9..0000000000000 --- a/ext/gd/tests/jpeg2wbmp_error3.phpt +++ /dev/null @@ -1,49 +0,0 @@ ---TEST-- -Test jpeg2wbmp() function : wrong destination filename param ---CREDITS-- -Levi Fukumori -#testfest PHPSP on 2009-06-20 ---SKIPIF-- - ---FILE-- - ---EXPECTF-- -Deprecated: Function jpeg2wbmp() is deprecated in %s on line %d - -Warning: jpeg2wbmp(): Unable to open '' for writing in %s on line %d - -Deprecated: Function jpeg2wbmp() is deprecated in %s on line %d - -Warning: jpeg2wbmp(): Unable to open '' for writing in %s on line %d - -Deprecated: Function jpeg2wbmp() is deprecated in %s on line %d - -Warning: jpeg2wbmp(): Unable to open '' for writing in %s on line %d ---CLEAN-- - diff --git a/ext/gd/tests/png2wbmp_error1-mb.phpt b/ext/gd/tests/png2wbmp_error1-mb.phpt deleted file mode 100644 index 8c779d36d9941..0000000000000 --- a/ext/gd/tests/png2wbmp_error1-mb.phpt +++ /dev/null @@ -1,46 +0,0 @@ ---TEST-- -Test png2wbmp() function : wrong threshold value param ---CREDITS-- -Levi Fukumori -#testfest PHPSP on 2009-06-20 ---SKIPIF-- - ---FILE-- - ---EXPECTF-- -Deprecated: Function png2wbmp() is deprecated in %s on line %d - -Warning: png2wbmp(): Invalid threshold value '9' in %s on line %d - -Deprecated: Function png2wbmp() is deprecated in %s on line %d - -Warning: png2wbmp(): Invalid threshold value '-1' in %s on line %d ---CLEAN-- - diff --git a/ext/gd/tests/png2wbmp_error1.phpt b/ext/gd/tests/png2wbmp_error1.phpt deleted file mode 100644 index 543013b4bc113..0000000000000 --- a/ext/gd/tests/png2wbmp_error1.phpt +++ /dev/null @@ -1,46 +0,0 @@ ---TEST-- -Test png2wbmp() function : wrong threshold value param ---CREDITS-- -Levi Fukumori -#testfest PHPSP on 2009-06-20 ---SKIPIF-- - ---FILE-- - ---EXPECTF-- -Deprecated: Function png2wbmp() is deprecated in %s on line %d - -Warning: png2wbmp(): Invalid threshold value '9' in %s on line %d - -Deprecated: Function png2wbmp() is deprecated in %s on line %d - -Warning: png2wbmp(): Invalid threshold value '-1' in %s on line %d ---CLEAN-- - diff --git a/ext/gd/tests/png2wbmp_error2.phpt b/ext/gd/tests/png2wbmp_error2.phpt deleted file mode 100644 index a674e0d6ccd83..0000000000000 --- a/ext/gd/tests/png2wbmp_error2.phpt +++ /dev/null @@ -1,37 +0,0 @@ ---TEST-- -Test png2wbmp() function : wrong origin filename param ---CREDITS-- -Levi Fukumori -#testfest PHPSP on 2009-06-20 ---SKIPIF-- - ---FILE-- - ---EXPECTF-- -Deprecated: Function png2wbmp() is deprecated in %s on line %d - -Warning: png2wbmp(): Unable to open '' for reading in %s on line %d - -Deprecated: Function png2wbmp() is deprecated in %s on line %d - -Warning: png2wbmp(): Unable to open '' for reading in %s on line %d - -Deprecated: Function png2wbmp() is deprecated in %s on line %d - -Warning: png2wbmp(): Unable to open '' for reading in %s on line %d ---CLEAN-- - diff --git a/ext/gd/tests/png2wbmp_error3.phpt b/ext/gd/tests/png2wbmp_error3.phpt deleted file mode 100644 index 3cab3ccb982a6..0000000000000 --- a/ext/gd/tests/png2wbmp_error3.phpt +++ /dev/null @@ -1,49 +0,0 @@ ---TEST-- -Test png2wbmp() function : wrong destination filename param ---CREDITS-- -Levi Fukumori -#testfest PHPSP on 2009-06-20 ---SKIPIF-- - ---FILE-- - ---EXPECTF-- -Deprecated: Function png2wbmp() is deprecated in %s on line %d - -Warning: png2wbmp(): Unable to open '' for writing in %s on line %d - -Deprecated: Function png2wbmp() is deprecated in %s on line %d - -Warning: png2wbmp(): Unable to open '' for writing in %s on line %d - -Deprecated: Function png2wbmp() is deprecated in %s on line %d - -Warning: png2wbmp(): Unable to open '' for writing in %s on line %d ---CLEAN-- - From 3d15a6f86b56c8acbf7363fb5e70a054918dbd64 Mon Sep 17 00:00:00 2001 From: "Christoph M. Becker" Date: Mon, 28 Jan 2019 15:18:01 +0100 Subject: [PATCH 07/51] Remove deprecated INTL_IDNA_VARIANT_2003 Cf. --- NEWS | 3 + UPGRADING | 4 + ext/intl/idn/idn.c | 108 ++------------------------- ext/intl/tests/idn_uts46_errors.phpt | 11 +-- 4 files changed, 16 insertions(+), 110 deletions(-) diff --git a/NEWS b/NEWS index f95cafb35f7e5..449f120c7d6bc 100644 --- a/NEWS +++ b/NEWS @@ -9,4 +9,7 @@ PHP NEWS . Removed deprecated image2wbmp(). (cmb) . Removed deprecated png2wbmp() and jpeg2wbmp(). (cmb) +- Intl: + . Removed deprecated INTL_IDNA_VARIANT_2003. (cmb) + <<< NOTE: Insert NEWS from last stable release here prior to actual release! >>> diff --git a/UPGRADING b/UPGRADING index 7cf0ae73adb6c..448466ef0e89b 100644 --- a/UPGRADING +++ b/UPGRADING @@ -29,6 +29,10 @@ PHP 8.0 UPGRADE NOTES . The deprecated functions png2wbmp() and jpeg2wbmp() have been removed. RFC: https://wiki.php.net/rfc/deprecate-png-jpeg-2wbmp +- Intl: + . The deprecated constant INTL_IDNA_VARIANT_2003 has been removed. + RFC: https://wiki.php.net/rfc/deprecate-and-remove-intl_idna_variant_2003 + ======================================== 2. New Features ======================================== diff --git a/ext/intl/idn/idn.c b/ext/intl/idn/idn.c index d717d46ee2076..f939eb323b957 100644 --- a/ext/intl/idn/idn.c +++ b/ext/intl/idn/idn.c @@ -33,8 +33,7 @@ /* }}} */ enum { - INTL_IDN_VARIANT_2003 = 0, - INTL_IDN_VARIANT_UTS46 + INTL_IDN_VARIANT_UTS46 = 1 }; /* {{{ grapheme_register_constants @@ -73,7 +72,6 @@ void idn_register_constants( INIT_FUNC_ARGS ) REGISTER_LONG_CONSTANT("IDNA_NONTRANSITIONAL_TO_UNICODE", UIDNA_NONTRANSITIONAL_TO_UNICODE, CONST_CS | CONST_PERSISTENT); /* VARIANTS */ - REGISTER_LONG_CONSTANT("INTL_IDNA_VARIANT_2003", INTL_IDN_VARIANT_2003, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("INTL_IDNA_VARIANT_UTS46", INTL_IDN_VARIANT_UTS46, CONST_CS | CONST_PERSISTENT); /* PINFO ERROR CODES */ @@ -176,85 +174,11 @@ static void php_intl_idn_to_46(INTERNAL_FUNCTION_PARAMETERS, uidna_close(uts46); } -static void php_intl_idn_to(INTERNAL_FUNCTION_PARAMETERS, - const zend_string *domain, uint32_t option, int mode) -{ - UChar* ustring = NULL; - int ustring_len = 0; - UErrorCode status; - zend_string *u8str; - - /* convert the string to UTF-16. */ - status = U_ZERO_ERROR; - intl_convert_utf8_to_utf16(&ustring, &ustring_len, ZSTR_VAL(domain), ZSTR_LEN(domain), &status); - - if (U_FAILURE(status)) { - intl_error_set_code(NULL, status); - - /* Set error messages. */ - intl_error_set_custom_msg( NULL, "Error converting input string to UTF-16", 0 ); - if (ustring) { - efree(ustring); - } - RETURN_FALSE; - } else { - UChar converted[MAXPATHLEN]; - int32_t converted_ret_len; - - status = U_ZERO_ERROR; - -#if U_ICU_VERSION_MAJOR_NUM >= 55 - UIDNAInfo info = UIDNA_INFO_INITIALIZER; - UIDNA *idna = uidna_openUTS46((int32_t)option, &status); - - if (U_FAILURE(status)) { - intl_error_set( NULL, status, "idn_to_ascii: failed to create an UIDNA instance", 0 ); - RETURN_FALSE; - } - - if (mode == INTL_IDN_TO_ASCII) { - converted_ret_len = uidna_nameToASCII(idna, ustring, ustring_len, converted, MAXPATHLEN, &info, &status); - } else { - converted_ret_len = uidna_nameToUnicode(idna, ustring, ustring_len, converted, MAXPATHLEN, &info, &status); - } - uidna_close(idna); -#else - UParseError parse_error; - if (mode == INTL_IDN_TO_ASCII) { - converted_ret_len = uidna_IDNToASCII(ustring, ustring_len, converted, MAXPATHLEN, (int32_t)option, &parse_error, &status); - } else { - converted_ret_len = uidna_IDNToUnicode(ustring, ustring_len, converted, MAXPATHLEN, (int32_t)option, &parse_error, &status); - } -#endif - efree(ustring); - - if (U_FAILURE(status)) { - intl_error_set( NULL, status, "idn_to_ascii: cannot convert to ASCII", 0 ); - RETURN_FALSE; - } - - status = U_ZERO_ERROR; - u8str = intl_convert_utf16_to_utf8(converted, converted_ret_len, &status); - - if (!u8str) { - /* Set global error code. */ - intl_error_set_code(NULL, status); - - /* Set error messages. */ - intl_error_set_custom_msg( NULL, "Error converting output string to UTF-8", 0 ); - RETURN_FALSE; - } - } - - /* return the allocated string, not a duplicate */ - RETVAL_NEW_STR(u8str); -} - static void php_intl_idn_handoff(INTERNAL_FUNCTION_PARAMETERS, int mode) { zend_string *domain; zend_long option = 0, - variant = INTL_IDN_VARIANT_UTS46; + variant = INTL_IDN_VARIANT_UTS46; zval *idna_info = NULL; intl_error_reset(NULL); @@ -265,9 +189,8 @@ static void php_intl_idn_handoff(INTERNAL_FUNCTION_PARAMETERS, int mode) RETURN_NULL(); /* don't set FALSE because that's not the way it was before... */ } - if (variant != INTL_IDN_VARIANT_2003 && variant != INTL_IDN_VARIANT_UTS46) { - php_intl_bad_args("invalid variant, must be one of {" - "INTL_IDNA_VARIANT_2003, INTL_IDNA_VARIANT_UTS46}"); + if (variant != INTL_IDN_VARIANT_UTS46) { + php_intl_bad_args("invalid variant, must be INTL_IDNA_VARIANT_UTS46"); RETURN_FALSE; } @@ -281,29 +204,14 @@ static void php_intl_idn_handoff(INTERNAL_FUNCTION_PARAMETERS, int mode) } /* don't check options; it wasn't checked before */ - if (variant == INTL_IDN_VARIANT_2003) { - php_error_docref(NULL, E_DEPRECATED, "INTL_IDNA_VARIANT_2003 is deprecated"); - } - if (idna_info != NULL) { - if (variant == INTL_IDN_VARIANT_2003) { - php_error_docref0(NULL, E_NOTICE, - "4 arguments were provided, but INTL_IDNA_VARIANT_2003 only " - "takes 3 - extra argument ignored"); - } else { - idna_info = zend_try_array_init(idna_info); - if (!idna_info) { - return; - } + idna_info = zend_try_array_init(idna_info); + if (!idna_info) { + return; } } - if (variant == INTL_IDN_VARIANT_2003) { - php_intl_idn_to(INTERNAL_FUNCTION_PARAM_PASSTHRU, domain, (uint32_t)option, mode); - } - else { - php_intl_idn_to_46(INTERNAL_FUNCTION_PARAM_PASSTHRU, domain, (uint32_t)option, mode, idna_info); - } + php_intl_idn_to_46(INTERNAL_FUNCTION_PARAM_PASSTHRU, domain, (uint32_t)option, mode, idna_info); } /* {{{ proto string idn_to_ascii(string domain[, int options[, int variant[, array &idna_info]]]) diff --git a/ext/intl/tests/idn_uts46_errors.phpt b/ext/intl/tests/idn_uts46_errors.phpt index 6a99bde64910c..55d2d56215d68 100644 --- a/ext/intl/tests/idn_uts46_errors.phpt +++ b/ext/intl/tests/idn_uts46_errors.phpt @@ -21,9 +21,6 @@ var_dump(idn_to_ascii("", 0, INTL_IDNA_VARIANT_UTS46 + 10)); echo "empty domain:", "\n"; var_dump(idn_to_ascii("", 0, INTL_IDNA_VARIANT_UTS46)); -echo "fourth arg for 2003 variant (only notice raised):", "\n"; -var_dump(idn_to_ascii("foo.com", 0, INTL_IDNA_VARIANT_2003, $foo)); - echo "with error, but no details arg:", "\n"; var_dump(idn_to_ascii("www.fußball.com-", 0, INTL_IDNA_VARIANT_UTS46)); @@ -54,18 +51,12 @@ Warning: idn_to_ascii(): idn_to_ascii: bad arguments in %s on line %d NULL bad variant: -Warning: idn_to_ascii(): idn_to_ascii: invalid variant, must be one of {INTL_IDNA_VARIANT_2003, INTL_IDNA_VARIANT_UTS46} in %s on line %d +Warning: idn_to_ascii(): idn_to_ascii: invalid variant, must be INTL_IDNA_VARIANT_UTS46 in %s on line %d bool(false) empty domain: Warning: idn_to_ascii(): idn_to_ascii: empty domain name in %s on line %d bool(false) -fourth arg for 2003 variant (only notice raised): - -Deprecated: idn_to_ascii(): INTL_IDNA_VARIANT_2003 is deprecated in %s on line %d - -Notice: idn_to_ascii(): 4 arguments were provided, but INTL_IDNA_VARIANT_2003 only takes 3 - extra argument ignored in %s on line %d -string(7) "foo.com" with error, but no details arg: bool(false) with error, with details arg: From faf03e47d2a6cdb360fe7a1bd8df3f6609f7c5af Mon Sep 17 00:00:00 2001 From: Joe Watkins Date: Mon, 28 Jan 2019 15:54:55 +0100 Subject: [PATCH 08/51] bump versions of all the things --- Zend/zend.h | 2 +- configure.ac | 4 ++-- main/php_version.h | 8 ++++---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Zend/zend.h b/Zend/zend.h index 5918691c279b7..05a43d277918d 100644 --- a/Zend/zend.h +++ b/Zend/zend.h @@ -20,7 +20,7 @@ #ifndef ZEND_H #define ZEND_H -#define ZEND_VERSION "3.4.0-dev" +#define ZEND_VERSION "4.0.0-dev" #define ZEND_ENGINE_3 diff --git a/configure.ac b/configure.ac index 2da7776e53c36..1ed2839b0b01a 100644 --- a/configure.ac +++ b/configure.ac @@ -109,8 +109,8 @@ extern "C++" { #endif /* PHP_CONFIG_H */ ]) -PHP_MAJOR_VERSION=7 -PHP_MINOR_VERSION=4 +PHP_MAJOR_VERSION=8 +PHP_MINOR_VERSION=0 PHP_RELEASE_VERSION=0 PHP_EXTRA_VERSION="-dev" PHP_VERSION="$PHP_MAJOR_VERSION.$PHP_MINOR_VERSION.$PHP_RELEASE_VERSION$PHP_EXTRA_VERSION" diff --git a/main/php_version.h b/main/php_version.h index 6f2f3c032d45e..24765617cbe0b 100644 --- a/main/php_version.h +++ b/main/php_version.h @@ -1,8 +1,8 @@ /* automatically generated by configure */ /* edit configure.ac to change version number */ -#define PHP_MAJOR_VERSION 7 -#define PHP_MINOR_VERSION 4 +#define PHP_MAJOR_VERSION 8 +#define PHP_MINOR_VERSION 0 #define PHP_RELEASE_VERSION 0 #define PHP_EXTRA_VERSION "-dev" -#define PHP_VERSION "7.4.0-dev" -#define PHP_VERSION_ID 70400 +#define PHP_VERSION "8.0.0-dev" +#define PHP_VERSION_ID 80000 From 734c305a822581c27ca3608cba482385dc247cf0 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Mon, 28 Jan 2019 12:24:20 +0100 Subject: [PATCH 09/51] Remove deprecated gmp_random() function Deprecated in PHP 7.2 as part of https://wiki.php.net/rfc/deprecations_php_7_2. --- ext/gmp/gmp.c | 27 ----- ext/gmp/tests/gmp_random.phpt | 60 ----------- ext/gmp/tests/gmp_random_seed.phpt | 154 +++++++++-------------------- 3 files changed, 48 insertions(+), 193 deletions(-) delete mode 100644 ext/gmp/tests/gmp_random.phpt diff --git a/ext/gmp/gmp.c b/ext/gmp/gmp.c index 3c92735cf641a..e920879dbb9b0 100644 --- a/ext/gmp/gmp.c +++ b/ext/gmp/gmp.c @@ -99,10 +99,6 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_gmp_prob_prime, 0, 0, 1) ZEND_ARG_INFO(0, reps) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_gmp_random, 0, 0, 0) - ZEND_ARG_INFO(0, limiter) -ZEND_END_ARG_INFO() - ZEND_BEGIN_ARG_INFO_EX(arginfo_gmp_random_seed, 0, 0, 1) ZEND_ARG_INFO(0, seed) ZEND_END_ARG_INFO() @@ -175,7 +171,6 @@ static const zend_function_entry gmp_functions[] = { ZEND_FE(gmp_kronecker, arginfo_gmp_binary) ZEND_FE(gmp_cmp, arginfo_gmp_binary) ZEND_FE(gmp_sign, arginfo_gmp_unary) - ZEND_DEP_FE(gmp_random, arginfo_gmp_random) ZEND_FE(gmp_random_seed, arginfo_gmp_random_seed) ZEND_FE(gmp_random_bits, arginfo_gmp_random_bits) ZEND_FE(gmp_random_range, arginfo_gmp_random_range) @@ -1882,28 +1877,6 @@ static void gmp_init_random(void) } } -/* {{{ proto GMP gmp_random([int limiter]) - Gets random number */ -ZEND_FUNCTION(gmp_random) -{ - zend_long limiter = 20; - mpz_ptr gmpnum_result; - - if (zend_parse_parameters(ZEND_NUM_ARGS(), "|l", &limiter) == FAILURE) { - return; - } - - INIT_GMP_RETVAL(gmpnum_result); - gmp_init_random(); - -#ifdef GMP_LIMB_BITS - mpz_urandomb(gmpnum_result, GMPG(rand_state), GMP_ABS (limiter) * GMP_LIMB_BITS); -#else - mpz_urandomb(gmpnum_result, GMPG(rand_state), GMP_ABS (limiter) * __GMP_BITS_PER_MP_LIMB); -#endif -} -/* }}} */ - /* {{{ proto GMP gmp_random_seed(mixed seed) Seed the RNG */ ZEND_FUNCTION(gmp_random_seed) diff --git a/ext/gmp/tests/gmp_random.phpt b/ext/gmp/tests/gmp_random.phpt deleted file mode 100644 index ab2b11b3f72d6..0000000000000 --- a/ext/gmp/tests/gmp_random.phpt +++ /dev/null @@ -1,60 +0,0 @@ ---TEST-- -gmp_random() basic tests ---SKIPIF-- - ---FILE-- - ---EXPECTF-- -Deprecated: Function gmp_random() is deprecated in %s on line %d -string(%d) "%d" - -Deprecated: Function gmp_random() is deprecated in %s on line %d -string(%d) "%d" - -Deprecated: Function gmp_random() is deprecated in %s on line %d -string(1) "%d" - -Deprecated: Function gmp_random() is deprecated in %s on line %d -string(%d) "%d" - -Deprecated: Function gmp_random() is deprecated in %s on line %d -string(%d) "%d" - -Deprecated: Function gmp_random() is deprecated in %s on line %d -string(%d) "%d" - -Deprecated: Function gmp_random() is deprecated in %s on line %d - -Warning: gmp_random() expects parameter 1 to be int, array given in %s on line %d -NULL - -Deprecated: Function gmp_random() is deprecated in %s on line %d - -Warning: gmp_random() expects at most 1 parameter, 2 given in %s on line %d -NULL - -Deprecated: Function gmp_random() is deprecated in %s on line %d - -Warning: gmp_random() expects parameter 1 to be int, string given in %s on line %d -NULL - -Deprecated: Function gmp_random() is deprecated in %s on line %d - -Warning: gmp_random() expects parameter 1 to be int, string given in %s on line %d -NULL -Done diff --git a/ext/gmp/tests/gmp_random_seed.phpt b/ext/gmp/tests/gmp_random_seed.phpt index e143a5153ec55..80f49ee32c496 100644 --- a/ext/gmp/tests/gmp_random_seed.phpt +++ b/ext/gmp/tests/gmp_random_seed.phpt @@ -3,18 +3,12 @@ gmp_random_seed() basic tests --SKIPIF-- ---INI-- -error_reporting=E_ALL&~E_DEPRECATED --FILE-- --EXPECTF-- NULL -string(386) "16100871751340485642888774479422205950971474538471317276388238970713821926852258806210387669237144400278914671533438653274777493140545293541785377162348524402063489947660558889561219968642920852870483050552936324125257259316643328803697665037881088889859735075814746314563786538493931260996669892959501637800179548654075887300734264333417283208357503038004080669367070111848040502362219" -string(18) "255344473360201232" -string(192) "566276705882089203328999735915155615747289398229935944715725865523491463654289449864817867794422824157675456435165973986660058784111212531276312901205233176071526587181942240113004108328736022" -string(3) "766" -string(31) "1251852006013618829761115383588" -string(301) "2904442664575028522451529381233481137998826790384445089758175726247096826023839957531211794198483328480161675791738894500687706952157332727908305084432443942315866545175274665372161864357698401817740956147940095302549920711069038378541222669595494627580205085300332122174778540693048337420608925104417" -string(4) "5969" -string(5) "-4126" -string(4) "-926" +string(3) "107" +string(30) "576055025228722307492589900056" +string(301) "5075491613651149525976453192895895253653438900772590630831858908690082668789318258254821002217677675804439098856210618572534955562143303188483908287009522532300439665975877709754914215718998849272363858786685187951932478210775857465448084868199807983919191214972626993925394176279001074206804955195464" +string(4) "4098" +string(3) "866" +string(5) "-4602" NULL -string(386) "16100871751340485642888774479422205950971474538471317276388238970713821926852258806210387669237144400278914671533438653274777493140545293541785377162348524402063489947660558889561219968642920852870483050552936324125257259316643328803697665037881088889859735075814746314563786538493931260996669892959501637800179548654075887300734264333417283208357503038004080669367070111848040502362219" -string(18) "255344473360201232" -string(192) "566276705882089203328999735915155615747289398229935944715725865523491463654289449864817867794422824157675456435165973986660058784111212531276312901205233176071526587181942240113004108328736022" -string(3) "766" -string(31) "1251852006013618829761115383588" -string(301) "2904442664575028522451529381233481137998826790384445089758175726247096826023839957531211794198483328480161675791738894500687706952157332727908305084432443942315866545175274665372161864357698401817740956147940095302549920711069038378541222669595494627580205085300332122174778540693048337420608925104417" -string(4) "5969" -string(5) "-4126" -string(4) "-926" +string(3) "107" +string(30) "576055025228722307492589900056" +string(301) "5075491613651149525976453192895895253653438900772590630831858908690082668789318258254821002217677675804439098856210618572534955562143303188483908287009522532300439665975877709754914215718998849272363858786685187951932478210775857465448084868199807983919191214972626993925394176279001074206804955195464" +string(4) "4098" +string(3) "866" +string(5) "-4602" NULL -string(386) "13477111096113160882601567427091178332669645276785709413953468738199940626922635042144840457533224221336117027441609364710893482124071124759231943384805378201041406842697962243732316555316214869988749798708139879922380266366387589101775891621221881149417841139463207495993669582399783202126977651864760442797681787747348653884279195479310922110107643437514016795836672871442926389274400" -string(20) "15370156633245019617" -string(192) "294354325919119835375781661354719128667828860233586416953977190644006896604022494655398295674227944872858213051595447565156112646032890737200590095517623075051828676500990477704073251304424133" -string(3) "683" -string(31) "1105092118036828878542238774672" -string(301) "2700084798786584694260166508009114488318099110808331607090845844712329387915039325877090587052399841255219556028410036280510827424748532204766771994624650610348058361519239518625728955462297681525123214377383395734875500143425080808436274385326255154393544373636015993206705180032889399161843788895374" -string(4) "7268" -string(5) "-3518" -string(5) "-8432" +string(3) "800" +string(30) "136797365759249926716355081555" +string(300) "983682312243221532860194306859606025979259367996304596374614332718375645173854152266611727577102182844028492473112400528817154210713755887896949560718745264129216953815968005630126359941634684721501777057142617647654380585317016323758806063124938232519551123440573348326061244006512869165793958775168" +string(4) "1029" +string(4) "7093" +string(5) "-9074" NULL -string(386) "13477111096113160882601567427091178332669645276785709413953468738199940626922635042144840457533224221336117027441609364710893482124071124759231943384805378201041406842697962243732316555316214869988749798708139879922380266366387589101775891621221881149417841139463207495993669582399783202126977651864760442797681787747348653884279195479310922110107643437514016795836672871442926389274400" -string(20) "15370156633245019617" -string(192) "294354325919119835375781661354719128667828860233586416953977190644006896604022494655398295674227944872858213051595447565156112646032890737200590095517623075051828676500990477704073251304424133" -string(3) "683" -string(31) "1105092118036828878542238774672" -string(301) "2700084798786584694260166508009114488318099110808331607090845844712329387915039325877090587052399841255219556028410036280510827424748532204766771994624650610348058361519239518625728955462297681525123214377383395734875500143425080808436274385326255154393544373636015993206705180032889399161843788895374" -string(4) "7268" -string(5) "-3518" -string(5) "-8432" +string(3) "800" +string(30) "136797365759249926716355081555" +string(300) "983682312243221532860194306859606025979259367996304596374614332718375645173854152266611727577102182844028492473112400528817154210713755887896949560718745264129216953815968005630126359941634684721501777057142617647654380585317016323758806063124938232519551123440573348326061244006512869165793958775168" +string(4) "1029" +string(4) "7093" +string(5) "-9074" NULL -string(386) "13477111096113160882601567427091178332669645276785709413953468738199940626922635042144840457533224221336117027441609364710893482124071124759231943384805378201041406842697962243732316555316214869988749798708139879922380266366387589101775891621221881149417841139463207495993669582399783202126977651864760442797681787747348653884279195479310922110107643437514016795836672871442926389274400" -string(20) "15370156633245019617" -string(192) "294354325919119835375781661354719128667828860233586416953977190644006896604022494655398295674227944872858213051595447565156112646032890737200590095517623075051828676500990477704073251304424133" -string(3) "683" -string(31) "1105092118036828878542238774672" -string(301) "2700084798786584694260166508009114488318099110808331607090845844712329387915039325877090587052399841255219556028410036280510827424748532204766771994624650610348058361519239518625728955462297681525123214377383395734875500143425080808436274385326255154393544373636015993206705180032889399161843788895374" -string(4) "7268" -string(5) "-3518" -string(5) "-8432" +string(3) "800" +string(30) "136797365759249926716355081555" +string(300) "983682312243221532860194306859606025979259367996304596374614332718375645173854152266611727577102182844028492473112400528817154210713755887896949560718745264129216953815968005630126359941634684721501777057142617647654380585317016323758806063124938232519551123440573348326061244006512869165793958775168" +string(4) "1029" +string(4) "7093" +string(5) "-9074" NULL -string(386) "13477111096113160882601567427091178332669645276785709413953468738199940626922635042144840457533224221336117027441609364710893482124071124759231943384805378201041406842697962243732316555316214869988749798708139879922380266366387589101775891621221881149417841139463207495993669582399783202126977651864760442797681787747348653884279195479310922110107643437514016795836672871442926389274400" -string(20) "15370156633245019617" -string(192) "294354325919119835375781661354719128667828860233586416953977190644006896604022494655398295674227944872858213051595447565156112646032890737200590095517623075051828676500990477704073251304424133" -string(3) "683" -string(31) "1105092118036828878542238774672" -string(301) "2700084798786584694260166508009114488318099110808331607090845844712329387915039325877090587052399841255219556028410036280510827424748532204766771994624650610348058361519239518625728955462297681525123214377383395734875500143425080808436274385326255154393544373636015993206705180032889399161843788895374" -string(4) "7268" -string(5) "-3518" -string(5) "-8432" +string(3) "800" +string(30) "136797365759249926716355081555" +string(300) "983682312243221532860194306859606025979259367996304596374614332718375645173854152266611727577102182844028492473112400528817154210713755887896949560718745264129216953815968005630126359941634684721501777057142617647654380585317016323758806063124938232519551123440573348326061244006512869165793958775168" +string(4) "1029" +string(4) "7093" +string(5) "-9074" NULL -string(386) "17517289823903393220742578279919954815229524740463730368402128237511862318453381595675765692750750649609755422480004471234960388086555321894591036872550129477305413674775698107868844953599169316550102271816620108199930104365341610775602960735862041722613145476720452800951958891882288668416542937408952006310656170195090436314902430700708511047189929836145291647101130135292078875631354" -string(19) "1662391866670215057" -string(193) "1951928859951518261564127834731454911658112769477733872890285741065126442731035642243573666695893929882207432512593006044657806021743917753379619843420559355572830613932424235592411658293328273" -string(3) "888" -string(30) "136524289584478309125073026188" -string(301) "4487372666528061674404740793683112894444118579769413902123304803304884162086348577960502430419080687314731489440882833272125181594897832730214825704339272207090970657364333461383490282984012738008555512699878911293400686609929745464733074891420787002129849587668122219953473716759349853748437799165176" -string(4) "8559" -string(4) "9426" -string(5) "-2932" +string(3) "762" +string(30) "822340340897453415684831711085" +string(301) "7240560133683902061389868703829443708354917824328579773726122219756981024103097560162756171513655189995985599958252688592185764428631571614485572869738344560301294144844739876478557439580966605216861285841689262517286639329902832431755450003123084728943981078635297917573398492558065003906539489023830" +string(4) "9636" +string(5) "-9848" +string(5) "-9648" NULL -string(386) "17517289823903393220742578279919954815229524740463730368402128237511862318453381595675765692750750649609755422480004471234960388086555321894591036872550129477305413674775698107868844953599169316550102271816620108199930104365341610775602960735862041722613145476720452800951958891882288668416542937408952006310656170195090436314902430700708511047189929836145291647101130135292078875631354" -string(19) "1662391866670215057" -string(193) "1951928859951518261564127834731454911658112769477733872890285741065126442731035642243573666695893929882207432512593006044657806021743917753379619843420559355572830613932424235592411658293328273" -string(3) "888" -string(30) "136524289584478309125073026188" -string(301) "4487372666528061674404740793683112894444118579769413902123304803304884162086348577960502430419080687314731489440882833272125181594897832730214825704339272207090970657364333461383490282984012738008555512699878911293400686609929745464733074891420787002129849587668122219953473716759349853748437799165176" -string(4) "8559" -string(4) "9426" -string(5) "-2932" +string(3) "762" +string(30) "822340340897453415684831711085" +string(301) "7240560133683902061389868703829443708354917824328579773726122219756981024103097560162756171513655189995985599958252688592185764428631571614485572869738344560301294144844739876478557439580966605216861285841689262517286639329902832431755450003123084728943981078635297917573398492558065003906539489023830" +string(4) "9636" +string(5) "-9848" +string(5) "-9648" Warning: gmp_random_seed(): Unable to convert variable to GMP - string is not an integer in %s on line %d bool(false) From ee16d99504f0014c3d292809da927fb622293f41 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Mon, 28 Jan 2019 12:41:36 +0100 Subject: [PATCH 10/51] Remove create_function() Deprecated in PHP 7.2 as part of https://wiki.php.net/rfc/deprecations_php_7_2. --- Zend/tests/anonymous_func_001.phpt | 54 ------------- Zend/tests/anonymous_func_002.phpt | 19 ----- Zend/tests/anonymous_func_003.phpt | 16 ---- Zend/tests/bug48693.phpt | 52 ------------ Zend/tests/closure_025.phpt | 13 --- Zend/tests/exception_012.phpt | 23 ------ Zend/tests/instanceof_001.phpt | 4 +- Zend/zend_builtin_functions.c | 79 ------------------- ext/opcache/Optimizer/zend_func_info.c | 1 - ext/opcache/tests/bug68252.phpt | 21 ----- .../tests/general_functions/print_r.phpt | 18 +---- .../general_functions/print_r_64bit.phpt | 18 +---- .../tests/general_functions/var_dump.phpt | 17 ---- .../general_functions/var_dump_64bit.phpt | 17 ---- ext/standard/tests/strings/bug37262.phpt | 8 +- tests/lang/bug17115.phpt | 17 ---- tests/lang/bug22690.phpt | 13 --- tests/lang/bug24926.phpt | 29 ------- 18 files changed, 6 insertions(+), 413 deletions(-) delete mode 100644 Zend/tests/anonymous_func_001.phpt delete mode 100644 Zend/tests/anonymous_func_002.phpt delete mode 100644 Zend/tests/anonymous_func_003.phpt delete mode 100644 Zend/tests/bug48693.phpt delete mode 100644 Zend/tests/closure_025.phpt delete mode 100644 Zend/tests/exception_012.phpt delete mode 100644 ext/opcache/tests/bug68252.phpt delete mode 100644 tests/lang/bug17115.phpt delete mode 100644 tests/lang/bug22690.phpt delete mode 100644 tests/lang/bug24926.phpt diff --git a/Zend/tests/anonymous_func_001.phpt b/Zend/tests/anonymous_func_001.phpt deleted file mode 100644 index 97b91b6544afa..0000000000000 --- a/Zend/tests/anonymous_func_001.phpt +++ /dev/null @@ -1,54 +0,0 @@ ---TEST-- -Testing calls to anonymous function ---FILE-- - ---EXPECTF-- -Deprecated: Function create_function() is deprecated in %s on line %d -int(0) -int(0) - -Deprecated: Function create_function() is deprecated in %s on line %d -int(1) -int(1) - -Deprecated: Function create_function() is deprecated in %s on line %d -int(2) -int(2) - -Deprecated: Function create_function() is deprecated in %s on line %d -int(3) -int(3) - -Deprecated: Function create_function() is deprecated in %s on line %d -int(4) -int(4) - -Deprecated: Function create_function() is deprecated in %s on line %d -int(5) -int(5) - -Deprecated: Function create_function() is deprecated in %s on line %d -int(6) -int(6) - -Deprecated: Function create_function() is deprecated in %s on line %d -int(7) -int(7) - -Deprecated: Function create_function() is deprecated in %s on line %d -int(8) -int(8) - -Deprecated: Function create_function() is deprecated in %s on line %d -int(9) -int(9) diff --git a/Zend/tests/anonymous_func_002.phpt b/Zend/tests/anonymous_func_002.phpt deleted file mode 100644 index 28adc357dab8f..0000000000000 --- a/Zend/tests/anonymous_func_002.phpt +++ /dev/null @@ -1,19 +0,0 @@ ---TEST-- -Testing anonymous function return as array key and accessing $GLOBALS ---FILE-- - ---EXPECTF-- -Deprecated: Function create_function() is deprecated in %s on line %d - -Deprecated: Function create_function() is deprecated in %s on line %d -int(2) -bool(true) diff --git a/Zend/tests/anonymous_func_003.phpt b/Zend/tests/anonymous_func_003.phpt deleted file mode 100644 index d2610310f7c84..0000000000000 --- a/Zend/tests/anonymous_func_003.phpt +++ /dev/null @@ -1,16 +0,0 @@ ---TEST-- -Using throw $var with anonymous function return ---FILE-- -getMessage() == 'test'); -} - -?> ---EXPECTF-- -Deprecated: Function create_function() is deprecated in %s on line %d -bool(true) diff --git a/Zend/tests/bug48693.phpt b/Zend/tests/bug48693.phpt deleted file mode 100644 index f916b6407bf60..0000000000000 --- a/Zend/tests/bug48693.phpt +++ /dev/null @@ -1,52 +0,0 @@ ---TEST-- -Bug #48693 (Double declaration of __lambda_func when lambda wrongly formatted) ---FILE-- - ---EXPECTF-- -Deprecated: Function create_function() is deprecated in %s on line %d -ParseError: syntax error, unexpected '}', expecting end of file in %sbug48693.php(4) : runtime-created function:1 -Stack trace: -#0 %sbug48693.php(4): create_function('', 'return 1; }') -#1 {main} - - -Deprecated: Function create_function() is deprecated in %s on line %d - -Deprecated: Function create_function() is deprecated in %s on line %d -ParseError: syntax error, unexpected end of file in %sbug48693.php(14) : runtime-created function:1 -Stack trace: -#0 %sbug48693.php(14): create_function('', '{') -#1 {main} - - -Deprecated: Function create_function() is deprecated in %s on line %d -int(2) -int(3) diff --git a/Zend/tests/closure_025.phpt b/Zend/tests/closure_025.phpt deleted file mode 100644 index b3d03a7ad90a0..0000000000000 --- a/Zend/tests/closure_025.phpt +++ /dev/null @@ -1,13 +0,0 @@ ---TEST-- -Closure 025: Using closure in create_function() ---FILE-- -__invoke(4)); - -?> ---EXPECTF-- -Deprecated: Function create_function() is deprecated in %s on line %d -int(8) diff --git a/Zend/tests/exception_012.phpt b/Zend/tests/exception_012.phpt deleted file mode 100644 index 4a1070330a100..0000000000000 --- a/Zend/tests/exception_012.phpt +++ /dev/null @@ -1,23 +0,0 @@ ---TEST-- -Test exception doesn't cause RSHUTDOWN bypass, variation 1 ---INI-- -assert.bail=1 -assert.exception=1 ---FILE-- - ---EXPECTHEADERS-- -Content-type: text/html; charset=UTF-8 ---EXPECTF-- -Deprecated: Function create_function() is deprecated in %s on line %d - -Fatal error: Uncaught AssertionError: assert(false) in %sexception_012.php(%d) : runtime-created function:%d -Stack trace: -#0 %sexception_012.php(%d) : runtime-created function(%d): assert(false, 'assert(false)') -#1 %sexception_012.php(%d): __lambda_func() -#2 {main} - thrown in %sexception_012.php(%d) : runtime-created function on line %d diff --git a/Zend/tests/instanceof_001.phpt b/Zend/tests/instanceof_001.phpt index 8c13a0478c1dc..ae33dab4a5bb2 100644 --- a/Zend/tests/instanceof_001.phpt +++ b/Zend/tests/instanceof_001.phpt @@ -8,7 +8,7 @@ var_dump($a instanceof stdClass); var_dump(new stdCLass instanceof stdClass); -$b = create_function('', 'return new stdClass;'); +$b = function() { return new stdClass; }; var_dump($b() instanceof stdClass); $c = array(new stdClass); @@ -22,8 +22,6 @@ var_dump("$a" instanceof stdClass); --EXPECTF-- bool(true) bool(true) - -Deprecated: Function create_function() is deprecated in %s on line %d bool(true) bool(true) bool(false) diff --git a/Zend/zend_builtin_functions.c b/Zend/zend_builtin_functions.c index 3fce84d6a47d2..e8bcc1c980e25 100644 --- a/Zend/zend_builtin_functions.c +++ b/Zend/zend_builtin_functions.c @@ -67,7 +67,6 @@ static ZEND_FUNCTION(get_declared_traits); static ZEND_FUNCTION(get_declared_interfaces); static ZEND_FUNCTION(get_defined_functions); static ZEND_FUNCTION(get_defined_vars); -static ZEND_FUNCTION(create_function); static ZEND_FUNCTION(get_resource_type); static ZEND_FUNCTION(get_resources); static ZEND_FUNCTION(get_loaded_extensions); @@ -197,11 +196,6 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_get_defined_functions, 0, 0, 0) ZEND_ARG_INFO(0, exclude_disabled) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_create_function, 0, 0, 2) - ZEND_ARG_INFO(0, args) - ZEND_ARG_INFO(0, code) -ZEND_END_ARG_INFO() - ZEND_BEGIN_ARG_INFO_EX(arginfo_get_resource_type, 0, 0, 1) ZEND_ARG_INFO(0, res) ZEND_END_ARG_INFO() @@ -276,7 +270,6 @@ static const zend_function_entry builtin_functions[] = { /* {{{ */ ZEND_FE(get_declared_interfaces, arginfo_zend__void) ZEND_FE(get_defined_functions, arginfo_get_defined_functions) ZEND_FE(get_defined_vars, arginfo_zend__void) - ZEND_DEP_FE(create_function, arginfo_create_function) ZEND_FE(get_resource_type, arginfo_get_resource_type) ZEND_FE(get_resources, arginfo_get_resources) ZEND_FE(get_loaded_extensions, arginfo_get_loaded_extensions) @@ -1895,78 +1888,6 @@ ZEND_FUNCTION(get_defined_vars) } /* }}} */ -#define LAMBDA_TEMP_FUNCNAME "__lambda_func" -/* {{{ proto string create_function(string args, string code) - Creates an anonymous function, and returns its name (funny, eh?) */ -ZEND_FUNCTION(create_function) -{ - zend_string *function_name; - char *eval_code, *function_args, *function_code; - size_t eval_code_length, function_args_len, function_code_len; - int retval; - char *eval_name; - - if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss", &function_args, &function_args_len, &function_code, &function_code_len) == FAILURE) { - return; - } - - eval_code = (char *) emalloc(sizeof("function " LAMBDA_TEMP_FUNCNAME) - +function_args_len - +2 /* for the args parentheses */ - +2 /* for the curly braces */ - +function_code_len); - - eval_code_length = sizeof("function " LAMBDA_TEMP_FUNCNAME "(") - 1; - memcpy(eval_code, "function " LAMBDA_TEMP_FUNCNAME "(", eval_code_length); - - memcpy(eval_code + eval_code_length, function_args, function_args_len); - eval_code_length += function_args_len; - - eval_code[eval_code_length++] = ')'; - eval_code[eval_code_length++] = '{'; - - memcpy(eval_code + eval_code_length, function_code, function_code_len); - eval_code_length += function_code_len; - - eval_code[eval_code_length++] = '}'; - eval_code[eval_code_length] = '\0'; - - eval_name = zend_make_compiled_string_description("runtime-created function"); - retval = zend_eval_stringl(eval_code, eval_code_length, NULL, eval_name); - efree(eval_code); - efree(eval_name); - - if (retval==SUCCESS) { - zend_op_array *func; - HashTable *static_variables; - - func = zend_hash_str_find_ptr(EG(function_table), LAMBDA_TEMP_FUNCNAME, sizeof(LAMBDA_TEMP_FUNCNAME)-1); - if (!func) { - zend_error_noreturn(E_CORE_ERROR, "Unexpected inconsistency in create_function()"); - RETURN_FALSE; - } - if (func->refcount) { - (*func->refcount)++; - } - static_variables = func->static_variables; - func->static_variables = NULL; - zend_hash_str_del(EG(function_table), LAMBDA_TEMP_FUNCNAME, sizeof(LAMBDA_TEMP_FUNCNAME)-1); - func->static_variables = static_variables; - - function_name = zend_string_alloc(sizeof("0lambda_")+MAX_LENGTH_OF_LONG, 0); - ZSTR_VAL(function_name)[0] = '\0'; - - do { - ZSTR_LEN(function_name) = snprintf(ZSTR_VAL(function_name) + 1, sizeof("lambda_")+MAX_LENGTH_OF_LONG, "lambda_%d", ++EG(lambda_count)) + 1; - } while (zend_hash_add_ptr(EG(function_table), function_name, func) == NULL); - RETURN_NEW_STR(function_name); - } else { - zend_hash_str_del(EG(function_table), LAMBDA_TEMP_FUNCNAME, sizeof(LAMBDA_TEMP_FUNCNAME)-1); - RETURN_FALSE; - } -} -/* }}} */ - #if ZEND_DEBUG && defined(ZTS) ZEND_FUNCTION(zend_thread_id) { diff --git a/ext/opcache/Optimizer/zend_func_info.c b/ext/opcache/Optimizer/zend_func_info.c index fb216348858ee..6aea0f6007109 100644 --- a/ext/opcache/Optimizer/zend_func_info.c +++ b/ext/opcache/Optimizer/zend_func_info.c @@ -258,7 +258,6 @@ static const func_info_t func_infos[] = { I1("get_declared_interfaces", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING), F1("get_defined_functions", MAY_BE_NULL | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_ARRAY), I1("get_defined_vars", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_ANY | MAY_BE_ARRAY_OF_REF), - FN("create_function", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE | MAY_BE_STRING), F1("get_resource_type", MAY_BE_NULL | MAY_BE_STRING), F1("get_defined_constants", MAY_BE_NULL | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_NULL | MAY_BE_ARRAY_OF_FALSE | MAY_BE_ARRAY_OF_TRUE | MAY_BE_ARRAY_OF_LONG | MAY_BE_ARRAY_OF_DOUBLE | MAY_BE_ARRAY_OF_STRING | MAY_BE_ARRAY_OF_RESOURCE | MAY_BE_ARRAY_OF_ARRAY), F0("debug_print_backtrace", MAY_BE_NULL), diff --git a/ext/opcache/tests/bug68252.phpt b/ext/opcache/tests/bug68252.phpt deleted file mode 100644 index bc2e5a0fb68cc..0000000000000 --- a/ext/opcache/tests/bug68252.phpt +++ /dev/null @@ -1,21 +0,0 @@ ---TEST-- -Bug #68252 (segfault in Zend/zend_hash.c in function _zend_hash_del_el) ---INI-- -opcache.enable=1 -opcache.enable_cli=1 -opcache.fast_shutdown=1 ---SKIPIF-- - ---FILE-- - ---EXPECTF-- -Deprecated: Function create_function() is deprecated in %s on line %d -'' . "\0" . 'lambda_%d' +--EXPECT-- +'foo' . "\0" . 'bar' diff --git a/tests/lang/bug17115.phpt b/tests/lang/bug17115.phpt deleted file mode 100644 index 9500352799276..0000000000000 --- a/tests/lang/bug17115.phpt +++ /dev/null @@ -1,17 +0,0 @@ ---TEST-- -Bug #17115 (lambda functions produce segfault with static vars) ---FILE-- - ---EXPECTF-- -Deprecated: Function create_function() is deprecated in %s on line %d -int(0) -int(1) -int(2) diff --git a/tests/lang/bug22690.phpt b/tests/lang/bug22690.phpt deleted file mode 100644 index 85ddcd34875ba..0000000000000 --- a/tests/lang/bug22690.phpt +++ /dev/null @@ -1,13 +0,0 @@ ---TEST-- -Bug #22690 (ob_start() is broken with create_function() callbacks) ---FILE-- - -bar ---EXPECTF-- -Deprecated: Function create_function() is deprecated in %s on line %d -BAR -BAR diff --git a/tests/lang/bug24926.phpt b/tests/lang/bug24926.phpt deleted file mode 100644 index f73d265f3886d..0000000000000 --- a/tests/lang/bug24926.phpt +++ /dev/null @@ -1,29 +0,0 @@ ---TEST-- -Bug #24926 (lambda function (create_function()) cannot be stored in a class property) ---FILE-- -functions['test'] = $function; - print($this->functions['test']()); // werkt al niet meer - - } -} - -$a = new foo (); - -?> ---EXPECTF-- -Deprecated: Function create_function() is deprecated in %s on line %d -FOO -FOO From 920b4b249f71e6cbfd795f81c6a08126a33c659e Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Mon, 28 Jan 2019 12:54:46 +0100 Subject: [PATCH 11/51] Remove track_errors and $php_errormsg This has been deprecated in PHP 7.2 as part of https://wiki.php.net/rfc/deprecations_php_7_2. --- Zend/tests/bug47320.phpt | 26 -------------- Zend/tests/bug54585.phpt | 17 --------- Zend/tests/bug67858.phpt | 21 ----------- Zend/tests/php_errormsg_misoptimization.phpt | 22 ------------ ext/opcache/Optimizer/zend_inference.c | 4 +-- ext/opcache/Optimizer/zend_ssa.c | 2 -- ext/opcache/Optimizer/zend_ssa.h | 1 - ext/opcache/tests/bug75893.phpt | 22 ------------ .../tests/file/parse_ini_file_variation3.phpt | 5 +-- main/main.c | 30 ++-------------- main/php_globals.h | 1 - php.ini-development | 8 ----- php.ini-production | 15 -------- tests/basic/027.phpt | 33 ----------------- tests/output/bug74815.phpt | 19 ---------- tests/run-test/test005.phpt | 36 ------------------- tests/run-test/test008.phpt | 33 ----------------- tests/run-test/test008a.phpt | 36 ------------------- 18 files changed, 4 insertions(+), 327 deletions(-) delete mode 100644 Zend/tests/bug47320.phpt delete mode 100644 Zend/tests/bug54585.phpt delete mode 100644 Zend/tests/bug67858.phpt delete mode 100644 Zend/tests/php_errormsg_misoptimization.phpt delete mode 100644 ext/opcache/tests/bug75893.phpt delete mode 100644 tests/basic/027.phpt delete mode 100644 tests/output/bug74815.phpt delete mode 100644 tests/run-test/test005.phpt delete mode 100644 tests/run-test/test008.phpt delete mode 100644 tests/run-test/test008a.phpt diff --git a/Zend/tests/bug47320.phpt b/Zend/tests/bug47320.phpt deleted file mode 100644 index 47db35edac5fd..0000000000000 --- a/Zend/tests/bug47320.phpt +++ /dev/null @@ -1,26 +0,0 @@ ---TEST-- -Bug #47320 ($php_errormsg out of scope in functions) ---INI-- -display_errors=0 -track_errors=1 ---FILE-- - ---EXPECT-- -$php_errormsg in global: substr() expects at least 2 parameters, 1 given -$php_errormsg in function: strpos() expects at least 2 parameters, 1 given -$GLOBALS[php_errormsg] in function: substr() expects at least 2 parameters, 1 given diff --git a/Zend/tests/bug54585.phpt b/Zend/tests/bug54585.phpt deleted file mode 100644 index deabe55af84f1..0000000000000 --- a/Zend/tests/bug54585.phpt +++ /dev/null @@ -1,17 +0,0 @@ ---TEST-- -Bug #54585 (track_errors causes segfault) ---INI-- -track_errors=On ---FILE-- - ---EXPECTF-- -Deprecated: Directive 'track_errors' is deprecated in Unknown on line 0 - -Notice: Undefined variable: cos in %sbug54585.php on line 3 -ok diff --git a/Zend/tests/bug67858.phpt b/Zend/tests/bug67858.phpt deleted file mode 100644 index 1186cd6a6fb96..0000000000000 --- a/Zend/tests/bug67858.phpt +++ /dev/null @@ -1,21 +0,0 @@ ---TEST-- -Bug #67858: Leak when $php_errormsg already set ---INI-- -track_errors=1 -error_reporting=E_ALL ---FILE-- - ---EXPECTF-- -Deprecated: Directive 'track_errors' is deprecated in Unknown on line 0 - -Notice: Undefined variable: var in %s on line %d -string(23) "Undefined variable: var" diff --git a/Zend/tests/php_errormsg_misoptimization.phpt b/Zend/tests/php_errormsg_misoptimization.phpt deleted file mode 100644 index ae389db248743..0000000000000 --- a/Zend/tests/php_errormsg_misoptimization.phpt +++ /dev/null @@ -1,22 +0,0 @@ ---TEST-- -The variable $php_errormsg shouldn't be optimized as it may be unpredictably modified ---INI-- -track_errors=1 ---FILE-- - ---EXPECTF-- -Deprecated: Directive 'track_errors' is deprecated in Unknown on line 0 - -Notice: Undefined variable: undef in %s on line %d - -Warning: A non-numeric value encountered in %s on line %d -int(1) diff --git a/ext/opcache/Optimizer/zend_inference.c b/ext/opcache/Optimizer/zend_inference.c index 648e4e621c95d..9a875fd90b656 100644 --- a/ext/opcache/Optimizer/zend_inference.c +++ b/ext/opcache/Optimizer/zend_inference.c @@ -1844,9 +1844,7 @@ static int zend_infer_ranges(const zend_op_array *op_array, zend_ssa *ssa) /* {{ /* }}} */ static uint32_t get_ssa_alias_types(zend_ssa_alias_kind alias) { - if (alias == PHP_ERRORMSG_ALIAS) { - return MAY_BE_STRING | MAY_BE_RC1 | MAY_BE_RCN; - } else if (alias == HTTP_RESPONSE_HEADER_ALIAS) { + if (alias == HTTP_RESPONSE_HEADER_ALIAS) { return MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING | MAY_BE_RC1 | MAY_BE_RCN; } else { return MAY_BE_UNDEF | MAY_BE_RC1 | MAY_BE_RCN | MAY_BE_REF | MAY_BE_ANY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_ANY | MAY_BE_ARRAY_OF_REF; diff --git a/ext/opcache/Optimizer/zend_ssa.c b/ext/opcache/Optimizer/zend_ssa.c index a3a5130385f38..2e5c4639789c0 100644 --- a/ext/opcache/Optimizer/zend_ssa.c +++ b/ext/opcache/Optimizer/zend_ssa.c @@ -1133,8 +1133,6 @@ int zend_ssa_compute_use_def_chains(zend_arena **arena, const zend_op_array *op_ for (i = 0; i < op_array->last_var; i++) { if ((ssa->cfg.flags & ZEND_FUNC_INDIRECT_VAR_ACCESS)) { ssa_vars[i].alias = SYMTABLE_ALIAS; - } else if (zend_string_equals_literal(op_array->vars[i], "php_errormsg")) { - ssa_vars[i].alias = PHP_ERRORMSG_ALIAS; } else if (zend_string_equals_literal(op_array->vars[i], "http_response_header")) { ssa_vars[i].alias = HTTP_RESPONSE_HEADER_ALIAS; } diff --git a/ext/opcache/Optimizer/zend_ssa.h b/ext/opcache/Optimizer/zend_ssa.h index 4ee442dcab6d6..08aa5b9c1afe5 100644 --- a/ext/opcache/Optimizer/zend_ssa.h +++ b/ext/opcache/Optimizer/zend_ssa.h @@ -95,7 +95,6 @@ typedef struct _zend_ssa_op { typedef enum _zend_ssa_alias_kind { NO_ALIAS, SYMTABLE_ALIAS, - PHP_ERRORMSG_ALIAS, HTTP_RESPONSE_HEADER_ALIAS } zend_ssa_alias_kind; diff --git a/ext/opcache/tests/bug75893.phpt b/ext/opcache/tests/bug75893.phpt deleted file mode 100644 index 670993c50c201..0000000000000 --- a/ext/opcache/tests/bug75893.phpt +++ /dev/null @@ -1,22 +0,0 @@ ---TEST-- -Bug #75893: file_get_contents $http_response_header variable bugged with opcache ---INI-- -opcache.enable_cli=1 -track_errors=1 ---FILE-- - ---EXPECTF-- -Deprecated: Directive 'track_errors' is deprecated in Unknown on line 0 - -Notice: Undefined variable: undef in %s on line %d -string(1) "U" diff --git a/ext/standard/tests/file/parse_ini_file_variation3.phpt b/ext/standard/tests/file/parse_ini_file_variation3.phpt index 96d44433f7045..acdb4d83ebe8e 100644 --- a/ext/standard/tests/file/parse_ini_file_variation3.phpt +++ b/ext/standard/tests/file/parse_ini_file_variation3.phpt @@ -43,7 +43,6 @@ log_errors_max_len = 1024 ignore_repeated_errors = Off ignore_repeated_source = Off report_memleaks = On -track_errors = Off docref_root = "/phpmanual/" docref_ext = .html @@ -77,7 +76,7 @@ foreach($newdirs as $newdir) { --EXPECTF-- *** Testing parse_ini_file() : variation *** New include path is : %sparse_ini_file_variation3.dir1%sparse_ini_file_variation3.dir2%sparse_ini_file_variation3.dir3%S -array(11) { +array(10) { ["error_reporting"]=> string(5) "32767" ["display_errors"]=> @@ -94,8 +93,6 @@ array(11) { string(0) "" ["report_memleaks"]=> string(1) "1" - ["track_errors"]=> - string(0) "" ["docref_root"]=> string(11) "/phpmanual/" ["docref_ext"]=> diff --git a/main/main.c b/main/main.c index 69d5ccc715e46..1e0dc9571e26a 100644 --- a/main/main.c +++ b/main/main.c @@ -731,7 +731,6 @@ PHP_INI_BEGIN() STD_PHP_INI_BOOLEAN("register_argc_argv", "1", PHP_INI_PERDIR|PHP_INI_SYSTEM, OnUpdateBool, register_argc_argv, php_core_globals, core_globals) STD_PHP_INI_BOOLEAN("auto_globals_jit", "1", PHP_INI_PERDIR|PHP_INI_SYSTEM, OnUpdateBool, auto_globals_jit, php_core_globals, core_globals) STD_PHP_INI_BOOLEAN("short_open_tag", DEFAULT_SHORT_OPEN_TAG, PHP_INI_SYSTEM|PHP_INI_PERDIR, OnUpdateBool, short_tags, zend_compiler_globals, compiler_globals) - STD_PHP_INI_BOOLEAN("track_errors", "0", PHP_INI_ALL, OnUpdateBool, track_errors, php_core_globals, core_globals) STD_PHP_INI_ENTRY("unserialize_callback_func", NULL, PHP_INI_ALL, OnUpdateString, unserialize_callback_func, php_core_globals, core_globals) STD_PHP_INI_ENTRY("serialize_precision", "-1", PHP_INI_ALL, OnSetSerializePrecision, serialize_precision, php_core_globals, core_globals) @@ -1095,18 +1094,6 @@ PHPAPI ZEND_COLD void php_verror(const char *docref, const char *params, int typ efree(docref_buf); } - if (PG(track_errors) && module_initialized && EG(active) && - (Z_TYPE(EG(user_error_handler)) == IS_UNDEF || !(EG(user_error_handler_error_reporting) & type))) { - zval tmp; - ZVAL_STRINGL(&tmp, buffer, buffer_len); - if (EG(current_execute_data)) { - if (zend_set_local_var_str("php_errormsg", sizeof("php_errormsg")-1, &tmp, 0) == FAILURE) { - zval_ptr_dtor(&tmp); - } - } else { - zend_hash_str_update_ind(&EG(symbol_table), "php_errormsg", sizeof("php_errormsg")-1, &tmp); - } - } if (replace_buffer) { zend_string_free(replace_buffer); } else { @@ -1414,19 +1401,6 @@ static ZEND_COLD void php_error_cb(int type, const char *error_filename, const u return; } - if (PG(track_errors) && module_initialized && EG(active)) { - zval tmp; - - ZVAL_STRINGL(&tmp, buffer, buffer_len); - if (EG(current_execute_data)) { - if (zend_set_local_var_str("php_errormsg", sizeof("php_errormsg")-1, &tmp, 0) == FAILURE) { - zval_ptr_dtor(&tmp); - } - } else { - zend_hash_str_update_ind(&EG(symbol_table), "php_errormsg", sizeof("php_errormsg")-1, &tmp); - } - } - efree(buffer); } /* }}} */ @@ -2364,13 +2338,12 @@ int php_module_startup(sapi_module_struct *sf, zend_module_entry *additional_mod struct { const long error_level; const char *phrase; - const char *directives[17]; /* Remember to change this if the number of directives change */ + const char *directives[18]; /* Remember to change this if the number of directives change */ } directives[2] = { { E_DEPRECATED, "Directive '%s' is deprecated", { - "track_errors", NULL } }, @@ -2394,6 +2367,7 @@ int php_module_startup(sapi_module_struct *sf, zend_module_entry *additional_mod "safe_mode_allowed_env_vars", "safe_mode_protected_env_vars", "zend.ze1_compatibility_mode", + "track_errors", NULL } } diff --git a/main/php_globals.h b/main/php_globals.h index 077fa1f4bba2f..486d640f7f9df 100644 --- a/main/php_globals.h +++ b/main/php_globals.h @@ -66,7 +66,6 @@ struct _php_core_globals { zend_long memory_limit; zend_long max_input_time; - zend_bool track_errors; zend_bool display_errors; zend_bool display_startup_errors; zend_bool log_errors; diff --git a/php.ini-development b/php.ini-development index 0566267c2f538..64c938ae0d07d 100644 --- a/php.ini-development +++ b/php.ini-development @@ -519,14 +519,6 @@ report_memleaks = On ; This setting is on by default. ;report_zend_debug = 0 -; Store the last error/warning message in $php_errormsg (boolean). -; This directive is DEPRECATED. -; Default Value: Off -; Development Value: Off -; Production Value: Off -; http://php.net/track-errors -;track_errors = Off - ; Turn off normal error reporting and emit XML-RPC error XML ; http://php.net/xmlrpc-errors ;xmlrpc_errors = 0 diff --git a/php.ini-production b/php.ini-production index 9ae24dba2c811..98ab119168f09 100644 --- a/php.ini-production +++ b/php.ini-production @@ -153,11 +153,6 @@ ; Development Value: Off ; Production Value: Off -; track_errors -; Default Value: Off -; Development Value: On -; Production Value: Off - ; variables_order ; Default Value: "EGPCS" ; Development Value: "GPCS" @@ -524,16 +519,6 @@ report_memleaks = On ; This setting is on by default. ;report_zend_debug = 0 -; Store the last error/warning message in $php_errormsg (boolean). Setting this value -; to On can assist in debugging and is appropriate for development servers. It should -; however be disabled on production servers. -; This directive is DEPRECATED. -; Default Value: Off -; Development Value: Off -; Production Value: Off -; http://php.net/track-errors -;track_errors = Off - ; Turn off normal error reporting and emit XML-RPC error XML ; http://php.net/xmlrpc-errors ;xmlrpc_errors = 0 diff --git a/tests/basic/027.phpt b/tests/basic/027.phpt deleted file mode 100644 index 0528e835a1263..0000000000000 --- a/tests/basic/027.phpt +++ /dev/null @@ -1,33 +0,0 @@ ---TEST-- -Handling of max_input_nesting_level being reached ---INI-- -always_populate_raw_post_data=0 -display_errors=0 -max_input_nesting_level=10 -max_input_vars=1000 -track_errors=1 -log_errors=0 ---POST-- -a=1&b=ZYX&c[][][][][][][][][][][][][][][][][][][][][][]=123&d=123&e[][]][]=3 ---FILE-- - ---EXPECT-- -array(4) { - ["a"]=> - string(1) "1" - ["b"]=> - string(3) "ZYX" - ["d"]=> - string(3) "123" - ["e"]=> - array(1) { - [0]=> - array(1) { - [0]=> - string(1) "3" - } - } -} -string(115) "Unknown: Input variable nesting level exceeded 10. To increase the limit change max_input_nesting_level in php.ini." diff --git a/tests/output/bug74815.phpt b/tests/output/bug74815.phpt deleted file mode 100644 index 1d9c82599999c..0000000000000 --- a/tests/output/bug74815.phpt +++ /dev/null @@ -1,19 +0,0 @@ ---TEST-- -Bug #74815 crash with a combination of INI entries at startup ---FILE-- - -==DONE== ---CLEAN-- - ---EXPECTF-- -Deprecated: Directive 'track_errors' is deprecated in Unknown on line 0 -%A -==DONE== diff --git a/tests/run-test/test005.phpt b/tests/run-test/test005.phpt deleted file mode 100644 index a95281fc137e5..0000000000000 --- a/tests/run-test/test005.phpt +++ /dev/null @@ -1,36 +0,0 @@ ---TEST-- -Error message handling (with ZendOpcache) ---SKIPIF-- - ---INI-- -track_errors=1 ---FILE-- - ---EXPECTF-- -Deprecated: Directive 'track_errors' is deprecated in Unknown on line 0 -string(1) "1" -string(5) "32767" -string(1) "0" -string(1) "1" -string(1) "0" -NULL -string(%d) "%sivision by zer%s" diff --git a/tests/run-test/test008.phpt b/tests/run-test/test008.phpt deleted file mode 100644 index c289e7a69688a..0000000000000 --- a/tests/run-test/test008.phpt +++ /dev/null @@ -1,33 +0,0 @@ ---TEST-- -Error message handling (without ZendOpcache) ---SKIPIF-- - ---INI-- -track_errors=1 ---FILE-- - ---EXPECTF-- -Deprecated: Directive 'track_errors' is deprecated in Unknown on line 0 -string(1) "1" -string(5) "32767" -string(1) "0" -string(1) "1" -string(1) "0" -string(%d) "%sivision by zer%s" diff --git a/tests/run-test/test008a.phpt b/tests/run-test/test008a.phpt deleted file mode 100644 index d247eb36c28af..0000000000000 --- a/tests/run-test/test008a.phpt +++ /dev/null @@ -1,36 +0,0 @@ ---TEST-- -Error message handling (with ZendOpcache) ---SKIPIF-- - ---INI-- -track_errors=1 ---FILE-- - ---EXPECTF-- -Deprecated: Directive 'track_errors' is deprecated in Unknown on line 0 -string(1) "1" -string(5) "32767" -string(1) "0" -string(1) "1" -string(1) "0" -NULL -string(%d) "%sivision by zer%s" From 331e56ce38a91e87a6fb8e88154bb5bde445b132 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Mon, 28 Jan 2019 13:13:24 +0100 Subject: [PATCH 12/51] Remove mbstring.func_overload Deprecated in PHP 7.2 as part of https://wiki.php.net/rfc/deprecations_php_7_2. --- Zend/zend_compile.c | 4 +- Zend/zend_compile.h | 3 - ext/mbstring/mbstring.c | 126 +--------------------------- ext/mbstring/mbstring.h | 12 --- ext/mbstring/tests/bug52931.phpt | 25 ------ ext/mbstring/tests/mb_get_info.phpt | 87 +------------------ ext/mbstring/tests/mb_split.phpt | 2 - ext/mbstring/tests/mb_strlen.phpt | 2 - ext/mbstring/tests/mb_substr.phpt | 1 - ext/mbstring/tests/overload01.phpt | 23 ----- ext/mbstring/tests/overload02.phpt | 34 -------- ext/opcache/Optimizer/sccp.c | 9 +- ext/opcache/tests/bug68644.phpt | 18 ---- ext/opcache/tests/bug75729.phpt | 20 ----- php.ini-development | 11 --- php.ini-production | 11 --- 16 files changed, 9 insertions(+), 379 deletions(-) delete mode 100644 ext/mbstring/tests/bug52931.phpt delete mode 100644 ext/mbstring/tests/overload01.phpt delete mode 100644 ext/mbstring/tests/overload02.phpt delete mode 100644 ext/opcache/tests/bug68644.phpt delete mode 100644 ext/opcache/tests/bug75729.phpt diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index 01c90559db7a4..cff2da7011aef 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -3169,9 +3169,7 @@ int zend_compile_func_strlen(znode *result, zend_ast_list *args) /* {{{ */ { znode arg_node; - if ((CG(compiler_options) & ZEND_COMPILE_NO_BUILTIN_STRLEN) - || args->children != 1 - ) { + if (args->children != 1) { return FAILURE; } diff --git a/Zend/zend_compile.h b/Zend/zend_compile.h index 5afdbcc625b55..f46603322ef95 100644 --- a/Zend/zend_compile.h +++ b/Zend/zend_compile.h @@ -1035,9 +1035,6 @@ END_EXTERN_C() /* disable constant substitution at compile-time */ #define ZEND_COMPILE_NO_CONSTANT_SUBSTITUTION (1<<5) -/* disable usage of builtin instruction for strlen() */ -#define ZEND_COMPILE_NO_BUILTIN_STRLEN (1<<6) - /* disable substitution of persistent constants at compile-time */ #define ZEND_COMPILE_NO_PERSISTENT_CONSTANT_SUBSTITUTION (1<<7) diff --git a/ext/mbstring/mbstring.c b/ext/mbstring/mbstring.c index 17df6036dc285..bba2d8ef69f8a 100644 --- a/ext/mbstring/mbstring.c +++ b/ext/mbstring/mbstring.c @@ -174,25 +174,6 @@ static const php_mb_nls_ident_list php_mb_default_identify_list[] = { /* }}} */ -/* {{{ mb_overload_def mb_ovld[] */ -static const struct mb_overload_def mb_ovld[] = { - {MB_OVERLOAD_MAIL, "mail", "mb_send_mail", "mb_orig_mail"}, - {MB_OVERLOAD_STRING, "strlen", "mb_strlen", "mb_orig_strlen"}, - {MB_OVERLOAD_STRING, "strpos", "mb_strpos", "mb_orig_strpos"}, - {MB_OVERLOAD_STRING, "strrpos", "mb_strrpos", "mb_orig_strrpos"}, - {MB_OVERLOAD_STRING, "stripos", "mb_stripos", "mb_orig_stripos"}, - {MB_OVERLOAD_STRING, "strripos", "mb_strripos", "mb_orig_strripos"}, - {MB_OVERLOAD_STRING, "strstr", "mb_strstr", "mb_orig_strstr"}, - {MB_OVERLOAD_STRING, "strrchr", "mb_strrchr", "mb_orig_strrchr"}, - {MB_OVERLOAD_STRING, "stristr", "mb_stristr", "mb_orig_stristr"}, - {MB_OVERLOAD_STRING, "substr", "mb_substr", "mb_orig_substr"}, - {MB_OVERLOAD_STRING, "strtolower", "mb_strtolower", "mb_orig_strtolower"}, - {MB_OVERLOAD_STRING, "strtoupper", "mb_strtoupper", "mb_orig_strtoupper"}, - {MB_OVERLOAD_STRING, "substr_count", "mb_substr_count", "mb_orig_substr_count"}, - {0, NULL, NULL, NULL} -}; -/* }}} */ - /* {{{ arginfo */ ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_language, 0, 0, 0) ZEND_ARG_INFO(0, language) @@ -1486,8 +1467,6 @@ PHP_INI_BEGIN() PHP_INI_ENTRY("mbstring.http_output", NULL, PHP_INI_ALL, OnUpdate_mbstring_http_output) STD_PHP_INI_ENTRY("mbstring.internal_encoding", NULL, PHP_INI_ALL, OnUpdate_mbstring_internal_encoding, internal_encoding_name, zend_mbstring_globals, mbstring_globals) PHP_INI_ENTRY("mbstring.substitute_character", NULL, PHP_INI_ALL, OnUpdate_mbstring_substitute_character) - STD_PHP_INI_ENTRY("mbstring.func_overload", "0", - PHP_INI_SYSTEM, OnUpdateLong, func_overload, zend_mbstring_globals, mbstring_globals) STD_PHP_INI_BOOLEAN("mbstring.encoding_translation", "0", PHP_INI_SYSTEM | PHP_INI_PERDIR, @@ -1535,7 +1514,6 @@ ZEND_TSRMLS_CACHE_UPDATE(); mbstring_globals->current_filter_illegal_mode = MBFL_OUTPUTFILTER_ILLEGAL_MODE_CHAR; mbstring_globals->current_filter_illegal_substchar = 0x3f; /* '?' */ mbstring_globals->illegalchars = 0; - mbstring_globals->func_overload = 0; mbstring_globals->encoding_translation = 0; mbstring_globals->strict_detection = 0; mbstring_globals->outconv = NULL; @@ -1584,10 +1562,6 @@ ZEND_TSRMLS_CACHE_UPDATE(); sapi_register_post_entries(mbstr_post_entries); } - REGISTER_LONG_CONSTANT("MB_OVERLOAD_MAIL", MB_OVERLOAD_MAIL, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MB_OVERLOAD_STRING", MB_OVERLOAD_STRING, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MB_OVERLOAD_REGEX", MB_OVERLOAD_REGEX, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MB_CASE_UPPER", PHP_UNICODE_CASE_UPPER, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("MB_CASE_LOWER", PHP_UNICODE_CASE_LOWER, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("MB_CASE_TITLE", PHP_UNICODE_CASE_TITLE, CONST_CS | CONST_PERSISTENT); @@ -1613,39 +1587,6 @@ ZEND_TSRMLS_CACHE_UPDATE(); php_mb_rfc1867_getword_conf, php_mb_rfc1867_basename); - /* override original function (deprecated). */ - if (MBSTRG(func_overload)){ - zend_function *func, *orig; - const struct mb_overload_def *p; - zend_string *str; - - p = &(mb_ovld[0]); - while (p->type > 0) { - if ((MBSTRG(func_overload) & p->type) == p->type && - !zend_hash_str_exists(CG(function_table), p->save_func, strlen(p->save_func)) - ) { - func = zend_hash_str_find_ptr(CG(function_table), p->ovld_func, strlen(p->ovld_func)); - - if ((orig = zend_hash_str_find_ptr(CG(function_table), p->orig_func, strlen(p->orig_func))) == NULL) { - php_error_docref("ref.mbstring", E_WARNING, "mbstring couldn't find function %s.", p->orig_func); - return FAILURE; - } else { - ZEND_ASSERT(orig->type == ZEND_INTERNAL_FUNCTION); - str = zend_string_init_interned(p->save_func, strlen(p->save_func), 1); - zend_hash_add_mem(CG(function_table), str, orig, sizeof(zend_internal_function)); - zend_string_release_ex(str, 1); - function_add_ref(orig); - - str = zend_string_init_interned(p->orig_func, strlen(p->orig_func), 1); - zend_hash_update_mem(CG(function_table), str, func, sizeof(zend_internal_function)); - zend_string_release_ex(str, 1); - function_add_ref(func); - } - } - p++; - } - } - return SUCCESS; } /* }}} */ @@ -1653,24 +1594,6 @@ ZEND_TSRMLS_CACHE_UPDATE(); /* {{{ PHP_MSHUTDOWN_FUNCTION(mbstring) */ PHP_MSHUTDOWN_FUNCTION(mbstring) { - /* clear overloaded function. */ - if (MBSTRG(func_overload)){ - const struct mb_overload_def *p; - zend_function *orig; - - p = &(mb_ovld[0]); - while (p->type > 0) { - if ((MBSTRG(func_overload) & p->type) == p->type && - (orig = zend_hash_str_find_ptr(CG(function_table), p->save_func, strlen(p->save_func)))) { - - zend_hash_str_update_mem(CG(function_table), p->orig_func, strlen(p->orig_func), orig, sizeof(zend_internal_function)); - function_add_ref(orig); - zend_hash_str_del(CG(function_table), p->save_func, strlen(p->save_func)); - } - p++; - } - } - UNREGISTER_INI_ENTRIES(); zend_multibyte_restore_functions(); @@ -1695,12 +1618,6 @@ PHP_RINIT_FUNCTION(mbstring) php_mb_populate_current_detect_order_list(); - /* override original function. */ - if (MBSTRG(func_overload)){ - zend_error(E_DEPRECATED, "The mbstring.func_overload directive is deprecated"); - - CG(compiler_options) |= ZEND_COMPILE_NO_BUILTIN_STRLEN; - } #if HAVE_MBREGEX PHP_RINIT(mb_regex) (INIT_FUNC_ARGS_PASSTHRU); #endif @@ -2782,11 +2699,6 @@ PHP_FUNCTION(mb_substr) real_len = 0; } - if (((MBSTRG(func_overload) & MB_OVERLOAD_STRING) == MB_OVERLOAD_STRING) - && (real_from > mbfl_strlen(&string))) { - RETURN_FALSE; - } - ret = mbfl_substr(&string, &result, real_from, real_len); if (NULL == ret) { RETURN_FALSE; @@ -4411,8 +4323,7 @@ PHP_FUNCTION(mb_get_info) size_t typ_len; size_t n; char *name; - const struct mb_overload_def *over_func; - zval row1, row2; + zval row; const mbfl_language *lang = mbfl_no2language(MBSTRG(language)); const mbfl_encoding **entry; @@ -4434,20 +4345,6 @@ PHP_FUNCTION(mb_get_info) if ((name = (char *)zend_ini_string("mbstring.http_output_conv_mimetypes", sizeof("mbstring.http_output_conv_mimetypes") - 1, 0)) != NULL) { add_assoc_string(return_value, "http_output_conv_mimetypes", name); } - add_assoc_long(return_value, "func_overload", MBSTRG(func_overload)); - if (MBSTRG(func_overload)){ - over_func = &(mb_ovld[0]); - array_init(&row1); - while (over_func->type > 0) { - if ((MBSTRG(func_overload) & over_func->type) == over_func->type ) { - add_assoc_string(&row1, over_func->orig_func, over_func->ovld_func); - } - over_func++; - } - add_assoc_zval(return_value, "func_overload_list", &row1); - } else { - add_assoc_string(return_value, "func_overload_list", "no overload"); - } if (lang != NULL) { if ((name = (char *)mbfl_no_encoding2name(lang->mail_charset)) != NULL) { add_assoc_string(return_value, "mail_charset", name); @@ -4472,12 +4369,12 @@ PHP_FUNCTION(mb_get_info) entry = MBSTRG(current_detect_order_list); if (n > 0) { size_t i; - array_init(&row2); + array_init(&row); for (i = 0; i < n; i++) { - add_next_index_string(&row2, (*entry)->name); + add_next_index_string(&row, (*entry)->name); entry++; } - add_assoc_zval(return_value, "detect_order", &row2); + add_assoc_zval(return_value, "detect_order", &row); } if (MBSTRG(current_filter_illegal_mode) == MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE) { add_assoc_string(return_value, "substitute_character", "none"); @@ -4509,21 +4406,6 @@ PHP_FUNCTION(mb_get_info) if ((name = (char *)zend_ini_string("mbstring.http_output_conv_mimetypes", sizeof("mbstring.http_output_conv_mimetypes") - 1, 0)) != NULL) { RETVAL_STRING(name); } - } else if (!strcasecmp("func_overload", typ)) { - RETVAL_LONG(MBSTRG(func_overload)); - } else if (!strcasecmp("func_overload_list", typ)) { - if (MBSTRG(func_overload)){ - over_func = &(mb_ovld[0]); - array_init(return_value); - while (over_func->type > 0) { - if ((MBSTRG(func_overload) & over_func->type) == over_func->type ) { - add_assoc_string(return_value, over_func->orig_func, over_func->ovld_func); - } - over_func++; - } - } else { - RETVAL_STRING("no overload"); - } } else if (!strcasecmp("mail_charset", typ)) { if (lang != NULL && (name = (char *)mbfl_no_encoding2name(lang->mail_charset)) != NULL) { RETVAL_STRING(name); diff --git a/ext/mbstring/mbstring.h b/ext/mbstring/mbstring.h index 5c14cf67cb9f3..08434f04672d2 100644 --- a/ext/mbstring/mbstring.h +++ b/ext/mbstring/mbstring.h @@ -155,7 +155,6 @@ ZEND_BEGIN_MODULE_GLOBALS(mbstring) int filter_illegal_substchar; int current_filter_illegal_mode; int current_filter_illegal_substchar; - zend_long func_overload; enum mbfl_no_language language; zend_bool encoding_translation; zend_bool strict_detection; @@ -169,17 +168,6 @@ ZEND_BEGIN_MODULE_GLOBALS(mbstring) const mbfl_encoding *last_used_encoding; ZEND_END_MODULE_GLOBALS(mbstring) -#define MB_OVERLOAD_MAIL 1 -#define MB_OVERLOAD_STRING 2 -#define MB_OVERLOAD_REGEX 4 - -struct mb_overload_def { - int type; - char *orig_func; - char *ovld_func; - char *save_func; -}; - #define MBSTRG(v) ZEND_MODULE_GLOBALS_ACCESSOR(mbstring, v) #if defined(ZTS) && defined(COMPILE_DL_MBSTRING) diff --git a/ext/mbstring/tests/bug52931.phpt b/ext/mbstring/tests/bug52931.phpt deleted file mode 100644 index ab8c8df7235a9..0000000000000 --- a/ext/mbstring/tests/bug52931.phpt +++ /dev/null @@ -1,25 +0,0 @@ ---TEST-- -Bug #52931 (strripos not overloaded with function overloading enabled) ---SKIPIF-- - ---INI-- -mbstring.func_overload = 7 -mbstring.internal_encoding = utf-8 ---FILE-- -Umlauttest öüä'; - -var_dump(strlen($string)); -var_dump(mb_strlen($string)); - -var_dump(strripos($string, '')); -var_dump(mb_strripos($string, '')); - -?> ---EXPECT-- -Deprecated: The mbstring.func_overload directive is deprecated in Unknown on line 0 -int(27) -int(27) -int(20) -int(20) diff --git a/ext/mbstring/tests/mb_get_info.phpt b/ext/mbstring/tests/mb_get_info.phpt index 5b9c0c0aef185..4b08b9943ff5b 100644 --- a/ext/mbstring/tests/mb_get_info.phpt +++ b/ext/mbstring/tests/mb_get_info.phpt @@ -9,7 +9,6 @@ mbstring.internal_encoding=UTF-8 mbstring.http_input=ISO-8859-1 mbstring.http_output=ISO-8859-15 mbstring.http_output_conv_mimetypes=abc -mbstring.func_overload=2 mbstring.detect_order=UTF-8,ISO-8859-15,ISO-8859-1,ASCII mbstring.substitute_character=123 mbstring.strict_detection=1 @@ -24,8 +23,7 @@ foreach (array_keys($result) as $key) { } ?> --EXPECT-- -Deprecated: The mbstring.func_overload directive is deprecated in Unknown on line 0 -array(15) { +array(13) { ["internal_encoding"]=> string(5) "UTF-8" ["http_input"]=> @@ -34,35 +32,6 @@ array(15) { string(11) "ISO-8859-15" ["http_output_conv_mimetypes"]=> string(3) "abc" - ["func_overload"]=> - int(2) - ["func_overload_list"]=> - array(12) { - ["strlen"]=> - string(9) "mb_strlen" - ["strpos"]=> - string(9) "mb_strpos" - ["strrpos"]=> - string(10) "mb_strrpos" - ["stripos"]=> - string(10) "mb_stripos" - ["strripos"]=> - string(11) "mb_strripos" - ["strstr"]=> - string(9) "mb_strstr" - ["strrchr"]=> - string(10) "mb_strrchr" - ["stristr"]=> - string(10) "mb_stristr" - ["substr"]=> - string(9) "mb_substr" - ["strtolower"]=> - string(13) "mb_strtolower" - ["strtoupper"]=> - string(13) "mb_strtoupper" - ["substr_count"]=> - string(15) "mb_substr_count" - } ["mail_charset"]=> string(11) "ISO-2022-KR" ["mail_header_encoding"]=> @@ -99,60 +68,6 @@ string(11) "ISO-8859-15" string(11) "ISO-8859-15" string(3) "abc" string(3) "abc" -int(2) -int(2) -array(12) { - ["strlen"]=> - string(9) "mb_strlen" - ["strpos"]=> - string(9) "mb_strpos" - ["strrpos"]=> - string(10) "mb_strrpos" - ["stripos"]=> - string(10) "mb_stripos" - ["strripos"]=> - string(11) "mb_strripos" - ["strstr"]=> - string(9) "mb_strstr" - ["strrchr"]=> - string(10) "mb_strrchr" - ["stristr"]=> - string(10) "mb_stristr" - ["substr"]=> - string(9) "mb_substr" - ["strtolower"]=> - string(13) "mb_strtolower" - ["strtoupper"]=> - string(13) "mb_strtoupper" - ["substr_count"]=> - string(15) "mb_substr_count" -} -array(12) { - ["strlen"]=> - string(9) "mb_strlen" - ["strpos"]=> - string(9) "mb_strpos" - ["strrpos"]=> - string(10) "mb_strrpos" - ["stripos"]=> - string(10) "mb_stripos" - ["strripos"]=> - string(11) "mb_strripos" - ["strstr"]=> - string(9) "mb_strstr" - ["strrchr"]=> - string(10) "mb_strrchr" - ["stristr"]=> - string(10) "mb_stristr" - ["substr"]=> - string(9) "mb_substr" - ["strtolower"]=> - string(13) "mb_strtolower" - ["strtoupper"]=> - string(13) "mb_strtoupper" - ["substr_count"]=> - string(15) "mb_substr_count" -} string(11) "ISO-2022-KR" string(11) "ISO-2022-KR" string(6) "BASE64" diff --git a/ext/mbstring/tests/mb_split.phpt b/ext/mbstring/tests/mb_split.phpt index 216beec1ccc31..cf4f3e4d26245 100644 --- a/ext/mbstring/tests/mb_split.phpt +++ b/ext/mbstring/tests/mb_split.phpt @@ -6,8 +6,6 @@ extension_loaded('mbstring') or die('skip mbstring not available'); extension_loaded('pcre') or die('skip pcre not available'); function_exists('mb_split') or die("skip mb_split() is not available in this build"); ?> ---INI-- -mbstring.func_overload=0 --FILE-- ---INI-- -mbstring.func_overload=0 --FILE-- --INI-- output_handler= -mbstring.func_overload=0 --FILE-- ---INI-- -output_handler= -mbstring.func_overload=7 -mbstring.internal_encoding=EUC-JP ---FILE-- - ---INI-- -output_handler= -mbstring.func_overload=7 -mbstring.internal_encoding=EUC-JP ---FILE-- - ---EXPECT-- -Deprecated: The mbstring.func_overload directive is deprecated in Unknown on line 0 -EUC-JP -int(10) -int(8) -int(3) -int(29) diff --git a/ext/opcache/Optimizer/sccp.c b/ext/opcache/Optimizer/sccp.c index 0eb042f5f2669..49e3c4f622597 100644 --- a/ext/opcache/Optimizer/sccp.c +++ b/ext/opcache/Optimizer/sccp.c @@ -834,8 +834,7 @@ static inline int ct_eval_func_call( } else if (zend_string_equals_literal(name, "strpos")) { if (Z_TYPE_P(args[0]) != IS_STRING || Z_TYPE_P(args[1]) != IS_STRING - || !Z_STRLEN_P(args[1]) - || (CG(compiler_options) & ZEND_COMPILE_NO_BUILTIN_STRLEN)) { + || !Z_STRLEN_P(args[1])) { return FAILURE; } /* pass */ @@ -914,8 +913,7 @@ static inline int ct_eval_func_call( /* pass */ } else if (zend_string_equals_literal(name, "substr")) { if (Z_TYPE_P(args[0]) != IS_STRING - || Z_TYPE_P(args[1]) != IS_LONG - || (CG(compiler_options) & ZEND_COMPILE_NO_BUILTIN_STRLEN)) { + || Z_TYPE_P(args[1]) != IS_LONG) { return FAILURE; } /* pass */ @@ -959,8 +957,7 @@ static inline int ct_eval_func_call( } else if (zend_string_equals_literal(name, "substr")) { if (Z_TYPE_P(args[0]) != IS_STRING || Z_TYPE_P(args[1]) != IS_LONG - || Z_TYPE_P(args[2]) != IS_LONG - || (CG(compiler_options) & ZEND_COMPILE_NO_BUILTIN_STRLEN)) { + || Z_TYPE_P(args[2]) != IS_LONG) { return FAILURE; } /* pass */ diff --git a/ext/opcache/tests/bug68644.phpt b/ext/opcache/tests/bug68644.phpt deleted file mode 100644 index b82615ac4abb8..0000000000000 --- a/ext/opcache/tests/bug68644.phpt +++ /dev/null @@ -1,18 +0,0 @@ ---TEST-- -Bug #68644 strlen incorrect : mbstring + func_overload=2 + UTF-8 + Opcache ---INI-- -opcache.enable=1 -opcache.enable_cli=1 -mbstring.func_overload=2 -mbstring.internal_encoding=UTF-8 ---SKIPIF-- - ---FILE-- - ---EXPECT-- -Deprecated: The mbstring.func_overload directive is deprecated in Unknown on line 0 -int(6) -int(6) diff --git a/ext/opcache/tests/bug75729.phpt b/ext/opcache/tests/bug75729.phpt deleted file mode 100644 index 81d8f4264be5f..0000000000000 --- a/ext/opcache/tests/bug75729.phpt +++ /dev/null @@ -1,20 +0,0 @@ ---TEST-- -Bug #75729: opcache segfault when installing Bitrix ---SKIPIF-- - ---INI-- -opcache.enable_cli=1 -mbstring.func_overload=2 ---FILE-- - ---EXPECT-- -Deprecated: The mbstring.func_overload directive is deprecated in Unknown on line 0 -int(1) -string(2) "oo" -string(1) "o" diff --git a/php.ini-development b/php.ini-development index 64c938ae0d07d..d7445e6d9b094 100644 --- a/php.ini-development +++ b/php.ini-development @@ -1672,17 +1672,6 @@ zend.assertions = 1 ; http://php.net/mbstring.substitute-character ;mbstring.substitute_character = none -; overload(replace) single byte functions by mbstring functions. -; mail(), ereg(), etc are overloaded by mb_send_mail(), mb_ereg(), -; etc. Possible values are 0,1,2,4 or combination of them. -; For example, 7 for overload everything. -; 0: No overload -; 1: Overload mail() function -; 2: Overload str*() functions -; 4: Overload ereg*() functions -; http://php.net/mbstring.func-overload -;mbstring.func_overload = 0 - ; enable strict encoding detection. ; Default: Off ;mbstring.strict_detection = On diff --git a/php.ini-production b/php.ini-production index 98ab119168f09..5b7f827aa3be8 100644 --- a/php.ini-production +++ b/php.ini-production @@ -1672,17 +1672,6 @@ zend.assertions = -1 ; http://php.net/mbstring.substitute-character ;mbstring.substitute_character = none -; overload(replace) single byte functions by mbstring functions. -; mail(), ereg(), etc are overloaded by mb_send_mail(), mb_ereg(), -; etc. Possible values are 0,1,2,4 or combination of them. -; For example, 7 for overload everything. -; 0: No overload -; 1: Overload mail() function -; 2: Overload str*() functions -; 4: Overload ereg*() functions -; http://php.net/mbstring.func-overload -;mbstring.func_overload = 0 - ; enable strict encoding detection. ; Default: Off ;mbstring.strict_detection = On From ff780feca4f1b2dd5c1b7cf692781070d49df7cb Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Mon, 28 Jan 2019 13:34:36 +0100 Subject: [PATCH 13/51] Require second argument on (mb_)parse_str() This was deprecated in PHP 7.2 as part of https://wiki.php.net/rfc/deprecations_php_7_2. --- Zend/tests/bug73181.phpt | 21 ---------- Zend/tests/dynamic_call_006.phpt | 5 --- Zend/tests/parse_str_with_unpack.phpt | 16 -------- Zend/tests/this_in_mb_parse_str.phpt | 21 ---------- Zend/tests/this_in_parse_str.phpt | 19 --------- ext/mbstring/mbstring.c | 35 +++++------------ ext/mbstring/tests/bug20087.phpt | 21 ---------- ext/mbstring/tests/bug48697.phpt | 9 ++--- ext/mbstring/tests/mb_parse_str.phpt | 25 ------------ ext/mbstring/tests/mb_parse_str02.phpt | 34 ----------------- ext/opcache/Optimizer/zend_optimizer.c | 4 -- ext/standard/basic_functions.c | 2 +- ext/standard/string.c | 36 ++++-------------- ext/standard/tests/strings/bug24208.phpt | 13 ------- ext/standard/tests/strings/bug77439.phpt | 9 ++--- .../tests/strings/parse_str_basic1.phpt | 14 +------ .../tests/strings/parse_str_basic3.phpt | Bin 5634 -> 4347 bytes .../tests/strings/parse_str_error1.phpt | 14 +++---- 18 files changed, 34 insertions(+), 264 deletions(-) delete mode 100644 Zend/tests/bug73181.phpt delete mode 100644 Zend/tests/parse_str_with_unpack.phpt delete mode 100644 Zend/tests/this_in_mb_parse_str.phpt delete mode 100644 Zend/tests/this_in_parse_str.phpt delete mode 100644 ext/mbstring/tests/bug20087.phpt delete mode 100644 ext/standard/tests/strings/bug24208.phpt diff --git a/Zend/tests/bug73181.phpt b/Zend/tests/bug73181.phpt deleted file mode 100644 index 3ab93ebf5b215..0000000000000 --- a/Zend/tests/bug73181.phpt +++ /dev/null @@ -1,21 +0,0 @@ ---TEST-- -Bug #73181: parse_str() without a second argument leads to crash ---FILE-- - ---EXPECTF-- -Deprecated: parse_str(): Calling parse_str() without the result argument is deprecated in %s on line %d -array(2) { - [1]=> - string(0) "" - ["x"]=> - string(0) "" -} diff --git a/Zend/tests/dynamic_call_006.phpt b/Zend/tests/dynamic_call_006.phpt index 058e22fda0d34..a1371eeebefdb 100644 --- a/Zend/tests/dynamic_call_006.phpt +++ b/Zend/tests/dynamic_call_006.phpt @@ -9,9 +9,6 @@ function test() { $func = 'compact'; $func(['a']); - $func = 'parse_str'; - $func('a=b'); - $func = 'get_defined_vars'; $func(); @@ -35,8 +32,6 @@ Warning: Cannot call extract() dynamically in %s on line %d Warning: Cannot call compact() dynamically in %s on line %d -Warning: Cannot call parse_str() with a single argument dynamically in %s on line %d - Warning: Cannot call get_defined_vars() dynamically in %s on line %d Warning: Cannot call assert() with string argument dynamically in %s on line %d diff --git a/Zend/tests/parse_str_with_unpack.phpt b/Zend/tests/parse_str_with_unpack.phpt deleted file mode 100644 index 8daa711374404..0000000000000 --- a/Zend/tests/parse_str_with_unpack.phpt +++ /dev/null @@ -1,16 +0,0 @@ ---TEST-- -Calling parse_str through argument unpacking ---FILE-- - ---EXPECTF-- -Deprecated: parse_str(): Calling parse_str() without the result argument is deprecated in %s on line %d -int(42) diff --git a/Zend/tests/this_in_mb_parse_str.phpt b/Zend/tests/this_in_mb_parse_str.phpt deleted file mode 100644 index 2d5af4794e1da..0000000000000 --- a/Zend/tests/this_in_mb_parse_str.phpt +++ /dev/null @@ -1,21 +0,0 @@ ---TEST-- -$this re-assign in mb_parse_str() ---SKIPIF-- - ---FILE-- - ---EXPECTF-- -Deprecated: mb_parse_str(): Calling mb_parse_str() without the result argument is deprecated in %s on line %d - -Fatal error: Uncaught Error: Cannot re-assign $this in %sthis_in_mb_parse_str.php:3 -Stack trace: -#0 %sthis_in_mb_parse_str.php(3): mb_parse_str('this=42') -#1 %sthis_in_mb_parse_str.php(6): foo() -#2 {main} - thrown in %sthis_in_mb_parse_str.php on line 3 diff --git a/Zend/tests/this_in_parse_str.phpt b/Zend/tests/this_in_parse_str.phpt deleted file mode 100644 index 0bd9064d60d79..0000000000000 --- a/Zend/tests/this_in_parse_str.phpt +++ /dev/null @@ -1,19 +0,0 @@ ---TEST-- -$this re-assign in parse_str() ---FILE-- - ---EXPECTF-- -Deprecated: parse_str(): Calling parse_str() without the result argument is deprecated in %s on line %d - -Fatal error: Uncaught Error: Cannot re-assign $this in %sthis_in_parse_str.php:3 -Stack trace: -#0 %sthis_in_parse_str.php(3): parse_str('this=42') -#1 %sthis_in_parse_str.php(6): foo() -#2 {main} - thrown in %sthis_in_parse_str.php on line 3 diff --git a/ext/mbstring/mbstring.c b/ext/mbstring/mbstring.c index bba2d8ef69f8a..f67fe507cd910 100644 --- a/ext/mbstring/mbstring.c +++ b/ext/mbstring/mbstring.c @@ -203,7 +203,7 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_preferred_mime_name, 0, 0, 1) ZEND_ARG_INFO(0, encoding) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_parse_str, 0, 0, 1) +ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_parse_str, 0, 0, 2) ZEND_ARG_INFO(0, encoded_string) ZEND_ARG_INFO(1, result) ZEND_END_ARG_INFO() @@ -2037,26 +2037,24 @@ PHP_FUNCTION(mb_preferred_mime_name) #define IS_SJIS1(c) ((((c)>=0x81 && (c)<=0x9f) || ((c)>=0xe0 && (c)<=0xf5)) ? 1 : 0) #define IS_SJIS2(c) ((((c)>=0x40 && (c)<=0x7e) || ((c)>=0x80 && (c)<=0xfc)) ? 1 : 0) -/* {{{ proto bool mb_parse_str(string encoded_string [, array result]) +/* {{{ proto bool mb_parse_str(string encoded_string, array &result) Parses GET/POST/COOKIE data and sets global variables */ PHP_FUNCTION(mb_parse_str) { - zval *track_vars_array = NULL; - char *encstr = NULL; + zval *track_vars_array; + char *encstr; size_t encstr_len; php_mb_encoding_handler_info_t info; const mbfl_encoding *detected; track_vars_array = NULL; - if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|z", &encstr, &encstr_len, &track_vars_array) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS(), "sz", &encstr, &encstr_len, &track_vars_array) == FAILURE) { return; } - if (track_vars_array != NULL) { - track_vars_array = zend_try_array_init(track_vars_array); - if (!track_vars_array) { - return; - } + track_vars_array = zend_try_array_init(track_vars_array); + if (!track_vars_array) { + return; } encstr = estrndup(encstr, encstr_len); @@ -2070,22 +2068,7 @@ PHP_FUNCTION(mb_parse_str) info.num_from_encodings = MBSTRG(http_input_list_size); info.from_language = MBSTRG(language); - if (track_vars_array != NULL) { - detected = _php_mb_encoding_handler_ex(&info, track_vars_array, encstr); - } else { - zval tmp; - zend_array *symbol_table; - if (zend_forbid_dynamic_call("mb_parse_str() with a single argument") == FAILURE) { - efree(encstr); - return; - } - - php_error_docref(NULL, E_DEPRECATED, "Calling mb_parse_str() without the result argument is deprecated"); - - symbol_table = zend_rebuild_symbol_table(); - ZVAL_ARR(&tmp, symbol_table); - detected = _php_mb_encoding_handler_ex(&info, &tmp, encstr); - } + detected = _php_mb_encoding_handler_ex(&info, track_vars_array, encstr); MBSTRG(http_input_identify) = detected; diff --git a/ext/mbstring/tests/bug20087.phpt b/ext/mbstring/tests/bug20087.phpt deleted file mode 100644 index fc5e589bd2136..0000000000000 --- a/ext/mbstring/tests/bug20087.phpt +++ /dev/null @@ -1,21 +0,0 @@ ---TEST-- -Bug #20087 (Assertion failure) ---SKIPIF-- - ---FILE-- - ---EXPECT-- -ERR: Deprecated -bool(true) -string(0) "" -ERR: Deprecated -bool(true) -string(3) "moo" diff --git a/ext/mbstring/tests/bug48697.phpt b/ext/mbstring/tests/bug48697.phpt index 93644a5f05c56..77d1c7a710276 100644 --- a/ext/mbstring/tests/bug48697.phpt +++ b/ext/mbstring/tests/bug48697.phpt @@ -2,8 +2,6 @@ Bug #48697 (mb_internal_encoding() value gets reset by parse_str() or mb_parse_str() --SKIPIF-- ---INI-- -error_reporting=E_ALL & ~E_DEPRECATED --FILE-- ---EXPECT-- +--EXPECTF-- +Deprecated: ini_set(): Use of mbstring.internal_encoding is deprecated in %s on line %d string(11) "ISO-8859-15" string(5) "UTF-8" string(5) "UTF-8" diff --git a/ext/mbstring/tests/mb_parse_str.phpt b/ext/mbstring/tests/mb_parse_str.phpt index 8580ac52c5af9..ab504f918f156 100644 --- a/ext/mbstring/tests/mb_parse_str.phpt +++ b/ext/mbstring/tests/mb_parse_str.phpt @@ -18,9 +18,6 @@ function test($query) { var_dump($array); var_dump($foo); var_dump($bar); - mb_parse_str($query); - var_dump($foo); - var_dump($bar); } foreach ($queries as $query) { test($query); @@ -35,10 +32,6 @@ array(2) { } string(0) "" string(0) "" - -Deprecated: mb_parse_str(): Calling mb_parse_str() without the result argument is deprecated in %s on line %d -string(3) "abc" -string(3) "def" array(2) { ["+foo"]=> string(3) "def" @@ -47,10 +40,6 @@ array(2) { } string(0) "" string(0) "" - -Deprecated: mb_parse_str(): Calling mb_parse_str() without the result argument is deprecated in %s on line %d -string(0) "" -string(0) "" array(2) { ["foo"]=> array(3) { @@ -69,17 +58,3 @@ array(2) { } string(0) "" string(0) "" - -Deprecated: mb_parse_str(): Calling mb_parse_str() without the result argument is deprecated in %s on line %d -array(3) { - [0]=> - string(3) "abc" - [1]=> - string(3) "def" - [2]=> - string(3) "ghi" -} -array(1) { - [0]=> - string(3) "jkl" -} diff --git a/ext/mbstring/tests/mb_parse_str02.phpt b/ext/mbstring/tests/mb_parse_str02.phpt index e1871bf596361..bad388ee90025 100644 --- a/ext/mbstring/tests/mb_parse_str02.phpt +++ b/ext/mbstring/tests/mb_parse_str02.phpt @@ -20,10 +20,6 @@ function test($query) { var_dump($foo); var_dump($bar); var_dump($fubar); - mb_parse_str($query); - var_dump($foo); - var_dump($bar); - var_dump($fubar); } foreach ($queries as $query) { test($query); @@ -41,11 +37,6 @@ array(3) { string(0) "" string(0) "" string(0) "" - -Deprecated: mb_parse_str(): Calling mb_parse_str() without the result argument is deprecated in %s on line %d -string(3) "abc" -string(3) "def" -string(3) "ghi" array(3) { ["+foo"]=> string(3) "def" @@ -57,11 +48,6 @@ array(3) { string(0) "" string(0) "" string(0) "" - -Deprecated: mb_parse_str(): Calling mb_parse_str() without the result argument is deprecated in %s on line %d -string(0) "" -string(0) "" -string(0) "" array(3) { ["foo"]=> array(4) { @@ -88,23 +74,3 @@ array(3) { string(0) "" string(0) "" string(0) "" - -Deprecated: mb_parse_str(): Calling mb_parse_str() without the result argument is deprecated in %s on line %d -array(4) { - [0]=> - string(3) "abc" - [1]=> - string(3) "def" - [2]=> - string(3) "ghi" - [3]=> - string(0) "" -} -array(1) { - [0]=> - string(0) "" -} -array(1) { - [0]=> - string(1) "=" -} diff --git a/ext/opcache/Optimizer/zend_optimizer.c b/ext/opcache/Optimizer/zend_optimizer.c index 22868a4c21be5..0fb10c4408516 100644 --- a/ext/opcache/Optimizer/zend_optimizer.c +++ b/ext/opcache/Optimizer/zend_optimizer.c @@ -964,10 +964,6 @@ uint32_t zend_optimizer_classify_function(zend_string *name, uint32_t num_args) return ZEND_FUNC_INDIRECT_VAR_ACCESS; } else if (zend_string_equals_literal(name, "compact")) { return ZEND_FUNC_INDIRECT_VAR_ACCESS; - } else if (zend_string_equals_literal(name, "parse_str") && num_args <= 1) { - return ZEND_FUNC_INDIRECT_VAR_ACCESS; - } else if (zend_string_equals_literal(name, "mb_parse_str") && num_args <= 1) { - return ZEND_FUNC_INDIRECT_VAR_ACCESS; } else if (zend_string_equals_literal(name, "get_defined_vars")) { return ZEND_FUNC_INDIRECT_VAR_ACCESS; } else if (zend_string_equals_literal(name, "assert")) { diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c index 4a5a98e3b4f22..d77ef73ca035a 100644 --- a/ext/standard/basic_functions.c +++ b/ext/standard/basic_functions.c @@ -2394,7 +2394,7 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_setlocale, 0, 0, 2) ZEND_ARG_VARIADIC_INFO(0, locales) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_parse_str, 0, 0, 1) +ZEND_BEGIN_ARG_INFO_EX(arginfo_parse_str, 0, 0, 2) ZEND_ARG_INFO(0, encoded_string) ZEND_ARG_INFO(1, result) ZEND_END_ARG_INFO() diff --git a/ext/standard/string.c b/ext/standard/string.c index 7a8e54ad5925c..068c6e82c4465 100644 --- a/ext/standard/string.c +++ b/ext/standard/string.c @@ -4911,7 +4911,7 @@ PHP_FUNCTION(setlocale) } /* }}} */ -/* {{{ proto void parse_str(string encoded_string [, array &result]) +/* {{{ proto void parse_str(string encoded_string, array &result) Parses GET/POST/COOKIE data and sets global variables */ PHP_FUNCTION(parse_str) { @@ -4920,38 +4920,18 @@ PHP_FUNCTION(parse_str) char *res = NULL; size_t arglen; - ZEND_PARSE_PARAMETERS_START(1, 2) + ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_STRING(arg, arglen) - Z_PARAM_OPTIONAL Z_PARAM_ZVAL(arrayArg) ZEND_PARSE_PARAMETERS_END(); - res = estrndup(arg, arglen); - - if (arrayArg == NULL) { - zval tmp; - zend_array *symbol_table; - if (zend_forbid_dynamic_call("parse_str() with a single argument") == FAILURE) { - efree(res); - return; - } - - php_error_docref(NULL, E_DEPRECATED, "Calling parse_str() without the result argument is deprecated"); - - symbol_table = zend_rebuild_symbol_table(); - ZVAL_ARR(&tmp, symbol_table); - sapi_module.treat_data(PARSE_STRING, res, &tmp); - if (UNEXPECTED(zend_hash_del(symbol_table, ZSTR_KNOWN(ZEND_STR_THIS)) == SUCCESS)) { - zend_throw_error(NULL, "Cannot re-assign $this"); - } - } else { - arrayArg = zend_try_array_init(arrayArg); - if (!arrayArg) { - return; - } - - sapi_module.treat_data(PARSE_STRING, res, arrayArg); + arrayArg = zend_try_array_init(arrayArg); + if (!arrayArg) { + return; } + + res = estrndup(arg, arglen); + sapi_module.treat_data(PARSE_STRING, res, arrayArg); } /* }}} */ diff --git a/ext/standard/tests/strings/bug24208.phpt b/ext/standard/tests/strings/bug24208.phpt deleted file mode 100644 index f85c9c1e54e65..0000000000000 --- a/ext/standard/tests/strings/bug24208.phpt +++ /dev/null @@ -1,13 +0,0 @@ ---TEST-- -Bug #24208 (parse_str() is not working) ---FILE-- - ---EXPECTF-- -Deprecated: parse_str(): Calling parse_str() without the result argument is deprecated in %s on line %d -string(1) "1" -string(1) "2" -string(1) "3" diff --git a/ext/standard/tests/strings/bug77439.phpt b/ext/standard/tests/strings/bug77439.phpt index ee8a3d2845212..98ae56222bf88 100644 --- a/ext/standard/tests/strings/bug77439.phpt +++ b/ext/standard/tests/strings/bug77439.phpt @@ -2,12 +2,11 @@ Bug #77439: parse_str segfaults when inserting item into existing array --FILE-- []]; +parse_str('a[1]=1', $vars); +var_dump($vars['a']); ?> ---EXPECTF-- -Deprecated: parse_str(): Calling parse_str() without the result argument is deprecated in %s on line %d +--EXPECT-- array(1) { [1]=> string(1) "1" diff --git a/ext/standard/tests/strings/parse_str_basic1.phpt b/ext/standard/tests/strings/parse_str_basic1.phpt index b3f2fe5cfc77e..e442c0fd70a41 100644 --- a/ext/standard/tests/strings/parse_str_basic1.phpt +++ b/ext/standard/tests/strings/parse_str_basic1.phpt @@ -3,18 +3,13 @@ Test parse_str() function : basic functionality --FILE-- r%HLs3BVo_0IrGlCYke;~rz-Bq7O?wAn%6 G5Gw%Rj}Ybn delta 1067 zcmcIjK}+L66ecZ&WmFb+!JGOFsWcG9Y4os`>cRD->}?NAE%Mrq8knYKX5uO$0gs-P z{0xtU#bf;k3;rB0`;uaE!J!CHzq;us z7uJtC*R8N4RC}$c-7Pu$fzrkU2Wd2DG?RXQrYEgCE0NaJ_Rqi^g2uLhFnys0aU5t9 zga<%50&GaJ8`>4-AXMQCJv7yv<~G*qRbKWN(zuUOi{#d_KaLm2v{)Q=!o>mABb1SV zXKD_&J+7Rsm-w>BxyQ>M_o>Grk1DYuhFw%z>}jJ)1dK|Mb21vejeJ~)8T%@_N;J`k z)*3vVao1oIrA+%CSefz$% z!-x*0Ecq_!)o9u*9yCJVrwpLBT(7QE9N9&R+9|@vkX1ULX`Er@F>Hk}iQ3rgjQy4A zzuC2G)JyjHOREV^O_M`rd%r&fxzsB0GuJk>%6qEYenQ^&Q!{P<^~QZ09sHNrY{Wb1 Se~|FW&&fu9vbQzytMCVsfl^ff diff --git a/ext/standard/tests/strings/parse_str_error1.phpt b/ext/standard/tests/strings/parse_str_error1.phpt index 9683a7d901bfa..939bd7134ea34 100644 --- a/ext/standard/tests/strings/parse_str_error1.phpt +++ b/ext/standard/tests/strings/parse_str_error1.phpt @@ -4,16 +4,16 @@ Test parse_str() function : non-default arg_separator.input specified arg_separator.input = "/" --FILE-- Date: Mon, 28 Jan 2019 16:05:02 +0100 Subject: [PATCH 14/51] Add UPGRADING entries for removed functionality --- UPGRADING | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/UPGRADING b/UPGRADING index 448466ef0e89b..ca9a13429d55d 100644 --- a/UPGRADING +++ b/UPGRADING @@ -21,7 +21,9 @@ PHP 8.0 UPGRADE NOTES ======================================== - Core: - . TBD + . Removed track_errors ini directive. This means that $php_errormsg is no + longer available. The error_get_last() function may be used instead. + . Removed create_function(). Anonymous functions may be used instead. - GD: . The deprecated function image2wbmp() has been removed. @@ -29,10 +31,24 @@ PHP 8.0 UPGRADE NOTES . The deprecated functions png2wbmp() and jpeg2wbmp() have been removed. RFC: https://wiki.php.net/rfc/deprecate-png-jpeg-2wbmp +- GMP: + . gmp_random() has been removed. One of gmp_random_range() or + gmp_random_bits() should be used instead. + - Intl: . The deprecated constant INTL_IDNA_VARIANT_2003 has been removed. RFC: https://wiki.php.net/rfc/deprecate-and-remove-intl_idna_variant_2003 +- Mbstring: + . The mbstring.func_overload directive has been removed. The related + MB_OVERLOAD_MAIL, MB_OVERLOAD_STRING, and MB_OVERLOAD_REGEX constants have + also been removed. Finally, the "func_overload" and "func_overload_list" + entries in mb_get_info() have been removed. + . mb_parse_str() can no longer be used without specifying a result array. + +- Standard: + . parse_str() can no longer be used without specifying a result array. + ======================================== 2. New Features ======================================== From eeb7511f930a932cf6fb5ae40884eb50790a53ec Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Mon, 28 Jan 2019 16:36:43 +0100 Subject: [PATCH 15/51] Fix session test after version bump --- ext/session/tests/session_regenerate_id_cookie.phpt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext/session/tests/session_regenerate_id_cookie.phpt b/ext/session/tests/session_regenerate_id_cookie.phpt index 9558beb814fae..880a41e6d8300 100644 --- a/ext/session/tests/session_regenerate_id_cookie.phpt +++ b/ext/session/tests/session_regenerate_id_cookie.phpt @@ -64,7 +64,7 @@ echo "Done"; ?> --EXPECTF-- *** Testing session_regenerate_id() : basic functionality for cookie *** -string(%d) "X-Powered-By: PHP/7.%s +string(%d) "X-Powered-By: PHP/%d.%d.%s Expires: %s Cache-Control: no-store, no-cache, must-revalidate Pragma: no-cache From 34898e97663084c45b71385ef886e830e023da93 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Tue, 29 Jan 2019 09:39:12 +0100 Subject: [PATCH 16/51] Make special assert() handling independent of compiler flags --- Zend/zend_compile.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index 46ca21a4367b4..7c02f05e78bdc 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -3630,7 +3630,7 @@ int zend_compile_func_cuf(znode *result, zend_ast_list *args, zend_string *lcnam } /* }}} */ -static int zend_compile_assert(znode *result, zend_ast_list *args, zend_string *name, zend_function *fbc) /* {{{ */ +static void zend_compile_assert(znode *result, zend_ast_list *args, zend_string *name, zend_function *fbc) /* {{{ */ { if (EG(assertions) >= 0) { znode name_node; @@ -3673,8 +3673,6 @@ static int zend_compile_assert(znode *result, zend_ast_list *args, zend_string * result->op_type = IS_CONST; ZVAL_TRUE(&result->u.constant); } - - return SUCCESS; } /* }}} */ @@ -3882,10 +3880,6 @@ int zend_try_compile_special_func(znode *result, zend_string *lcname, zend_ast_l return FAILURE; } - if (zend_string_equals_literal(lcname, "assert")) { - return zend_compile_assert(result, args, lcname, fbc); - } - if (CG(compiler_options) & ZEND_COMPILE_NO_BUILTINS) { return FAILURE; } @@ -3988,8 +3982,16 @@ void zend_compile_call(znode *result, zend_ast *ast, uint32_t type) /* {{{ */ zend_op *opline; lcname = zend_string_tolower(Z_STR_P(name)); - fbc = zend_hash_find_ptr(CG(function_table), lcname); + + /* Special assert() handling should apply independently of compiler flags. */ + if (fbc && zend_string_equals_literal(lcname, "assert")) { + zend_compile_assert(result, zend_ast_get_list(args_ast), lcname, fbc); + zend_string_release(lcname); + zval_ptr_dtor(&name_node.u.constant); + return; + } + if (!fbc || (fbc->type == ZEND_INTERNAL_FUNCTION && (CG(compiler_options) & ZEND_COMPILE_IGNORE_INTERNAL_FUNCTIONS)) || (fbc->type == ZEND_USER_FUNCTION && (CG(compiler_options) & ZEND_COMPILE_IGNORE_USER_FUNCTIONS)) From 9bc2cacf7f97b4fc235baa29d7c8cf7604fb39c1 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Mon, 28 Jan 2019 16:35:04 +0100 Subject: [PATCH 17/51] Remove special treatment of strings in asserts This was deprecated in PHP 7.2 as part of https://wiki.php.net/rfc/deprecations_php_7_2. --- UPGRADING | 5 ++ Zend/tests/assert/bug70208.phpt | 24 ------ .../indirect_var_access_misoptimization.phpt | 21 ----- Zend/tests/dynamic_call_006.phpt | 5 -- ext/opcache/Optimizer/zend_optimizer.c | 2 - ext/standard/assert.c | 81 ++----------------- ext/standard/tests/assert/assert.phpt | 23 +++--- ext/standard/tests/assert/assert02.phpt | 64 --------------- ext/standard/tests/assert/assert03.phpt | 25 +++--- ext/standard/tests/assert/assert04.phpt | 1 - ext/standard/tests/assert/assert_basic.phpt | 19 +---- ext/standard/tests/assert/assert_basic1.phpt | 11 +-- ext/standard/tests/assert/assert_basic2.phpt | 1 - ext/standard/tests/assert/assert_basic3.phpt | 8 +- ext/standard/tests/assert/assert_basic4.phpt | 5 -- ext/standard/tests/assert/assert_basic5.phpt | 13 +-- ext/standard/tests/assert/assert_basic6.phpt | 27 ------- .../tests/assert/assert_closures.phpt | 1 - ext/standard/tests/assert/assert_error.phpt | 31 ------- ext/standard/tests/assert/assert_error1.phpt | 8 +- ext/standard/tests/assert/assert_error2.phpt | 15 +--- ext/standard/tests/assert/assert_error3.phpt | 27 ------- ext/standard/tests/assert/assert_error4.phpt | 28 ------- .../tests/assert/assert_variation.phpt | 36 +++------ ext/standard/tests/assert/bug73303.phpt | 24 ------ php.ini-development | 5 -- php.ini-production | 5 -- tests/lang/bug23922.phpt | 21 ----- 28 files changed, 54 insertions(+), 482 deletions(-) delete mode 100644 Zend/tests/assert/bug70208.phpt delete mode 100644 Zend/tests/assert/indirect_var_access_misoptimization.phpt delete mode 100644 ext/standard/tests/assert/assert02.phpt delete mode 100644 ext/standard/tests/assert/assert_basic6.phpt delete mode 100644 ext/standard/tests/assert/assert_error.phpt delete mode 100644 ext/standard/tests/assert/assert_error3.phpt delete mode 100644 ext/standard/tests/assert/assert_error4.phpt delete mode 100644 ext/standard/tests/assert/bug73303.phpt delete mode 100644 tests/lang/bug23922.phpt diff --git a/UPGRADING b/UPGRADING index ca9a13429d55d..d58780964857a 100644 --- a/UPGRADING +++ b/UPGRADING @@ -47,6 +47,11 @@ PHP 8.0 UPGRADE NOTES . mb_parse_str() can no longer be used without specifying a result array. - Standard: + . assert() will no longer evaluate string arguments, instead they will be + treated like any other argument. assert($a == $b) should be used instead of + assert('$a == $b'). The assert.quiet_eval ini directive and + ASSERT_QUIET_EVAL constants have also been removed, as they would no longer + have any effect. . parse_str() can no longer be used without specifying a result array. ======================================== diff --git a/Zend/tests/assert/bug70208.phpt b/Zend/tests/assert/bug70208.phpt deleted file mode 100644 index 6b7dfaeb338b2..0000000000000 --- a/Zend/tests/assert/bug70208.phpt +++ /dev/null @@ -1,24 +0,0 @@ ---TEST-- -Bug #70208 (scope information must be preserved with assert()) ---FILE-- -prop); - } -} - -new test; - -?> ---EXPECTF-- -Deprecated: assert(): Calling assert() with a string argument is deprecated in %s on line %d -int(1) diff --git a/Zend/tests/assert/indirect_var_access_misoptimization.phpt b/Zend/tests/assert/indirect_var_access_misoptimization.phpt deleted file mode 100644 index 02327f30c0266..0000000000000 --- a/Zend/tests/assert/indirect_var_access_misoptimization.phpt +++ /dev/null @@ -1,21 +0,0 @@ ---TEST-- -Misoptimization when variable is modified by assert() ---INI-- -zend.assertions=1 ---FILE-- - ---EXPECTF-- -Deprecated: assert(): Calling assert() with a string argument is deprecated in %s on line %d - -Notice: Object of class stdClass could not be converted to number in %s on line %d -int(2) diff --git a/Zend/tests/dynamic_call_006.phpt b/Zend/tests/dynamic_call_006.phpt index a1371eeebefdb..7a2872bccac34 100644 --- a/Zend/tests/dynamic_call_006.phpt +++ b/Zend/tests/dynamic_call_006.phpt @@ -12,9 +12,6 @@ function test() { $func = 'get_defined_vars'; $func(); - $func = 'assert'; - $func('1==2'); - $func = 'func_get_args'; $func(); @@ -34,8 +31,6 @@ Warning: Cannot call compact() dynamically in %s on line %d Warning: Cannot call get_defined_vars() dynamically in %s on line %d -Warning: Cannot call assert() with string argument dynamically in %s on line %d - Warning: Cannot call func_get_args() dynamically in %s on line %d Warning: Cannot call func_get_arg() dynamically in %s on line %d diff --git a/ext/opcache/Optimizer/zend_optimizer.c b/ext/opcache/Optimizer/zend_optimizer.c index 0fb10c4408516..5c4acad817d04 100644 --- a/ext/opcache/Optimizer/zend_optimizer.c +++ b/ext/opcache/Optimizer/zend_optimizer.c @@ -966,8 +966,6 @@ uint32_t zend_optimizer_classify_function(zend_string *name, uint32_t num_args) return ZEND_FUNC_INDIRECT_VAR_ACCESS; } else if (zend_string_equals_literal(name, "get_defined_vars")) { return ZEND_FUNC_INDIRECT_VAR_ACCESS; - } else if (zend_string_equals_literal(name, "assert")) { - return ZEND_FUNC_INDIRECT_VAR_ACCESS; } else if (zend_string_equals_literal(name, "func_num_args")) { return ZEND_FUNC_VARARG; } else if (zend_string_equals_literal(name, "func_get_arg")) { diff --git a/ext/standard/assert.c b/ext/standard/assert.c index 005fda4b5647d..d9f4fb99996f0 100644 --- a/ext/standard/assert.c +++ b/ext/standard/assert.c @@ -29,7 +29,6 @@ ZEND_BEGIN_MODULE_GLOBALS(assert) zend_bool active; zend_bool bail; zend_bool warning; - zend_bool quiet_eval; zend_bool exception; ZEND_END_MODULE_GLOBALS(assert) @@ -46,7 +45,6 @@ enum { ASSERT_CALLBACK, ASSERT_BAIL, ASSERT_WARNING, - ASSERT_QUIET_EVAL, ASSERT_EXCEPTION }; @@ -81,7 +79,6 @@ PHP_INI_BEGIN() STD_PHP_INI_ENTRY("assert.bail", "0", PHP_INI_ALL, OnUpdateBool, bail, zend_assert_globals, assert_globals) STD_PHP_INI_ENTRY("assert.warning", "1", PHP_INI_ALL, OnUpdateBool, warning, zend_assert_globals, assert_globals) PHP_INI_ENTRY("assert.callback", NULL, PHP_INI_ALL, OnChangeCallback) - STD_PHP_INI_ENTRY("assert.quiet_eval", "0", PHP_INI_ALL, OnUpdateBool, quiet_eval, zend_assert_globals, assert_globals) STD_PHP_INI_ENTRY("assert.exception", "0", PHP_INI_ALL, OnUpdateBool, exception, zend_assert_globals, assert_globals) PHP_INI_END() @@ -104,7 +101,6 @@ PHP_MINIT_FUNCTION(assert) /* {{{ */ REGISTER_LONG_CONSTANT("ASSERT_CALLBACK", ASSERT_CALLBACK, CONST_CS|CONST_PERSISTENT); REGISTER_LONG_CONSTANT("ASSERT_BAIL", ASSERT_BAIL, CONST_CS|CONST_PERSISTENT); REGISTER_LONG_CONSTANT("ASSERT_WARNING", ASSERT_WARNING, CONST_CS|CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("ASSERT_QUIET_EVAL", ASSERT_QUIET_EVAL, CONST_CS|CONST_PERSISTENT); REGISTER_LONG_CONSTANT("ASSERT_EXCEPTION", ASSERT_EXCEPTION, CONST_CS|CONST_PERSISTENT); INIT_CLASS_ENTRY(ce, "AssertionError", NULL); @@ -147,9 +143,6 @@ PHP_FUNCTION(assert) { zval *assertion; zval *description = NULL; - int val; - char *myeval = NULL; - char *compiled_string_description; if (! ASSERTG(active)) { RETURN_TRUE; @@ -161,51 +154,7 @@ PHP_FUNCTION(assert) Z_PARAM_ZVAL(description) ZEND_PARSE_PARAMETERS_END(); - if (Z_TYPE_P(assertion) == IS_STRING) { - zval retval; - int old_error_reporting = 0; /* shut up gcc! */ - - if (zend_forbid_dynamic_call("assert() with string argument") == FAILURE) { - RETURN_FALSE; - } - - php_error_docref(NULL, E_DEPRECATED, "Calling assert() with a string argument is deprecated"); - - myeval = Z_STRVAL_P(assertion); - - if (ASSERTG(quiet_eval)) { - old_error_reporting = EG(error_reporting); - EG(error_reporting) = 0; - } - - compiled_string_description = zend_make_compiled_string_description("assert code"); - if (zend_eval_stringl(myeval, Z_STRLEN_P(assertion), &retval, compiled_string_description) == FAILURE) { - efree(compiled_string_description); - if (!description) { - zend_throw_error(NULL, "Failure evaluating code: %s%s", PHP_EOL, myeval); - } else { - zend_string *str = zval_get_string(description); - zend_throw_error(NULL, "Failure evaluating code: %s%s:\"%s\"", PHP_EOL, ZSTR_VAL(str), myeval); - zend_string_release_ex(str, 0); - } - if (ASSERTG(bail)) { - zend_bailout(); - } - RETURN_FALSE; - } - efree(compiled_string_description); - - if (ASSERTG(quiet_eval)) { - EG(error_reporting) = old_error_reporting; - } - - convert_to_boolean(&retval); - val = Z_TYPE(retval) == IS_TRUE; - } else { - val = zend_is_true(assertion); - } - - if (val) { + if (zend_is_true(assertion)) { RETURN_TRUE; } @@ -220,8 +169,8 @@ PHP_FUNCTION(assert) const char *filename = zend_get_executed_filename(); ZVAL_STRING(&args[0], SAFE_STRING(filename)); - ZVAL_LONG (&args[1], lineno); - ZVAL_STRING(&args[2], SAFE_STRING(myeval)); + ZVAL_LONG(&args[1], lineno); + ZVAL_NULL(&args[2]); ZVAL_FALSE(&retval); @@ -255,18 +204,10 @@ PHP_FUNCTION(assert) } } else if (ASSERTG(warning)) { if (!description) { - if (myeval) { - php_error_docref(NULL, E_WARNING, "Assertion \"%s\" failed", myeval); - } else { - php_error_docref(NULL, E_WARNING, "Assertion failed"); - } + php_error_docref(NULL, E_WARNING, "Assertion failed"); } else { zend_string *str = zval_get_string(description); - if (myeval) { - php_error_docref(NULL, E_WARNING, "%s: \"%s\" failed", ZSTR_VAL(str), myeval); - } else { - php_error_docref(NULL, E_WARNING, "%s failed", ZSTR_VAL(str)); - } + php_error_docref(NULL, E_WARNING, "%s failed", ZSTR_VAL(str)); zend_string_release_ex(str, 0); } } @@ -320,18 +261,6 @@ PHP_FUNCTION(assert_options) RETURN_LONG(oldint); break; - case ASSERT_QUIET_EVAL: - oldint = ASSERTG(quiet_eval); - if (ac == 2) { - zend_string *value_str = zval_get_string(value); - key = zend_string_init("assert.quiet_eval", sizeof("assert.quiet_eval")-1, 0); - zend_alter_ini_entry_ex(key, value_str, PHP_INI_USER, PHP_INI_STAGE_RUNTIME, 0); - zend_string_release_ex(key, 0); - zend_string_release_ex(value_str, 0); - } - RETURN_LONG(oldint); - break; - case ASSERT_WARNING: oldint = ASSERTG(warning); if (ac == 2) { diff --git a/ext/standard/tests/assert/assert.phpt b/ext/standard/tests/assert/assert.phpt index 08e1188d60cf8..71b0649141e99 100644 --- a/ext/standard/tests/assert/assert.phpt +++ b/ext/standard/tests/assert/assert.phpt @@ -1,44 +1,41 @@ --TEST-- assert() --INI-- -error_reporting = 2039 assert.active = 0 assert.warning = 1 assert.callback = assert.bail = 0 -assert.quiet_eval = 0 --FILE-- --EXPECT-- -assertion failed 22,"$a != 0" -class assertion failed 25,"$a != 0" -class assertion failed 29,"$a != 0" +assertion failed 21,"assert($a != 0)" +class assertion failed 24,"assert($a != 0)" +class assertion failed 28,"assert($a != 0)" diff --git a/ext/standard/tests/assert/assert02.phpt b/ext/standard/tests/assert/assert02.phpt deleted file mode 100644 index 85b72369cba74..0000000000000 --- a/ext/standard/tests/assert/assert02.phpt +++ /dev/null @@ -1,64 +0,0 @@ ---TEST-- -catch assert() errors ---INI-- -assert.active=1 -assert.warning=1 -assert.callback= -assert.bail=0 -assert.quiet_eval=0 ---FILE-- -getMessage(), "\n"; -} - -assert('0'); - -assert_options(ASSERT_BAIL, 1); - -try { - assert('aa=sd+as+safsafasfasafsaf'); -} catch (Throwable $e) { - echo $e->getMessage(), "\n"; -} - -echo "done\n"; - -?> ---EXPECTF-- -Deprecated: assert(): Calling assert() with a string argument is deprecated in %s on line %d - -Deprecated: assert(): Calling assert() with a string argument is deprecated in %s on line %d - -Notice: Undefined variable: a in %sassert02.php(%d) : assert code on line 1 - -Warning: assert(): Assertion "$a" failed in %sassert02.php on line %d - -Deprecated: assert(): Calling assert() with a string argument is deprecated in %s on line %d -Failure evaluating code: -aa=sd+as+safsafasfasafsaf - -Deprecated: assert(): Calling assert() with a string argument is deprecated in %s on line %d - -Warning: assert(): Assertion "0" failed in %sassert02.php on line %d - -Deprecated: assert(): Calling assert() with a string argument is deprecated in %s on line %d - -Fatal error: Uncaught ParseError: syntax error, unexpected '=', expecting ';' in %s(%d) : assert code:1 -Stack trace: -#0 %s(%d): assert('aa=sd+as+safsaf...') -#1 {main} - -Next Error: Failure evaluating code: -aa=sd+as+safsafasfasafsaf in %s:%d -Stack trace: -#0 %s(%d): assert('aa=sd+as+safsaf...') -#1 {main} - thrown in %s on line %d diff --git a/ext/standard/tests/assert/assert03.phpt b/ext/standard/tests/assert/assert03.phpt index 80c42df473f05..3b231405f6be1 100644 --- a/ext/standard/tests/assert/assert03.phpt +++ b/ext/standard/tests/assert/assert03.phpt @@ -5,38 +5,33 @@ assert.active = 1 assert.warning = 0 assert.callback = assert.bail = 0 -assert.quiet_eval = 1 --FILE-- ==DONE== ---EXPECTF-- -Deprecated: assert(): Calling assert() with a string argument is deprecated in %s on line %d -assertion failed - a - %d,"$a != 0" - -Deprecated: assert(): Calling assert() with a string argument is deprecated in %s on line %d -assertion failed - b - %d,"$a != 0" +--EXPECT-- +assertion failed - a - 18,"assert($a != 0)" +assertion failed - b - 22,"assert($a != 0)" ==DONE== diff --git a/ext/standard/tests/assert/assert04.phpt b/ext/standard/tests/assert/assert04.phpt index 0100229958637..f20aaf8e2b370 100644 --- a/ext/standard/tests/assert/assert04.phpt +++ b/ext/standard/tests/assert/assert04.phpt @@ -5,7 +5,6 @@ assert.active = 1 assert.warning = 1 assert.callback = assert.bail = 0 -assert.quiet_eval = 0 --FILE-- --EXPECT-- bool(true) bool(true) -bool(true) -bool(true) diff --git a/ext/standard/tests/assert/assert_basic2.phpt b/ext/standard/tests/assert/assert_basic2.phpt index d6c150d0d0c9e..052e7d4e89f54 100644 --- a/ext/standard/tests/assert/assert_basic2.phpt +++ b/ext/standard/tests/assert/assert_basic2.phpt @@ -5,7 +5,6 @@ assert.active = 1 assert.warning = 1 assert.callback=f1 assert.bail = 0 -assert.quiet_eval = 0 --FILE-- [".assert_options(ASSERT_ACTIVE)."]\n"; echo "Initial values: assert_options(ASSERT_WARNING) => [".assert_options(ASSERT_WARNING)."]\n"; echo "Initial values: assert_options(ASSERT_BAIL) => [".assert_options(ASSERT_BAIL)."]\n"; -echo "Initial values: assert_options(ASSERT_QUIET_EVAL) => [".assert_options(ASSERT_QUIET_EVAL)."]\n"; echo "Initial values: assert_options(ASSERT_CALLBACK) => [".assert_options(ASSERT_CALLBACK)."]\n"; //Using ini.get; echo "Initial values: ini.get(\"assert.active\") => [".ini_get("assert.active")."]\n"; echo "Initial values: ini.get(\"assert.warning\") => [".ini_get("assert.warning")."]\n"; echo "Initial values: ini.get(\"assert.bail\") => [".ini_get("assert.bail")."]\n"; -echo "Initial values: ini.get(\"assert.quiet_eval\") => [".ini_get("assert.quiet_eval")."]\n"; echo "Initial values: ini.get(\"assert.callback\") => [".ini_get("assert.callback")."]\n\n"; --EXPECT-- Initial values: assert_options(ASSERT_ACTIVE) => [0] Initial values: assert_options(ASSERT_WARNING) => [0] Initial values: assert_options(ASSERT_BAIL) => [0] -Initial values: assert_options(ASSERT_QUIET_EVAL) => [0] Initial values: assert_options(ASSERT_CALLBACK) => [f1] Initial values: ini.get("assert.active") => [0] Initial values: ini.get("assert.warning") => [0] Initial values: ini.get("assert.bail") => [0] -Initial values: ini.get("assert.quiet_eval") => [0] Initial values: ini.get("assert.callback") => [f1] diff --git a/ext/standard/tests/assert/assert_basic5.phpt b/ext/standard/tests/assert/assert_basic5.phpt index f4943cdf16283..cf2ed6ded3491 100644 --- a/ext/standard/tests/assert/assert_basic5.phpt +++ b/ext/standard/tests/assert/assert_basic5.phpt @@ -5,7 +5,6 @@ assert.active = 1 assert.warning = 0 assert.callback = f1 assert.bail = 0 -assert.quiet_eval = 0 --FILE-- --EXPECTF-- Warning: assert_options() expects at most 2 parameters, 3 given in %s on line %d NULL @@ -35,5 +33,3 @@ NULL Warning: assert() expects at most 2 parameters, 3 given in %s on line %d NULL - -Deprecated: assert(): Calling assert() with a string argument is deprecated in %s on line %d diff --git a/ext/standard/tests/assert/assert_error2.phpt b/ext/standard/tests/assert/assert_error2.phpt index d1b6f1745f94a..de00743b1be61 100644 --- a/ext/standard/tests/assert/assert_error2.phpt +++ b/ext/standard/tests/assert/assert_error2.phpt @@ -4,7 +4,6 @@ assert() - basic - Test that bailout works assert.active = 1 assert.warning = 1 assert.callback = f1 -assert.quiet_eval = 1 assert.bail = 0 error_reporting = -1 display_errors = 1 @@ -17,18 +16,10 @@ function f1($script, $line, $message, $user_message) //bail out on error var_dump($rao = assert_options(ASSERT_BAIL, 1)); -var_dump($r2 = assert("0 != 0")); +var_dump($r2 = assert(0 != 0)); echo "If this is printed BAIL hasn't worked"; --EXPECTF-- int(0) +f1 called -Deprecated: assert(): Calling assert() with a string argument is deprecated in %s on line %d - -Warning: assert(): Assertion "0 != 0" failed in %s on line 9 - -Fatal error: Uncaught ArgumentCountError: Too few arguments to function f1(), 3 passed and exactly 4 expected in %sassert_error2.php:2 -Stack trace: -#0 [internal function]: f1('%s', 9, '0 != 0') -#1 %sassert_error2.php(9): assert('0 != 0') -#2 {main} - thrown in %sassert_error2.php on line 2 +Warning: assert(): assert(0 != 0) failed in %s on line %d diff --git a/ext/standard/tests/assert/assert_error3.phpt b/ext/standard/tests/assert/assert_error3.phpt deleted file mode 100644 index 24538f4b04068..0000000000000 --- a/ext/standard/tests/assert/assert_error3.phpt +++ /dev/null @@ -1,27 +0,0 @@ ---TEST-- -assert() - basic - Test recoverable error ---INI-- -assert.active = 1 -assert.warning = 1 -assert.callback = f1 -assert.quiet_eval = 0 -assert.bail = 0 -error_reporting = -1 -display_errors = 1 ---FILE-- - [".assert_options(ASSERT_CALLBACK)."]\n"; echo "Initial values: ini.get(\"assert.callback\") => [".ini_get("assert.callback")."]\n"; -$sa = "0 != 0"; -var_dump($r2=assert($sa)); +var_dump($r2=assert(0 != 0)); echo"\n"; echo "Change callback function using ini.set and test return value \n"; var_dump($rv = ini_set("assert.callback","f2")); echo "assert_options(ASSERT_CALLBACK) => [".assert_options(ASSERT_CALLBACK)."]\n"; echo "ini.get(\"assert.callback\") => [".ini_get("assert.callback")."]\n"; -var_dump($r2=assert($sa)); +var_dump($r2=assert(0 != 0)); echo"\n"; echo "Change callback function using assert_options and test return value \n"; var_dump($rv=assert_options(ASSERT_CALLBACK, "f3")); echo "assert_options(ASSERT_CALLBACK) => [".assert_options(ASSERT_CALLBACK)."]\n"; echo "ini.get(\"assert.callback\") => [".ini_get("assert.callback")."]\n"; -var_dump($r2=assert($sa)); +var_dump($r2=assert(0 != 0)); echo"\n"; @@ -52,14 +50,14 @@ echo "Reset the name of the callback routine to a class method and check that it var_dump($rc=assert_options(ASSERT_CALLBACK, "c1")); echo "assert_options(ASSERT_CALLBACK) => [".assert_options(ASSERT_CALLBACK)."]\n"; echo "ini.get(\"assert.callback\") => [".ini_get("assert.callback")."]\n"; -var_dump($r2=assert($sa)); +var_dump($r2=assert(0 != 0)); echo"\n"; echo "Reset callback options to use a class method \n"; var_dump($rc = assert_options(ASSERT_CALLBACK,array("c1","assert"))); var_dump($rao=assert_options(ASSERT_CALLBACK)); echo "ini.get(\"assert.callback\") => [".ini_get("assert.callback")."]\n\n"; -var_dump($r2=assert($sa)); +var_dump($r2=assert(0 != 0)); echo"\n"; echo "Reset callback options to use an object method \n"; @@ -67,13 +65,11 @@ $o = new c1(); var_dump($rc=assert_options(ASSERT_CALLBACK,array(&$o,"assert"))); var_dump($rao=assert_options(ASSERT_CALLBACK)); echo "ini.get(\"assert.callback\") => [".ini_get("assert.callback")."]\n\n"; -var_dump($r2=assert($sa)); +var_dump($r2=assert(0 != 0)); echo"\n"; --EXPECTF-- Initial values: assert_options(ASSERT_CALLBACK) => [f1] Initial values: ini.get("assert.callback") => [f1] - -Deprecated: assert(): Calling assert() with a string argument is deprecated in %s on line %d f1 called bool(false) @@ -81,8 +77,6 @@ Change callback function using ini.set and test return value string(2) "f1" assert_options(ASSERT_CALLBACK) => [f2] ini.get("assert.callback") => [f2] - -Deprecated: assert(): Calling assert() with a string argument is deprecated in %s on line %d f2 called bool(false) @@ -90,8 +84,6 @@ Change callback function using assert_options and test return value string(2) "f2" assert_options(ASSERT_CALLBACK) => [f3] ini.get("assert.callback") => [f2] - -Deprecated: assert(): Calling assert() with a string argument is deprecated in %s on line %d f3 called bool(false) @@ -99,8 +91,6 @@ Reset the name of the callback routine to a class method and check that it works string(2) "f3" assert_options(ASSERT_CALLBACK) => [c1] ini.get("assert.callback") => [f2] - -Deprecated: assert(): Calling assert() with a string argument is deprecated in %s on line %d bool(false) Reset callback options to use a class method @@ -113,11 +103,7 @@ array(2) { } ini.get("assert.callback") => [f2] - -Deprecated: assert(): Calling assert() with a string argument is deprecated in %s on line %d - -Deprecated: Non-static method c1::assert() should not be called statically in %s on line 53 -Class assertion failed 53, "0 != 0" +Class assertion failed 52, "assert(0 != 0)" bool(false) Reset callback options to use an object method @@ -136,7 +122,5 @@ array(2) { } ini.get("assert.callback") => [f2] - -Deprecated: assert(): Calling assert() with a string argument is deprecated in %s on line %d -Class assertion failed 61, "0 != 0" +Class assertion failed 60, "assert(0 != 0)" bool(false) diff --git a/ext/standard/tests/assert/bug73303.phpt b/ext/standard/tests/assert/bug73303.phpt deleted file mode 100644 index 7264f5a322b74..0000000000000 --- a/ext/standard/tests/assert/bug73303.phpt +++ /dev/null @@ -1,24 +0,0 @@ ---TEST-- -Bug #73303: Scope not inherited by eval in assert() ---FILE-- -main(); - -?> ---EXPECTF-- -Deprecated: assert(): Calling assert() with a string argument is deprecated in %s on line %d -Success diff --git a/php.ini-development b/php.ini-development index d7445e6d9b094..81148ffb30951 100644 --- a/php.ini-development +++ b/php.ini-development @@ -1593,11 +1593,6 @@ zend.assertions = 1 ; http://php.net/assert.callback ;assert.callback = 0 -; Eval the expression with current error_reporting(). Set to true if you want -; error_reporting(0) around the eval(). -; http://php.net/assert.quiet-eval -;assert.quiet_eval = 0 - [COM] ; path to a file containing GUIDs, IIDs or filenames of files with TypeLibs ; http://php.net/com.typelib-file diff --git a/php.ini-production b/php.ini-production index 5b7f827aa3be8..449361f88f6db 100644 --- a/php.ini-production +++ b/php.ini-production @@ -1593,11 +1593,6 @@ zend.assertions = -1 ; http://php.net/assert.callback ;assert.callback = 0 -; Eval the expression with current error_reporting(). Set to true if you want -; error_reporting(0) around the eval(). -; http://php.net/assert.quiet-eval -;assert.quiet_eval = 0 - [COM] ; path to a file containing GUIDs, IIDs or filenames of files with TypeLibs ; http://php.net/com.typelib-file diff --git a/tests/lang/bug23922.phpt b/tests/lang/bug23922.phpt deleted file mode 100644 index 22c4aaa7d47f9..0000000000000 --- a/tests/lang/bug23922.phpt +++ /dev/null @@ -1,21 +0,0 @@ ---TEST-- -Bug #23922 (scope doesn't properly propagate into internal functions) ---FILE-- -foo == 1'); } - - function as_expr() - { assert($this->foo == 1); } - } - - $foo = new foo(); - $foo->as_expr(); - $foo->as_string(); -?> ---EXPECTF-- -Deprecated: assert(): Calling assert() with a string argument is deprecated in %s on line %d From 6db97f5e3ea3ac9774a06981226a0fe1bca02b38 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Mon, 28 Jan 2019 17:12:32 +0100 Subject: [PATCH 18/51] Remove each() This has been deprecated in PHP 7.2 as part of https://wiki.php.net/rfc/deprecations_php_7_2. --- UPGRADING | 1 + Zend/tests/007.phpt | 65 ----- Zend/tests/each_001.phpt | 12 - Zend/tests/each_002.phpt | 33 --- Zend/tests/each_003.phpt | 27 -- Zend/zend_builtin_functions.c | 66 ----- Zend/zend_execute_API.c | 2 - Zend/zend_globals.h | 2 - ext/opcache/Optimizer/zend_func_info.c | 1 - ext/standard/tests/array/each.phpt | Bin 9679 -> 0 bytes ext/standard/tests/array/each_basic.phpt | 76 ------ ext/standard/tests/array/each_error.phpt | 41 --- ext/standard/tests/array/each_variation1.phpt | 223 --------------- ext/standard/tests/array/each_variation2.phpt | 249 ----------------- ext/standard/tests/array/each_variation3.phpt | 254 ------------------ ext/standard/tests/array/each_variation4.phpt | 60 ----- ext/standard/tests/array/each_variation5.phpt | 97 ------- ext/standard/tests/array/each_variation6.phpt | 52 ---- tests/lang/031.phpt | 72 ----- tests/lang/each_binary_safety.phpt | 14 - 20 files changed, 1 insertion(+), 1346 deletions(-) delete mode 100644 Zend/tests/007.phpt delete mode 100644 Zend/tests/each_001.phpt delete mode 100644 Zend/tests/each_002.phpt delete mode 100644 Zend/tests/each_003.phpt delete mode 100644 ext/standard/tests/array/each.phpt delete mode 100644 ext/standard/tests/array/each_basic.phpt delete mode 100644 ext/standard/tests/array/each_error.phpt delete mode 100644 ext/standard/tests/array/each_variation1.phpt delete mode 100644 ext/standard/tests/array/each_variation2.phpt delete mode 100644 ext/standard/tests/array/each_variation3.phpt delete mode 100644 ext/standard/tests/array/each_variation4.phpt delete mode 100644 ext/standard/tests/array/each_variation5.phpt delete mode 100644 ext/standard/tests/array/each_variation6.phpt delete mode 100644 tests/lang/031.phpt delete mode 100644 tests/lang/each_binary_safety.phpt diff --git a/UPGRADING b/UPGRADING index d58780964857a..882241eacf0b1 100644 --- a/UPGRADING +++ b/UPGRADING @@ -24,6 +24,7 @@ PHP 8.0 UPGRADE NOTES . Removed track_errors ini directive. This means that $php_errormsg is no longer available. The error_get_last() function may be used instead. . Removed create_function(). Anonymous functions may be used instead. + . Removed each(). foreach or ArrayIterator should be used instead. - GD: . The deprecated function image2wbmp() has been removed. diff --git a/Zend/tests/007.phpt b/Zend/tests/007.phpt deleted file mode 100644 index 61201812698cc..0000000000000 --- a/Zend/tests/007.phpt +++ /dev/null @@ -1,65 +0,0 @@ ---TEST-- -each() tests ---FILE-- -1,"b"=>2,"c"=>3); -var_dump(each($var)); - -$a = array(1); -$a [] =&$a[0]; - -var_dump(each($a)); - - -echo "Done\n"; -?> ---EXPECTF-- -Warning: each() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -Deprecated: The each() function is deprecated. This message will be suppressed on further calls in %s on line %d - -Warning: Variable passed to each() is not an array or object in %s on line %d -NULL - -Warning: Variable passed to each() is not an array or object in %s on line %d -NULL -array(4) { - [1]=> - int(1) - ["value"]=> - int(1) - [0]=> - int(0) - ["key"]=> - int(0) -} -array(4) { - [1]=> - int(1) - ["value"]=> - int(1) - [0]=> - string(1) "a" - ["key"]=> - string(1) "a" -} -array(4) { - [1]=> - int(1) - ["value"]=> - int(1) - [0]=> - int(0) - ["key"]=> - int(0) -} -Done diff --git a/Zend/tests/each_001.phpt b/Zend/tests/each_001.phpt deleted file mode 100644 index f2cae3d875df7..0000000000000 --- a/Zend/tests/each_001.phpt +++ /dev/null @@ -1,12 +0,0 @@ ---TEST-- -Testing each() with an undefined variable ---FILE-- - ---EXPECTF-- -Deprecated: The each() function is deprecated. This message will be suppressed on further calls in %s on line %d - -Warning: Variable passed to each() is not an array or object in %s on line %d diff --git a/Zend/tests/each_002.phpt b/Zend/tests/each_002.phpt deleted file mode 100644 index 5454f5ce0ff4f..0000000000000 --- a/Zend/tests/each_002.phpt +++ /dev/null @@ -1,33 +0,0 @@ ---TEST-- -Testing each() with array and object ---FILE-- - ---EXPECTF-- -Deprecated: The each() function is deprecated. This message will be suppressed on further calls in %s on line %d -bool(false) -bool(false) -array(4) { - [1]=> - object(stdClass)#1 (0) { - } - ["value"]=> - object(stdClass)#1 (0) { - } - [0]=> - int(0) - ["key"]=> - int(0) -} diff --git a/Zend/tests/each_003.phpt b/Zend/tests/each_003.phpt deleted file mode 100644 index d0038c05615b2..0000000000000 --- a/Zend/tests/each_003.phpt +++ /dev/null @@ -1,27 +0,0 @@ ---TEST-- -Testing each() with recursion ---INI-- -zend.enable_gc=1 ---FILE-- - ---EXPECTF-- -Deprecated: The each() function is deprecated. This message will be suppressed on further calls in %s on line %d -array(4) { - [1]=> - array(0) { - } - ["value"]=> - array(0) { - } - [0]=> - int(0) - ["key"]=> - int(0) -} diff --git a/Zend/zend_builtin_functions.c b/Zend/zend_builtin_functions.c index e8bcc1c980e25..14c8fd39f9b82 100644 --- a/Zend/zend_builtin_functions.c +++ b/Zend/zend_builtin_functions.c @@ -37,7 +37,6 @@ static ZEND_FUNCTION(strcmp); static ZEND_FUNCTION(strncmp); static ZEND_FUNCTION(strcasecmp); static ZEND_FUNCTION(strncasecmp); -static ZEND_FUNCTION(each); static ZEND_FUNCTION(error_reporting); static ZEND_FUNCTION(define); static ZEND_FUNCTION(defined); @@ -108,10 +107,6 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_strncmp, 0, 0, 3) ZEND_ARG_INFO(0, len) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_each, 0, 0, 1) - ZEND_ARG_INFO(1, arr) -ZEND_END_ARG_INFO() - ZEND_BEGIN_ARG_INFO_EX(arginfo_error_reporting, 0, 0, 0) ZEND_ARG_INFO(0, new_error_level) ZEND_END_ARG_INFO() @@ -238,7 +233,6 @@ static const zend_function_entry builtin_functions[] = { /* {{{ */ ZEND_FE(strncmp, arginfo_strncmp) ZEND_FE(strcasecmp, arginfo_strcmp) ZEND_FE(strncasecmp, arginfo_strncmp) - ZEND_FE(each, arginfo_each) ZEND_FE(error_reporting, arginfo_error_reporting) ZEND_FE(define, arginfo_define) ZEND_FE(defined, arginfo_defined) @@ -653,66 +647,6 @@ ZEND_FUNCTION(strncasecmp) } /* }}} */ -/* {{{ proto mixed each(array &arr) - Return the currently pointed key..value pair in the passed array, and advance the pointer to the next element, or false if there is no element at this place */ -ZEND_FUNCTION(each) -{ - zval *array, *entry, tmp; - zend_ulong num_key; - HashTable *target_hash; - zend_string *key; - - if (zend_parse_parameters(ZEND_NUM_ARGS(), "z/", &array) == FAILURE) { - return; - } - - if (!EG(each_deprecation_thrown)) { - zend_error(E_DEPRECATED, "The each() function is deprecated. This message will be suppressed on further calls"); - EG(each_deprecation_thrown) = 1; - } - - target_hash = HASH_OF(array); - if (!target_hash) { - zend_error(E_WARNING,"Variable passed to each() is not an array or object"); - return; - } - while (1) { - entry = zend_hash_get_current_data(target_hash); - if (!entry) { - RETURN_FALSE; - } else if (Z_TYPE_P(entry) == IS_INDIRECT) { - entry = Z_INDIRECT_P(entry); - if (Z_TYPE_P(entry) == IS_UNDEF) { - zend_hash_move_forward(target_hash); - continue; - } - } - break; - } - array_init_size(return_value, 4); - zend_hash_real_init_mixed(Z_ARRVAL_P(return_value)); - - /* add value elements */ - ZVAL_DEREF(entry); - if (Z_REFCOUNTED_P(entry)) { - GC_ADDREF_EX(Z_COUNTED_P(entry), 2); - } - zend_hash_index_add_new(Z_ARRVAL_P(return_value), 1, entry); - zend_hash_add_new(Z_ARRVAL_P(return_value), ZSTR_KNOWN(ZEND_STR_VALUE), entry); - - /* add the key elements */ - if (zend_hash_get_current_key(target_hash, &key, &num_key) == HASH_KEY_IS_STRING) { - ZVAL_STR_COPY(&tmp, key); - Z_TRY_ADDREF(tmp); - } else { - ZVAL_LONG(&tmp, num_key); - } - zend_hash_index_add_new(Z_ARRVAL_P(return_value), 0, &tmp); - zend_hash_add_new(Z_ARRVAL_P(return_value), ZSTR_KNOWN(ZEND_STR_KEY), &tmp); - zend_hash_move_forward(target_hash); -} -/* }}} */ - /* {{{ proto int error_reporting([int new_error_level]) Return the current error_reporting level, and if an argument was passed - change to the new level */ ZEND_FUNCTION(error_reporting) diff --git a/Zend/zend_execute_API.c b/Zend/zend_execute_API.c index 646f3b927b94b..edab6edaa77a3 100644 --- a/Zend/zend_execute_API.c +++ b/Zend/zend_execute_API.c @@ -177,8 +177,6 @@ void init_executor(void) /* {{{ */ EG(ht_iterators) = EG(ht_iterators_slots); memset(EG(ht_iterators), 0, sizeof(EG(ht_iterators_slots))); - EG(each_deprecation_thrown) = 0; - EG(persistent_constants_count) = EG(zend_constants)->nNumUsed; EG(persistent_functions_count) = EG(function_table)->nNumUsed; EG(persistent_classes_count) = EG(class_table)->nNumUsed; diff --git a/Zend/zend_globals.h b/Zend/zend_globals.h index d558fa9ad8518..b996b325c4fc8 100644 --- a/Zend/zend_globals.h +++ b/Zend/zend_globals.h @@ -225,8 +225,6 @@ struct _zend_executor_globals { zend_function trampoline; zend_op call_trampoline_op; - zend_bool each_deprecation_thrown; - void *reserved[ZEND_MAX_RESERVED_RESOURCES]; }; diff --git a/ext/opcache/Optimizer/zend_func_info.c b/ext/opcache/Optimizer/zend_func_info.c index 6aea0f6007109..7405913846f05 100644 --- a/ext/opcache/Optimizer/zend_func_info.c +++ b/ext/opcache/Optimizer/zend_func_info.c @@ -228,7 +228,6 @@ static const func_info_t func_infos[] = { FC("strncmp", zend_lb_ssn_info), FC("strcasecmp", zend_l_ss_info), FC("strncasecmp", zend_lb_ssn_info), - F1("each", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_OF_REF | MAY_BE_ARRAY_OF_ANY | MAY_BE_ARRAY_KEY_ANY), F0("error_reporting", MAY_BE_NULL | MAY_BE_LONG), F0("define", MAY_BE_FALSE | MAY_BE_TRUE | MAY_BE_NULL), // TODO: inline FC("defined", zend_b_s_info), // TODO: inline diff --git a/ext/standard/tests/array/each.phpt b/ext/standard/tests/array/each.phpt deleted file mode 100644 index 4af2097a7df0a8797010b82bd811fabea9625664..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 9679 zcmd5?ZExE)5boFNR~!TvkW(wMow)6qrNgkLz<^>Hw(JF1hd`F;SgRr#dTE*s`R{v< zq-;_aZ6{5E0qY{&QTO`Xk>Mo_FV26t2t)5elog36UIcxb*I8U8dFF-T+aKPYgZuS2 z%f-?=I-s9LRTmjm3qf&R6e6qWgSe$Ao6*N8tpzQkq@a0`UxP+bQAD>Mk>p3Sk5Lv2 z`K@HIgfcJa;K=htyvWHvI5;3SB+0HCTVB&NDwB9+QsKBTGfYuTOoVe}Qv_;xMEiDp9~ID1pE*lvpL|#rQDJYZOgj zNIS)sz4-a_Q+oRJ=!lXmF2prg*7TMTFzH1hqDqxcnN+nDjX3jixD>^)C` zqAIU4`A0ysbcNtW3^UnELa7#)v-)}&Xg3Vc5Jp~s#bL;gcld{}Mv#A%Nvl|)E^Rg~ z%5rprf@LPrG!;~cQdFfZ^CUwYvM7}zX_?D+wwU{eH1bd=Gg?>w-OvR6Bw= z?l`3q!Qai3f?HLpVie7xLdjd3h(yALOx&n^A?oXJvs1hLS9xr*mLN6WUDKo9XPsSY znL|ChFXOCKnO z)e+Tfs~+nKw&{z&~W7*Ms|7#(IxH6P%;GWlMrcv~u$Cje3U| zkH4Jf1!_jM1OEB7s@z~Lv40Bs^XICl)&W;RUFk)0FwoQTlq3Z5>E9wo$>>Jm#VN{7 z=J--Qa@8)2eXivmXv#%f|0D{mroCO$1yIJ5eCiUz|?uehqY0iv$W`jY8p zMY4FXh)*NKEkHoYkLOSX5RD}?2Ax?8N9tG^!`?26Hq z0GxoNsi3l6LP!b2v9IDpS;&nmj?%Qmu1n8KCZ`Fu+-EbGYV6`e)TXBZccSY3&(U9J zZ%|R#(s0nk!=Ju90Q+t7uubrBny^>hdDA>kgL#yeqW>k;*iMbMIyLHcN|7JWsn1tq zJ2l?w6b}8JsnYbvbL%k_*^V7=bJTQrD!miyn~rw`fH+L~A752nBIZggypl zY>ZBv7*&VZVARJoi@(vsH@JqAdUv*+1kq99TGW^oO`VzywxQ~t=+&x@rK;Ge%j6r% z?ullt496Gv70;a7tObTTH^O%wUN*909hEk?hEjL#Y}~xqg&U3`Uz@p*WAY9C4^JrH z%WYHE@C{`TOXviisXITHI(vno(4ErG&SD@)-b%XkF@jbL40Y~Cwl9LrEOlYXqMW!Yo8=>u7VW*Uv$_TeQ-C$aA9cgXQ#K~_aDm-#= zSu*NcXdA?RUe0m4En2hpI8Ju@?`lKq7}^G{V!)uX0M!lRu|)L=T5gfaI0BM_k~R}(FmT+`f`TH zH_-vWA)@Qey<+ETyL9E5k!LdQULr>}u5#I_&cf=>)wXfmIe0$QZQF`_*9K*Ky3-w3 zxj7AW!py#6GHip!tn-PSrpN)&6TZ*aGa-kS+dpxXfv)@)(54=p?WeWGHh09_CkNU} zJ(+UY=~(M9(5jQpIt5YR)T`o^M->pq>RO)2I@Ex1+%WXP(N*X`EccTysI(PCK9|Zo z%ekE^eC<^mpzIv4Spx{W5qHeVJn#3Y$S_lU-Hc(>*a|btPf=W@w=}}v0Tt1;z-)d% zL%PD>cVwF*78&9D$r|q|>$m2w5tbOGV%~#Uxt 1, 'zero', 'two' => 'deux', 20 => 'twenty'); -echo "\n-- Passed array: --\n"; -var_dump($arr); - -echo "\n-- Initial position: --\n"; -var_dump(each($arr)); - -echo "\n-- End position: --\n"; -end($arr); -var_dump(each($arr)); - -echo "\n-- Passed the end of array: --\n"; -var_dump(each($arr)); - -echo "Done"; -?> ---EXPECTF-- -*** Testing each() : basic functionality *** - --- Passed array: -- -array(4) { - ["one"]=> - int(1) - [0]=> - string(4) "zero" - ["two"]=> - string(4) "deux" - [20]=> - string(6) "twenty" -} - --- Initial position: -- - -Deprecated: The each() function is deprecated. This message will be suppressed on further calls in %s on line %d -array(4) { - [1]=> - int(1) - ["value"]=> - int(1) - [0]=> - string(3) "one" - ["key"]=> - string(3) "one" -} - --- End position: -- -array(4) { - [1]=> - string(6) "twenty" - ["value"]=> - string(6) "twenty" - [0]=> - int(20) - ["key"]=> - int(20) -} - --- Passed the end of array: -- -bool(false) -Done diff --git a/ext/standard/tests/array/each_error.phpt b/ext/standard/tests/array/each_error.phpt deleted file mode 100644 index e7ee4976ed407..0000000000000 --- a/ext/standard/tests/array/each_error.phpt +++ /dev/null @@ -1,41 +0,0 @@ ---TEST-- -Test each() function : error conditions - pass incorrect number of args ---FILE-- - ---EXPECTF-- -*** Testing each() : error conditions *** - --- Testing each() function with Zero arguments -- - -Warning: each() expects exactly 1 parameter, 0 given in %s on line %d -NULL - --- Testing each() function with more than expected no. of arguments -- - -Warning: each() expects exactly 1 parameter, 2 given in %s on line %d -NULL -Done diff --git a/ext/standard/tests/array/each_variation1.phpt b/ext/standard/tests/array/each_variation1.phpt deleted file mode 100644 index 6b75d5e15cc7a..0000000000000 --- a/ext/standard/tests/array/each_variation1.phpt +++ /dev/null @@ -1,223 +0,0 @@ ---TEST-- -Test each() function : usage variations - Pass different data types as $arr arg ---FILE-- - ---EXPECTF-- -*** Testing each() : usage variations *** - --- Iteration 1 -- - -Deprecated: The each() function is deprecated. This message will be suppressed on further calls in %s on line %d - -Warning: Variable passed to each() is not an array or object in %s on line %d -NULL - --- Iteration 2 -- - -Warning: Variable passed to each() is not an array or object in %s on line %d -NULL - --- Iteration 3 -- - -Warning: Variable passed to each() is not an array or object in %s on line %d -NULL - --- Iteration 4 -- - -Warning: Variable passed to each() is not an array or object in %s on line %d -NULL - --- Iteration 5 -- - -Warning: Variable passed to each() is not an array or object in %s on line %d -NULL - --- Iteration 6 -- - -Warning: Variable passed to each() is not an array or object in %s on line %d -NULL - --- Iteration 7 -- - -Warning: Variable passed to each() is not an array or object in %s on line %d -NULL - --- Iteration 8 -- - -Warning: Variable passed to each() is not an array or object in %s on line %d -NULL - --- Iteration 9 -- - -Warning: Variable passed to each() is not an array or object in %s on line %d -NULL - --- Iteration 10 -- - -Warning: Variable passed to each() is not an array or object in %s on line %d -NULL - --- Iteration 11 -- - -Warning: Variable passed to each() is not an array or object in %s on line %d -NULL - --- Iteration 12 -- - -Warning: Variable passed to each() is not an array or object in %s on line %d -NULL - --- Iteration 13 -- - -Warning: Variable passed to each() is not an array or object in %s on line %d -NULL - --- Iteration 14 -- - -Warning: Variable passed to each() is not an array or object in %s on line %d -NULL - --- Iteration 15 -- - -Warning: Variable passed to each() is not an array or object in %s on line %d -NULL - --- Iteration 16 -- - -Warning: Variable passed to each() is not an array or object in %s on line %d -NULL - --- Iteration 17 -- - -Warning: Variable passed to each() is not an array or object in %s on line %d -NULL - --- Iteration 18 -- -bool(false) - --- Iteration 19 -- - -Warning: Variable passed to each() is not an array or object in %s on line %d -NULL - --- Iteration 20 -- - -Warning: Variable passed to each() is not an array or object in %s on line %d -NULL - --- Iteration 21 -- - -Warning: Variable passed to each() is not an array or object in %s on line %d -NULL - --- Iteration 22 -- -bool(false) - --- Iteration 23 -- - -Warning: Variable passed to each() is not an array or object in %s on line %d -NULL - --- Iteration 24 -- - -Warning: Variable passed to each() is not an array or object in %s on line %d -NULL - --- Iteration 25 -- - -Warning: Variable passed to each() is not an array or object in %s on line %d -NULL -Done diff --git a/ext/standard/tests/array/each_variation2.phpt b/ext/standard/tests/array/each_variation2.phpt deleted file mode 100644 index 34eeedc9a8ee3..0000000000000 --- a/ext/standard/tests/array/each_variation2.phpt +++ /dev/null @@ -1,249 +0,0 @@ ---TEST-- -Test each() function : usage variations - arrays of different data types ---FILE-- - array( - 0, - 1, - 12345, - -2345, - ), - - // float data -/*2*/ 'float' => array( - 10.5, - -10.5, - 12.3456789000e10, - 12.3456789000E-10, - .5, - ), - - // null data -/*3*/ 'null' => array( - NULL, - null, - ), - - // boolean data -/*4*/ 'bool' => array( - true, - false, - TRUE, - FALSE, - ), - - // empty data -/*5*/ 'empty string' => array( - "", - '', - ), - -/*6*/ 'empty array' => array( - ), - - // string data -/*7*/ 'string' => array( - "string", - 'string', - $heredoc, - ), - - // object data -/*8*/ 'object' => array( - new classA(), - ), - - // undefined data -/*9*/ 'undefined' => array( - @$undefined_var, - ), - - // unset data -/*10*/ 'unset' => array( - @$unset_var, - ), - - // resource variable -/*11*/ 'resource' => array( - $fp - ), -); - -// loop through each element of $inputs to check the behavior of each() -$iterator = 1; -foreach($inputs as $key => $input) { - echo "\n-- Iteration $iterator: $key data --\n"; - var_dump( each($input) ); - $iterator++; -}; - -fclose($fp); - -echo "Done"; -?> ---EXPECTF-- -*** Testing each() : usage variations *** - --- Iteration 1: int data -- - -Deprecated: The each() function is deprecated. This message will be suppressed on further calls in %s on line %d -array(4) { - [1]=> - int(0) - ["value"]=> - int(0) - [0]=> - int(0) - ["key"]=> - int(0) -} - --- Iteration 2: float data -- -array(4) { - [1]=> - float(10.5) - ["value"]=> - float(10.5) - [0]=> - int(0) - ["key"]=> - int(0) -} - --- Iteration 3: null data -- -array(4) { - [1]=> - NULL - ["value"]=> - NULL - [0]=> - int(0) - ["key"]=> - int(0) -} - --- Iteration 4: bool data -- -array(4) { - [1]=> - bool(true) - ["value"]=> - bool(true) - [0]=> - int(0) - ["key"]=> - int(0) -} - --- Iteration 5: empty string data -- -array(4) { - [1]=> - string(0) "" - ["value"]=> - string(0) "" - [0]=> - int(0) - ["key"]=> - int(0) -} - --- Iteration 6: empty array data -- -bool(false) - --- Iteration 7: string data -- -array(4) { - [1]=> - string(6) "string" - ["value"]=> - string(6) "string" - [0]=> - int(0) - ["key"]=> - int(0) -} - --- Iteration 8: object data -- -array(4) { - [1]=> - object(classA)#%d (0) { - } - ["value"]=> - object(classA)#%d (0) { - } - [0]=> - int(0) - ["key"]=> - int(0) -} - --- Iteration 9: undefined data -- -array(4) { - [1]=> - NULL - ["value"]=> - NULL - [0]=> - int(0) - ["key"]=> - int(0) -} - --- Iteration 10: unset data -- -array(4) { - [1]=> - NULL - ["value"]=> - NULL - [0]=> - int(0) - ["key"]=> - int(0) -} - --- Iteration 11: resource data -- -array(4) { - [1]=> - resource(%d) of type (stream) - ["value"]=> - resource(%d) of type (stream) - [0]=> - int(0) - ["key"]=> - int(0) -} -Done diff --git a/ext/standard/tests/array/each_variation3.phpt b/ext/standard/tests/array/each_variation3.phpt deleted file mode 100644 index 32342d6d7870c..0000000000000 --- a/ext/standard/tests/array/each_variation3.phpt +++ /dev/null @@ -1,254 +0,0 @@ ---TEST-- -Test each() function : usage variations - keys of different data types ---FILE-- - array( - 0 => 'zero', - 1 => 'one', - 12345 => 'positive', - -2345 => 'negative', - ), - - // float data -/*2*/ 'float' => array( - 10.5 => 'positive', - -10.5 => 'negative', - .5 => 'half', - ), - -/*3*/ 'extreme floats' => array( - 12.3456789000e6 => 'large', - 12.3456789000E-10 => 'small', - ), - - // null data -/*4*/ 'null uppercase' => array( - NULL => 'null 1', - ), - -/*5*/ 'null lowercase' => array( - null => 'null 2', - ), - - // boolean data -/*6*/ 'bool lowercase' => array( - true => 'lowert', - false => 'lowerf', - ), - -/*7*/ 'bool uppercase' => array( - TRUE => 'uppert', - FALSE => 'upperf', - ), - - // empty data -/*8*/ 'empty double quotes' => array( - "" => 'emptyd', - ), - -/*9*/ 'empty single quotes' => array( - '' => 'emptys', - ), - - // string data -/*10*/ 'string' => array( - "stringd" => 'stringd', - 'strings' => 'strings', - $heredoc => 'stringh', - ), - - // undefined data -/*11*/ 'undefined' => array( - @$undefined_var => 'undefined', - ), - - // unset data -/*12*/ 'unset' => array( - @$unset_var => 'unset', - ), -); - -// loop through each element of $inputs to check the behavior of each() -$iterator = 1; -foreach($inputs as $key => $input) { - echo "\n-- Iteration $iterator: $key data --\n"; - var_dump( each($input) ); - $iterator++; -}; - -echo "Done"; -?> ---EXPECTF-- -*** Testing each() : usage variations *** - --- Iteration 1: int data -- - -Deprecated: The each() function is deprecated. This message will be suppressed on further calls in %s on line %d -array(4) { - [1]=> - string(4) "zero" - ["value"]=> - string(4) "zero" - [0]=> - int(0) - ["key"]=> - int(0) -} - --- Iteration 2: float data -- -array(4) { - [1]=> - string(8) "positive" - ["value"]=> - string(8) "positive" - [0]=> - int(10) - ["key"]=> - int(10) -} - --- Iteration 3: extreme floats data -- -array(4) { - [1]=> - string(5) "large" - ["value"]=> - string(5) "large" - [0]=> - int(12345678) - ["key"]=> - int(12345678) -} - --- Iteration 4: null uppercase data -- -array(4) { - [1]=> - string(6) "null 1" - ["value"]=> - string(6) "null 1" - [0]=> - string(0) "" - ["key"]=> - string(0) "" -} - --- Iteration 5: null lowercase data -- -array(4) { - [1]=> - string(6) "null 2" - ["value"]=> - string(6) "null 2" - [0]=> - string(0) "" - ["key"]=> - string(0) "" -} - --- Iteration 6: bool lowercase data -- -array(4) { - [1]=> - string(6) "lowert" - ["value"]=> - string(6) "lowert" - [0]=> - int(1) - ["key"]=> - int(1) -} - --- Iteration 7: bool uppercase data -- -array(4) { - [1]=> - string(6) "uppert" - ["value"]=> - string(6) "uppert" - [0]=> - int(1) - ["key"]=> - int(1) -} - --- Iteration 8: empty double quotes data -- -array(4) { - [1]=> - string(6) "emptyd" - ["value"]=> - string(6) "emptyd" - [0]=> - string(0) "" - ["key"]=> - string(0) "" -} - --- Iteration 9: empty single quotes data -- -array(4) { - [1]=> - string(6) "emptys" - ["value"]=> - string(6) "emptys" - [0]=> - string(0) "" - ["key"]=> - string(0) "" -} - --- Iteration 10: string data -- -array(4) { - [1]=> - string(7) "stringd" - ["value"]=> - string(7) "stringd" - [0]=> - string(7) "stringd" - ["key"]=> - string(7) "stringd" -} - --- Iteration 11: undefined data -- -array(4) { - [1]=> - string(9) "undefined" - ["value"]=> - string(9) "undefined" - [0]=> - string(0) "" - ["key"]=> - string(0) "" -} - --- Iteration 12: unset data -- -array(4) { - [1]=> - string(5) "unset" - ["value"]=> - string(5) "unset" - [0]=> - string(0) "" - ["key"]=> - string(0) "" -} -Done diff --git a/ext/standard/tests/array/each_variation4.phpt b/ext/standard/tests/array/each_variation4.phpt deleted file mode 100644 index 64fbb4a8d071f..0000000000000 --- a/ext/standard/tests/array/each_variation4.phpt +++ /dev/null @@ -1,60 +0,0 @@ ---TEST-- -Test each() function : usage variations - Referenced variables ---FILE-- - &$val1, &$val2); - -echo "-- Call each until at the end of the array: --\n"; -var_dump( each($arr1) ); -var_dump( each($arr1) ); -var_dump( each($arr1) ); - -echo "Done"; -?> ---EXPECTF-- -*** Testing each() : usage variations *** - --- Array made up of referenced variables: -- --- Call each until at the end of the array: -- - -Deprecated: The each() function is deprecated. This message will be suppressed on further calls in %s on line %d -array(4) { - [1]=> - string(3) "foo" - ["value"]=> - string(3) "foo" - [0]=> - string(3) "one" - ["key"]=> - string(3) "one" -} -array(4) { - [1]=> - string(3) "bar" - ["value"]=> - string(3) "bar" - [0]=> - int(0) - ["key"]=> - int(0) -} -bool(false) -Done diff --git a/ext/standard/tests/array/each_variation5.phpt b/ext/standard/tests/array/each_variation5.phpt deleted file mode 100644 index 441882f962300..0000000000000 --- a/ext/standard/tests/array/each_variation5.phpt +++ /dev/null @@ -1,97 +0,0 @@ ---TEST-- -Test each() function : usage variations - Multi-dimensional arrays ---FILE-- - 'un', - array('a', 'b', 'c') - ); - -echo "\n-- Pass each() a two-dimensional array --\n"; -for ($i = 1; $i < count($arr); $i++) { - var_dump( each($arr) ); -} - -echo "\n-- Pass each() a sub-array --\n"; -var_dump( each($arr[2])); - -echo "Done"; -?> ---EXPECTF-- -*** Testing each() : usage variations *** - --- Pass each() a two-dimensional array -- - -Deprecated: The each() function is deprecated. This message will be suppressed on further calls in %s on line %d -array(4) { - [1]=> - string(4) "zero" - ["value"]=> - string(4) "zero" - [0]=> - int(0) - ["key"]=> - int(0) -} -array(4) { - [1]=> - array(3) { - [0]=> - int(1) - [1]=> - int(2) - [2]=> - int(3) - } - ["value"]=> - array(3) { - [0]=> - int(1) - [1]=> - int(2) - [2]=> - int(3) - } - [0]=> - int(1) - ["key"]=> - int(1) -} -array(4) { - [1]=> - string(2) "un" - ["value"]=> - string(2) "un" - [0]=> - string(3) "one" - ["key"]=> - string(3) "one" -} - --- Pass each() a sub-array -- -array(4) { - [1]=> - string(1) "a" - ["value"]=> - string(1) "a" - [0]=> - int(0) - ["key"]=> - int(0) -} -Done diff --git a/ext/standard/tests/array/each_variation6.phpt b/ext/standard/tests/array/each_variation6.phpt deleted file mode 100644 index de52ba5965916..0000000000000 --- a/ext/standard/tests/array/each_variation6.phpt +++ /dev/null @@ -1,52 +0,0 @@ ---TEST-- -Test each() function : usage variations - Internal array pointer ---FILE-- - " . current($arr) . "\n"; - -echo "\n-- Call to each(): --\n"; -var_dump( each($arr) ); - -echo "\n-- New position: --\n"; -echo key($arr) . " => " . current($arr) . "\n"; - -echo "Done"; -?> ---EXPECTF-- -*** Testing each() : usage variations *** - --- Current position: -- -0 => zero - --- Call to each(): -- - -Deprecated: The each() function is deprecated. This message will be suppressed on further calls in %s on line %d -array(4) { - [1]=> - string(4) "zero" - ["value"]=> - string(4) "zero" - [0]=> - int(0) - ["key"]=> - int(0) -} - --- New position: -- -1 => one -Done diff --git a/tests/lang/031.phpt b/tests/lang/031.phpt deleted file mode 100644 index 134df03684295..0000000000000 --- a/tests/lang/031.phpt +++ /dev/null @@ -1,72 +0,0 @@ ---TEST-- -Bug #16227 (Internal hash position bug on assignment) ---FILE-- - ---EXPECTF-- -Correct - with inner loop reset. - -Deprecated: The each() function is deprecated. This message will be suppressed on further calls in %s on line %d -inloop 0 for key1 -inloop 1 for key1 -inloop 0 for key2 -inloop 1 for key2 -What happens without inner loop reset. -inloop 0 for key1 -inloop 1 for key1 -What happens without inner loop reset but copy. -inloop 0 for key1 -inloop 1 for key1 -inloop 0 for key2 -inloop 1 for key2 -What happens with inner loop reset over copy. -inloop 0 for key1 -inloop 1 for key1 -inloop 0 for key2 -inloop 1 for key2 diff --git a/tests/lang/each_binary_safety.phpt b/tests/lang/each_binary_safety.phpt deleted file mode 100644 index ce175495aacdf..0000000000000 --- a/tests/lang/each_binary_safety.phpt +++ /dev/null @@ -1,14 +0,0 @@ ---TEST-- -Binary safety of each() for both keys and values ---FILE-- - "foo\0bar"); -while (list($key, $val) = each($arr)) { - echo strlen($key), ': '; - echo urlencode($key), ' => ', urlencode($val), "\n"; -} -?> ---EXPECTF-- -Deprecated: The each() function is deprecated. This message will be suppressed on further calls in %s on line %d -7: foo%00bar => foo%00bar From 83bc092d40671ebe8bc7c5df1ee9c4456c7baf20 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Mon, 28 Jan 2019 17:19:05 +0100 Subject: [PATCH 19/51] Remove deprecated mbregex aliases These have been deprecated in PHP 7.3 as part of https://wiki.php.net/rfc/deprecations_php_7_3. --- UPGRADING | 17 +++++++++++ ext/mbstring/php_mbregex.h | 16 +--------- ext/mbstring/tests/mb_ereg3.phpt | 52 -------------------------------- 3 files changed, 18 insertions(+), 67 deletions(-) delete mode 100644 ext/mbstring/tests/mb_ereg3.phpt diff --git a/UPGRADING b/UPGRADING index 882241eacf0b1..c96c4bcf919f2 100644 --- a/UPGRADING +++ b/UPGRADING @@ -46,6 +46,23 @@ PHP 8.0 UPGRADE NOTES also been removed. Finally, the "func_overload" and "func_overload_list" entries in mb_get_info() have been removed. . mb_parse_str() can no longer be used without specifying a result array. + . A number of deprecated mbregex aliases have been removed. See the following + list for which functions should be used instead: + + * mbregex_encoding() -> mb_regex_encoding() + * mbereg() -> mb_ereg() + * mberegi() -> mb_eregi() + * mbereg_replace() -> mb_ereg_replace() + * mberegi_replace() -> mb_eregi_replace() + * mbsplit() -> mb_split() + * mbereg_match() -> mb_ereg_match() + * mbereg_search() -> mb_ereg_search() + * mbereg_search_pos() -> mb_ereg_search_pos() + * mbereg_search_regs() -> mb_ereg_search_regs() + * mbereg_search_init() -> mb_ereg_search_init() + * mbereg_search_getregs() -> mb_ereg_search_getregs() + * mbereg_search_getpos() -> mb_ereg_search_getpos() + * mbereg_search_setpos() -> mb_ereg_search_setpos() - Standard: . assert() will no longer evaluate string arguments, instead they will be diff --git a/ext/mbstring/php_mbregex.h b/ext/mbstring/php_mbregex.h index 5ada93fcc5913..47cd4c6e2237a 100644 --- a/ext/mbstring/php_mbregex.h +++ b/ext/mbstring/php_mbregex.h @@ -41,21 +41,7 @@ PHP_FE(mb_ereg_search_init, arginfo_mb_ereg_search_init) \ PHP_FE(mb_ereg_search_getregs, arginfo_mb_ereg_search_getregs) \ PHP_FE(mb_ereg_search_getpos, arginfo_mb_ereg_search_getpos) \ - PHP_FE(mb_ereg_search_setpos, arginfo_mb_ereg_search_setpos) \ - PHP_DEP_FALIAS(mbregex_encoding, mb_regex_encoding, arginfo_mb_regex_encoding) \ - PHP_DEP_FALIAS(mbereg, mb_ereg, arginfo_mb_ereg) \ - PHP_DEP_FALIAS(mberegi, mb_eregi, arginfo_mb_eregi) \ - PHP_DEP_FALIAS(mbereg_replace, mb_ereg_replace, arginfo_mb_ereg_replace) \ - PHP_DEP_FALIAS(mberegi_replace, mb_eregi_replace, arginfo_mb_eregi_replace) \ - PHP_DEP_FALIAS(mbsplit, mb_split, arginfo_mb_split) \ - PHP_DEP_FALIAS(mbereg_match, mb_ereg_match, arginfo_mb_ereg_match) \ - PHP_DEP_FALIAS(mbereg_search, mb_ereg_search, arginfo_mb_ereg_search) \ - PHP_DEP_FALIAS(mbereg_search_pos, mb_ereg_search_pos, arginfo_mb_ereg_search_pos) \ - PHP_DEP_FALIAS(mbereg_search_regs, mb_ereg_search_regs, arginfo_mb_ereg_search_regs) \ - PHP_DEP_FALIAS(mbereg_search_init, mb_ereg_search_init, arginfo_mb_ereg_search_init) \ - PHP_DEP_FALIAS(mbereg_search_getregs, mb_ereg_search_getregs, arginfo_mb_ereg_search_getregs) \ - PHP_DEP_FALIAS(mbereg_search_getpos, mb_ereg_search_getpos, arginfo_mb_ereg_search_getpos) \ - PHP_DEP_FALIAS(mbereg_search_setpos, mb_ereg_search_setpos, arginfo_mb_ereg_search_setpos) + PHP_FE(mb_ereg_search_setpos, arginfo_mb_ereg_search_setpos) /* }}} */ #define PHP_MBREGEX_MAXCACHE 50 diff --git a/ext/mbstring/tests/mb_ereg3.phpt b/ext/mbstring/tests/mb_ereg3.phpt deleted file mode 100644 index c59156344454d..0000000000000 --- a/ext/mbstring/tests/mb_ereg3.phpt +++ /dev/null @@ -1,52 +0,0 @@ ---TEST-- -mb_ereg() returning matches ---SKIPIF-- - ---FILE-- - ---EXPECTF-- -Deprecated: Function mbereg() is deprecated in %s on line %d -int(-1) -int(-1) -array(1) { - [0]=> - string(2) "-1" -} - -Deprecated: Function mberegi() is deprecated in %s on line %d -int(-1) -int(-1) -array(1) { - [0]=> - string(2) "-1" -} - -Deprecated: Function mbereg_search_init() is deprecated in %s on line %d - -Warning: mbereg_search_init() expects parameter 3 to be string, array given in %s on line %d -int(-1) -int(-1) -array(1) { - [0]=> - string(2) "-1" -} -Done From c7d7af8069246c886606501e30e6e8741e6683c2 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Mon, 28 Jan 2019 17:40:39 +0100 Subject: [PATCH 20/51] Remove fgetss and friends These were deprecated in PHP 7.3 as part of https://wiki.php.net/rfc/deprecations_php_7_3. --- UPGRADING | 8 + ext/opcache/Optimizer/zend_func_info.c | 2 - ext/spl/spl_directory.c | 29 - ext/spl/tests/bug45216.phpt | 25 - ext/standard/basic_functions.c | 7 - ext/standard/file.c | 51 -- ext/standard/file.h | 1 - ext/standard/filters.c | 124 ---- ext/standard/tests/file/fgetss.phpt | 144 ----- ext/standard/tests/file/fgetss1.phpt | 73 --- ext/standard/tests/file/fgetss_basic1.phpt | 137 ----- .../tests/file/fgetss_basic2-win32-mb.phpt | 218 ------- .../tests/file/fgetss_basic2-win32.phpt | 218 ------- ext/standard/tests/file/fgetss_basic2.phpt | 216 ------- ext/standard/tests/file/fgetss_error.phpt | 108 ---- .../tests/file/fgetss_variation1-win32.phpt | 174 ------ .../tests/file/fgetss_variation1.phpt | 170 ------ .../tests/file/fgetss_variation2.phpt | 436 ------------- .../tests/file/fgetss_variation3-win32.phpt | 573 ------------------ .../tests/file/fgetss_variation3.phpt | 569 ----------------- .../tests/file/fgetss_variation4.phpt | 170 ------ .../tests/file/fgetss_variation5-win32.phpt | 222 ------- .../tests/file/fgetss_variation5.phpt | 219 ------- .../tests/filters/strip_tags_filter.phpt | 29 - ext/zlib/tests/gzgetss.phpt | 32 - ext/zlib/zlib.c | 7 - 26 files changed, 8 insertions(+), 3954 deletions(-) delete mode 100644 ext/spl/tests/bug45216.phpt delete mode 100644 ext/standard/tests/file/fgetss.phpt delete mode 100644 ext/standard/tests/file/fgetss1.phpt delete mode 100644 ext/standard/tests/file/fgetss_basic1.phpt delete mode 100644 ext/standard/tests/file/fgetss_basic2-win32-mb.phpt delete mode 100644 ext/standard/tests/file/fgetss_basic2-win32.phpt delete mode 100644 ext/standard/tests/file/fgetss_basic2.phpt delete mode 100644 ext/standard/tests/file/fgetss_error.phpt delete mode 100644 ext/standard/tests/file/fgetss_variation1-win32.phpt delete mode 100644 ext/standard/tests/file/fgetss_variation1.phpt delete mode 100644 ext/standard/tests/file/fgetss_variation2.phpt delete mode 100644 ext/standard/tests/file/fgetss_variation3-win32.phpt delete mode 100644 ext/standard/tests/file/fgetss_variation3.phpt delete mode 100644 ext/standard/tests/file/fgetss_variation4.phpt delete mode 100644 ext/standard/tests/file/fgetss_variation5-win32.phpt delete mode 100644 ext/standard/tests/file/fgetss_variation5.phpt delete mode 100644 ext/standard/tests/filters/strip_tags_filter.phpt delete mode 100644 ext/zlib/tests/gzgetss.phpt diff --git a/UPGRADING b/UPGRADING index c96c4bcf919f2..98667b0091792 100644 --- a/UPGRADING +++ b/UPGRADING @@ -64,6 +64,9 @@ PHP 8.0 UPGRADE NOTES * mbereg_search_getpos() -> mb_ereg_search_getpos() * mbereg_search_setpos() -> mb_ereg_search_setpos() +- SPL: + . SplFileObject::fgetss() has been removed. + - Standard: . assert() will no longer evaluate string arguments, instead they will be treated like any other argument. assert($a == $b) should be used instead of @@ -71,6 +74,11 @@ PHP 8.0 UPGRADE NOTES ASSERT_QUIET_EVAL constants have also been removed, as they would no longer have any effect. . parse_str() can no longer be used without specifying a result array. + . fgetss() has been removed. + . The string.strip_tags filter has been removed. + +- Zlib: + . gzgetss() has been removed. ======================================== 2. New Features diff --git a/ext/opcache/Optimizer/zend_func_info.c b/ext/opcache/Optimizer/zend_func_info.c index 7405913846f05..f14c3faa0d5aa 100644 --- a/ext/opcache/Optimizer/zend_func_info.c +++ b/ext/opcache/Optimizer/zend_func_info.c @@ -615,7 +615,6 @@ static const func_info_t func_infos[] = { F0("feof", MAY_BE_FALSE | MAY_BE_TRUE), F1("fgetc", MAY_BE_FALSE | MAY_BE_STRING), F1("fgets", MAY_BE_FALSE | MAY_BE_STRING), - F1("fgetss", MAY_BE_FALSE | MAY_BE_STRING), F1("fread", MAY_BE_FALSE | MAY_BE_STRING), F1("fopen", MAY_BE_FALSE | MAY_BE_RESOURCE), F0("fpassthru", MAY_BE_FALSE | MAY_BE_LONG), @@ -1263,7 +1262,6 @@ static const func_info_t func_infos[] = { F0("gzeof", MAY_BE_FALSE | MAY_BE_TRUE), F1("gzgetc", MAY_BE_FALSE | MAY_BE_STRING), F1("gzgets", MAY_BE_FALSE | MAY_BE_STRING), - F1("gzgetss", MAY_BE_FALSE | MAY_BE_STRING), F1("gzread", MAY_BE_FALSE | MAY_BE_STRING), F1("gzopen", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_RESOURCE), F0("gzpassthru", MAY_BE_FALSE | MAY_BE_LONG), diff --git a/ext/spl/spl_directory.c b/ext/spl/spl_directory.c index ccfbea03e3f78..43377ba012d1d 100644 --- a/ext/spl/spl_directory.c +++ b/ext/spl/spl_directory.c @@ -2826,30 +2826,6 @@ SPL_METHOD(SplFileObject, fgetc) } } /* }}} */ -/* {{{ proto string SplFileObject::fgetss([string allowable_tags]) - Get a line from file pointer and strip HTML tags */ -SPL_METHOD(SplFileObject, fgetss) -{ - spl_filesystem_object *intern = Z_SPLFILESYSTEM_P(ZEND_THIS); - zval arg2; - - if(!intern->u.file.stream) { - zend_throw_exception_ex(spl_ce_RuntimeException, 0, "Object not initialized"); - return; - } - - if (intern->u.file.max_line_len > 0) { - ZVAL_LONG(&arg2, intern->u.file.max_line_len); - } else { - ZVAL_LONG(&arg2, 1024); - } - - spl_filesystem_file_free_line(intern); - intern->u.file.current_line_num++; - - FileFunctionCall(fgetss, ZEND_NUM_ARGS(), &arg2); -} /* }}} */ - /* {{{ proto int SplFileObject::fpassthru() Output all remaining data from a file pointer */ SPL_METHOD(SplFileObject, fpassthru) @@ -3038,10 +3014,6 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_file_object_fseek, 0, 0, 1) ZEND_ARG_INFO(0, whence) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_file_object_fgetss, 0, 0, 0) - ZEND_ARG_INFO(0, allowable_tags) -ZEND_END_ARG_INFO() - ZEND_BEGIN_ARG_INFO_EX(arginfo_file_object_fscanf, 0, 0, 1) ZEND_ARG_INFO(0, format) ZEND_ARG_VARIADIC_INFO(1, vars) @@ -3080,7 +3052,6 @@ static const zend_function_entry spl_SplFileObject_functions[] = { SPL_ME(SplFileObject, fseek, arginfo_file_object_fseek, ZEND_ACC_PUBLIC) SPL_ME(SplFileObject, fgetc, arginfo_splfileinfo_void, ZEND_ACC_PUBLIC) SPL_ME(SplFileObject, fpassthru, arginfo_splfileinfo_void, ZEND_ACC_PUBLIC) - SPL_ME(SplFileObject, fgetss, arginfo_file_object_fgetss, ZEND_ACC_PUBLIC) SPL_ME(SplFileObject, fscanf, arginfo_file_object_fscanf, ZEND_ACC_PUBLIC) SPL_ME(SplFileObject, fwrite, arginfo_file_object_fwrite, ZEND_ACC_PUBLIC) SPL_ME(SplFileObject, fread, arginfo_file_object_fread, ZEND_ACC_PUBLIC) diff --git a/ext/spl/tests/bug45216.phpt b/ext/spl/tests/bug45216.phpt deleted file mode 100644 index 31e6d62352d6a..0000000000000 --- a/ext/spl/tests/bug45216.phpt +++ /dev/null @@ -1,25 +0,0 @@ ---TEST-- -SPL: SplFileObject::fgetss (bug 45216) ---CREDITS-- -Perrick Penet -#testfest phpcampparis 2008-06-07 ---FILE-- -text 1'); -$handle = fopen($file, 'r'); - -$object = new SplFileObject($file); -var_dump($object->fgetss()); -var_dump(fgetss($handle)); -?> ---CLEAN-- - ---EXPECTF-- -Deprecated: Function fgetss() is deprecated in %s on line %d -string(12) "text 0text 1" - -Deprecated: Function fgetss() is deprecated in %s on line %d -string(12) "text 0text 1" diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c index d77ef73ca035a..2bd6c602254ff 100644 --- a/ext/standard/basic_functions.c +++ b/ext/standard/basic_functions.c @@ -1101,12 +1101,6 @@ ZEND_BEGIN_ARG_INFO(arginfo_fgetc, 0) ZEND_ARG_INFO(0, fp) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_fgetss, 0, 0, 1) - ZEND_ARG_INFO(0, fp) - ZEND_ARG_INFO(0, length) - ZEND_ARG_INFO(0, allowable_tags) -ZEND_END_ARG_INFO() - ZEND_BEGIN_ARG_INFO_EX(arginfo_fscanf, 0, 0, 2) ZEND_ARG_INFO(0, stream) ZEND_ARG_INFO(0, format) @@ -3132,7 +3126,6 @@ static const zend_function_entry basic_functions[] = { /* {{{ */ PHP_FE(feof, arginfo_feof) PHP_FE(fgetc, arginfo_fgetc) PHP_FE(fgets, arginfo_fgets) - PHP_DEP_FE(fgetss, arginfo_fgetss) PHP_FE(fread, arginfo_fread) PHP_NAMED_FE(fopen, php_if_fopen, arginfo_fopen) PHP_FE(fpassthru, arginfo_fpassthru) diff --git a/ext/standard/file.c b/ext/standard/file.c index 93b58e9a94ddd..1057c683c840b 100644 --- a/ext/standard/file.c +++ b/ext/standard/file.c @@ -1090,55 +1090,6 @@ PHPAPI PHP_FUNCTION(fgetc) } /* }}} */ -/* {{{ proto string fgetss(resource fp [, int length [, string allowable_tags]]) - Get a line from file pointer and strip HTML tags */ -PHPAPI PHP_FUNCTION(fgetss) -{ - zval *fd; - zend_long bytes = 0; - size_t len = 0; - size_t actual_len, retval_len; - char *buf = NULL, *retval; - php_stream *stream; - char *allowed_tags=NULL; - size_t allowed_tags_len=0; - - ZEND_PARSE_PARAMETERS_START(1, 3) - Z_PARAM_RESOURCE(fd) - Z_PARAM_OPTIONAL - Z_PARAM_LONG(bytes) - Z_PARAM_STRING(allowed_tags, allowed_tags_len) - ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE); - - PHP_STREAM_TO_ZVAL(stream, fd); - - if (ZEND_NUM_ARGS() >= 2) { - if (bytes <= 0) { - php_error_docref(NULL, E_WARNING, "Length parameter must be greater than 0"); - RETURN_FALSE; - } - - len = (size_t) bytes; - buf = safe_emalloc(sizeof(char), (len + 1), 0); - /*needed because recv doesn't set null char at end*/ - memset(buf, 0, len + 1); - } - - if ((retval = php_stream_get_line(stream, buf, len, &actual_len)) == NULL) { - if (buf != NULL) { - efree(buf); - } - RETURN_FALSE; - } - - retval_len = php_strip_tags(retval, actual_len, &stream->fgetss_state, allowed_tags, allowed_tags_len); - - // TODO: avoid reallocation ??? - RETVAL_STRINGL(retval, retval_len); - efree(retval); -} -/* }}} */ - /* {{{ proto mixed fscanf(resource stream, string format [, string ...]) Implements a mostly ANSI compatible fscanf() */ PHP_FUNCTION(fscanf) @@ -1986,8 +1937,6 @@ PHP_FUNCTION(fgetcsv) char enclosure = '"'; /* allow this to be set as parameter */ int escape = (unsigned char) '\\'; - /* first section exactly as php_fgetss */ - zend_long len = 0; size_t buf_len; char *buf; diff --git a/ext/standard/file.h b/ext/standard/file.h index f5019d422bac8..19a54b5461e59 100644 --- a/ext/standard/file.h +++ b/ext/standard/file.h @@ -35,7 +35,6 @@ PHPAPI PHP_FUNCTION(fread); PHPAPI PHP_FUNCTION(fgetc); PHPAPI PHP_FUNCTION(fgets); PHP_FUNCTION(fscanf); -PHPAPI PHP_FUNCTION(fgetss); PHP_FUNCTION(fgetcsv); PHP_FUNCTION(fputcsv); PHPAPI PHP_FUNCTION(fwrite); diff --git a/ext/standard/filters.c b/ext/standard/filters.c index 7b039cd18f953..b73e8148b647b 100644 --- a/ext/standard/filters.c +++ b/ext/standard/filters.c @@ -166,129 +166,6 @@ static const php_stream_filter_factory strfilter_tolower_factory = { }; /* }}} */ -/* {{{ strip_tags filter implementation */ -typedef struct _php_strip_tags_filter { - const char *allowed_tags; - int allowed_tags_len; - uint8_t state; - uint8_t persistent; -} php_strip_tags_filter; - -static int php_strip_tags_filter_ctor(php_strip_tags_filter *inst, zend_string *allowed_tags, int persistent) -{ - if (allowed_tags != NULL) { - if (NULL == (inst->allowed_tags = pemalloc(ZSTR_LEN(allowed_tags) + 1, persistent))) { - return FAILURE; - } - memcpy((char *)inst->allowed_tags, ZSTR_VAL(allowed_tags), ZSTR_LEN(allowed_tags) + 1); - inst->allowed_tags_len = (int)ZSTR_LEN(allowed_tags); - } else { - inst->allowed_tags = NULL; - } - inst->state = 0; - inst->persistent = persistent; - - return SUCCESS; -} - -static void php_strip_tags_filter_dtor(php_strip_tags_filter *inst) -{ - if (inst->allowed_tags != NULL) { - pefree((void *)inst->allowed_tags, inst->persistent); - } -} - -static php_stream_filter_status_t strfilter_strip_tags_filter( - php_stream *stream, - php_stream_filter *thisfilter, - php_stream_bucket_brigade *buckets_in, - php_stream_bucket_brigade *buckets_out, - size_t *bytes_consumed, - int flags - ) -{ - php_stream_bucket *bucket; - size_t consumed = 0; - php_strip_tags_filter *inst = (php_strip_tags_filter *) Z_PTR(thisfilter->abstract); - - while (buckets_in->head) { - bucket = php_stream_bucket_make_writeable(buckets_in->head); - consumed = bucket->buflen; - - bucket->buflen = php_strip_tags(bucket->buf, bucket->buflen, &(inst->state), inst->allowed_tags, inst->allowed_tags_len); - - php_stream_bucket_append(buckets_out, bucket); - } - - if (bytes_consumed) { - *bytes_consumed = consumed; - } - - return PSFS_PASS_ON; -} - -static void strfilter_strip_tags_dtor(php_stream_filter *thisfilter) -{ - assert(Z_PTR(thisfilter->abstract) != NULL); - - php_strip_tags_filter_dtor((php_strip_tags_filter *)Z_PTR(thisfilter->abstract)); - - pefree(Z_PTR(thisfilter->abstract), ((php_strip_tags_filter *)Z_PTR(thisfilter->abstract))->persistent); -} - -static const php_stream_filter_ops strfilter_strip_tags_ops = { - strfilter_strip_tags_filter, - strfilter_strip_tags_dtor, - "string.strip_tags" -}; - -static php_stream_filter *strfilter_strip_tags_create(const char *filtername, zval *filterparams, uint8_t persistent) -{ - php_strip_tags_filter *inst; - php_stream_filter *filter = NULL; - zend_string *allowed_tags = NULL; - - php_error_docref(NULL, E_DEPRECATED, "The string.strip_tags filter is deprecated"); - - inst = pemalloc(sizeof(php_strip_tags_filter), persistent); - - if (filterparams != NULL) { - if (Z_TYPE_P(filterparams) == IS_ARRAY) { - smart_str tags_ss = {0}; - zval *tmp; - - ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(filterparams), tmp) { - convert_to_string_ex(tmp); - smart_str_appendc(&tags_ss, '<'); - smart_str_append(&tags_ss, Z_STR_P(tmp)); - smart_str_appendc(&tags_ss, '>'); - } ZEND_HASH_FOREACH_END(); - smart_str_0(&tags_ss); - allowed_tags = tags_ss.s; - } else { - allowed_tags = zval_get_string(filterparams); - } - } - - if (php_strip_tags_filter_ctor(inst, allowed_tags, persistent) == SUCCESS) { - filter = php_stream_filter_alloc(&strfilter_strip_tags_ops, inst, persistent); - } else { - pefree(inst, persistent); - } - - if (allowed_tags) { - zend_string_release(allowed_tags); - } - - return filter; -} - -static const php_stream_filter_factory strfilter_strip_tags_factory = { - strfilter_strip_tags_create -}; - -/* }}} */ - /* {{{ base64 / quoted_printable stream filter implementation */ typedef enum _php_conv_err_t { @@ -2037,7 +1914,6 @@ static const struct { { &strfilter_rot13_ops, &strfilter_rot13_factory }, { &strfilter_toupper_ops, &strfilter_toupper_factory }, { &strfilter_tolower_ops, &strfilter_tolower_factory }, - { &strfilter_strip_tags_ops, &strfilter_strip_tags_factory }, { &strfilter_convert_ops, &strfilter_convert_factory }, { &consumed_filter_ops, &consumed_filter_factory }, { &chunked_filter_ops, &chunked_filter_factory }, diff --git a/ext/standard/tests/file/fgetss.phpt b/ext/standard/tests/file/fgetss.phpt deleted file mode 100644 index 41ac46dc92184..0000000000000 --- a/ext/standard/tests/file/fgetss.phpt +++ /dev/null @@ -1,144 +0,0 @@ ---TEST-- -fgetss() tests ---FILE-- -aaaaaa\ndddddd", - "asdqw\naaaa<>qqqq", - "aaaqqq", - "asdasdblah", - "some another text <> hoho " - ); - -foreach ($array as $str) { - file_put_contents($filename, $str); - $fp = fopen($filename, "r"); - var_dump(fgetss($fp)); - var_dump(fgetss($fp)); -} - -foreach ($array as $str) { - file_put_contents($filename, $str); - $fp = fopen($filename, "r"); - var_dump(fgetss($fp, 10)); - var_dump(fgetss($fp, 10)); -} - -var_dump(fgetss($fp, -10)); -var_dump(fgetss($fp, 0)); -fclose($fp); -var_dump(fgetss($fp, 0)); - -@unlink($filename); - -echo "Done\n"; -?> ---EXPECTF-- -Deprecated: Function fgetss() is deprecated in %s on line %d -string(18) "askasdfasdfaaaaaa -" - -Deprecated: Function fgetss() is deprecated in %s on line %d -string(6) "dddddd" - -Deprecated: Function fgetss() is deprecated in %s on line %d -string(6) "asdqw -" - -Deprecated: Function fgetss() is deprecated in %s on line %d -string(8) "aaaaqqqq" - -Deprecated: Function fgetss() is deprecated in %s on line %d -string(23) "aaafunction foo() {}qqq" - -Deprecated: Function fgetss() is deprecated in %s on line %d -bool(false) - -Deprecated: Function fgetss() is deprecated in %s on line %d -string(6) "asdasd" - -Deprecated: Function fgetss() is deprecated in %s on line %d -string(0) "" - -Deprecated: Function fgetss() is deprecated in %s on line %d -bool(false) - -Deprecated: Function fgetss() is deprecated in %s on line %d -bool(false) - -Deprecated: Function fgetss() is deprecated in %s on line %d -string(11) "some text -" - -Deprecated: Function fgetss() is deprecated in %s on line %d -string(4) "blah" - -Deprecated: Function fgetss() is deprecated in %s on line %d -string(24) "some another text hoho " - -Deprecated: Function fgetss() is deprecated in %s on line %d -bool(false) - -Deprecated: Function fgetss() is deprecated in %s on line %d -string(9) "askasdfas" - -Deprecated: Function fgetss() is deprecated in %s on line %d -string(6) "dfaaaa" - -Deprecated: Function fgetss() is deprecated in %s on line %d -string(5) "asdqw" - -Deprecated: Function fgetss() is deprecated in %s on line %d -string(0) "" - -Deprecated: Function fgetss() is deprecated in %s on line %d -string(3) "aaa" - -Deprecated: Function fgetss() is deprecated in %s on line %d -string(7) "functio" - -Deprecated: Function fgetss() is deprecated in %s on line %d -string(6) "asdasd" - -Deprecated: Function fgetss() is deprecated in %s on line %d -string(0) "" - -Deprecated: Function fgetss() is deprecated in %s on line %d -bool(false) - -Deprecated: Function fgetss() is deprecated in %s on line %d -bool(false) - -Deprecated: Function fgetss() is deprecated in %s on line %d -string(9) "some text" - -Deprecated: Function fgetss() is deprecated in %s on line %d -string(2) " -" - -Deprecated: Function fgetss() is deprecated in %s on line %d -string(9) "some anot" - -Deprecated: Function fgetss() is deprecated in %s on line %d -string(9) "her text " - -Deprecated: Function fgetss() is deprecated in %s on line %d - -Warning: fgetss(): Length parameter must be greater than 0 in %s on line %d -bool(false) - -Deprecated: Function fgetss() is deprecated in %s on line %d - -Warning: fgetss(): Length parameter must be greater than 0 in %s on line %d -bool(false) - -Deprecated: Function fgetss() is deprecated in %s on line %d - -Warning: fgetss(): supplied resource is not a valid stream resource in %s on line %d -bool(false) -Done diff --git a/ext/standard/tests/file/fgetss1.phpt b/ext/standard/tests/file/fgetss1.phpt deleted file mode 100644 index 0266371865e71..0000000000000 --- a/ext/standard/tests/file/fgetss1.phpt +++ /dev/null @@ -1,73 +0,0 @@ ---TEST-- -more fgetss() tests ---FILE-- -aaaaaa\ndddddd", - "asdqw\naaaa<>qqqq", - "aaaqqq", - "asdasdblah", - "some another text <> hoho " - ); - -foreach ($array as $str) { - file_put_contents($filename, $str); - $fp = fopen($filename, "r"); - var_dump(fgetss($fp, 1000, ",,")); - var_dump(fgetss($fp)); -} - -foreach ($array as $str) { - file_put_contents($filename, $str); - $fp = fopen($filename, "r"); - var_dump(fgetss($fp, 10)); - var_dump(fgetss($fp, 10, "