summaryrefslogtreecommitdiff
path: root/Zend
Commit message (Collapse)AuthorAgeFilesLines
...
* | | Move optimizer into coreNikita Popov2021-01-2834-0/+23537
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This only moves the files, adjusts the build system, exports APIs and does minor fixups to make sure the code builds. This does not yet try to make the optimizer usable independently of opcache. Closes GH-6642.
* | | Merge branch 'PHP-8.0'Nikita Popov2021-01-282-2/+2
|\ \ \ | |/ / | | | | | | | | | * PHP-8.0: Fix stub for Serializable::serialize()
| * | Fix stub for Serializable::serialize()Michael Voříšek2021-01-282-2/+2
| | | | | | | | | | | | This method may also return null.
* | | Merge branch 'PHP-8.0'Nikita Popov2021-01-281-1/+1
|\ \ \ | |/ / | | | | | | | | | * PHP-8.0: Observe fake closures
| * | Observe fake closuresSammy Kaye Powers2021-01-281-1/+1
| | | | | | | | | | | | Closes GH-6607.
* | | Merge branch 'PHP-8.0'Dmitry Stogov2021-01-263-11/+14
|\ \ \ | |/ / | | | | | | | | | * PHP-8.0: Allow observer handlers disabling optimization in RETURN opcode handler, that may cause loss value of returned local variable.
| * | Allow observer handlers disabling optimization in RETURN opcode handler, ↵Dmitry Stogov2021-01-263-11/+14
| | | | | | | | | | | | that may cause loss value of returned local variable.
* | | Merge branch 'PHP-8.0'Dmitry Stogov2021-01-261-2/+6
|\ \ \ | |/ / | | | | | | | | | * PHP-8.0: Skip dummy frames allocated on CPU stack of zend_call_function(). (Usage of "current_observed_frame" varible looks unsafe to me).
| * | Skip dummy frames allocated on CPU stack of zend_call_function().Dmitry Stogov2021-01-261-2/+6
| | | | | | | | | | | | (Usage of "current_observed_frame" varible looks unsafe to me).
* | | Merge branch 'PHP-8.0'Nikita Popov2021-01-262-6/+6
|\ \ \ | |/ / | | | | | | | | | * PHP-8.0: Fix VAR return type verification
| * | Fix VAR return type verificationNikita Popov2021-01-262-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We should also set retval_ref when de-indirecting. Otherwise the retval_ref != retval_ptr comparison below may incorrect assume that we're returning a reference. I don't have a reliable reproducer for this issue, but it sometimes appears in certain configurations in arrow_functions/007.phpt in conjunction with other changes.
* | | Add missing resource key warning for unset()Nikita Popov2021-01-263-0/+43
| | | | | | | | | | | | | | | It was present on other operations, including isset(), but was missing for unset().
* | | Add support for generating class entries from stubsMáté Kocsis2021-01-266-72/+329
| | | | | | | | | | | | | | | | | | Closes GH-6289 Co-authored-by: Nikita Popov <nikita.ppv@gmail.com>
* | | Merge branch 'PHP-8.0'Nikita Popov2021-01-252-10/+38
|\ \ \ | |/ / | | | | | | | | | * PHP-8.0: Improve switch continue warning
| * | Improve switch continue warningNikita Popov2021-01-252-10/+38
| | | | | | | | | | | | | | | Don't suggest "continue N+1" if there is no wrapping loop. The resulting code would be illegal.
| * | Next is 8.0.3Gabriel Caruso2021-01-191-1/+1
| | |
* | | Fix parsing of semi-reserved tokens at offset > 4 GBNikita Popov2021-01-253-15/+14
| | | | | | | | | | | | | | | | | | | | | To avoid increasing the size of parser stack elements by storing size_t offset and length, this instead only stores the start offset (or rather pointer now) and determines the length of the identifier in zend_lex_tstring.
* | | Improve error message for leading comma in keyed list assignmentNikita Popov2021-01-252-2/+21
| | | | | | | | | | | | | | | | | | Print "Cannot use empty array entries in keyed array assignment" instead of "Cannot mix keyed and unkeyed array entries in assignments" for a leading comma.
* | | Accept zend_string in zend_prepare_string_for_scanningNikita Popov2021-01-214-13/+14
| | |
* | | Add array_is_list(array $array) functionDusk2021-01-201-0/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This function tests if an array contains only sequential integer keys. While list isn't an official type, this usage is consistent with the community usage of "list" as an annotation type, cf. https://psalm.dev/docs/annotating_code/type_syntax/array_types/#lists Rebased and modified version of #4886 - Use .stub.php files - Add opcache constant evaluation when argument is a constant - Change from is_list(mixed $value) to array_is_list(array $array) RFC: https://wiki.php.net/rfc/is_list Co-Authored-By: Tyson Andre <tysonandre775@hotmail.com> Co-Authored-By: Dusk <dusk@woofle.net> Closes GH-6070
* | | Rename zend-test to zend_testNikita Popov2021-01-1917-18/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The extension name should match the name of the ext/ directory, otherwise it will not get picked up by run-tests. It would be possible to remap this in run-tests, but I think it's better to rename the extension to follow the standard format. Other extensions also use underscore instead of hyphen (e.g. pdo_mysql and not pdo-mysql). Of course, the ./configure option remains hyphenated. Closes GH-6613.
* | | Mark classes cached by opcache by ZEND_ACC_CACHED flag and prevent useless ↵Dmitry Stogov2021-01-193-29/+41
| | | | | | | | | | | | copying and desrpoying of immutable data.
* | | Avoid modification of trait infoDmitry Stogov2021-01-191-3/+0
| | |
* | | Delete an outdated comment for read_property and read_dimension. [ci skip]sj-i2021-01-191-4/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The comment is outdated as of PHP7. For example, in the current code, zend_assign_op_overloaded_property() expects the refcount of the returned value from read_property to be greater than 0 when the returned value is a refcounted, to call zval_ptr_dtor() later. History: - The same description was originally written in a commit in 2004 alongside the write side. https://github.com/php/php-src/commit/c8c0e979826b677de5f786920289056242ea5c54 - One requested to put the description in somewhere. https://externals.io/message/7789 - Then it was added as a comment in zend_object_handler.h . https://github.com/php/php-src/commit/7d3215d33321173c58db4d86b7398e16c5c55d13 - At the time the comment was written, there were at least three places where the code actually set the reference count to 0 in read_properties. - https://github.com/php/php-src/blob/7d3215d33321173c58db4d86b7398e16c5c55d13/ext/dom/php_dom.c#L229 - https://github.com/php/php-src/blob/7d3215d33321173c58db4d86b7398e16c5c55d13/ext/mysqli/mysqli.c#L190 - https://github.com/php/php-src/blob/7d3215d33321173c58db4d86b7398e16c5c55d13/ext/simplexml/simplexml.c#L245 - All three of the above were removed during the development of PHP 7. - https://github.com/php/php-src/commit/2f0a758fbbf39ff8684d167f86c708cc361db782 - https://github.com/php/php-src/commit/2402d6cbbc5e04362b23b183f9129a8db230bcce - https://github.com/php/php-src/commit/a975c7e0fe95a94c119eb1c8e519b2357aa50dcc - In the current code, even when they generate and return a refcounted value, its refcount would be 1. Closes GH-6618.
* | | Fix $GLOBALS[] in isset and unsetNikita Popov2021-01-183-0/+24
| | | | | | | | | | | | | | | | | | | | | I've previously addressed the case of assignments, but the same issue exists for isset and unset. Fixes oss-fuzz #29699.
* | | Check for append to $GLOBALSNikita Popov2021-01-152-0/+14
| | | | | | | | | | | | Fixes oss-fuzz #29389.
* | | Replace zend_bool uses with boolNikita Popov2021-01-1562-574/+574
| | | | | | | | | | | | | | | | | | | | | We're starting to see a mix between uses of zend_bool and bool. Replace all usages with the standard bool type everywhere. Of course, zend_bool is retained as an alias.
* | | compare_function() returns zend_resultNikita Popov2021-01-151-1/+1
| | |
* | | Remove the convert_to_long_base functionNikita Popov2021-01-152-14/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | This function is unused in php-src, and has somewhat dubious semantics, especially since we switched convert_to_long to not use strtol for the base 10 case. If you want to convert strings from a different base, use ZEND_STRTOL directly.
* | | Remove zend_locale_sprintf_double()Nikita Popov2021-01-142-11/+0
| | | | | | | | | | | | | | | | | | This function is unused, and also not particularly useful now that PHP no longer prints doubles in a locale-sensitive way unless someone really goes out of their way to force it.
* | | Make convert_to_*_ex simple aliases of convert_to_*Nikita Popov2021-01-142-59/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Historically, the _ex variants separated the zval first, if a conversion was necessary. This distinction no longer makes sense since PHP 7. The only difference that was still left is that _ex checked whether the type is the same first, but the usage of these macros did not actually distinguish on whether such an inlined check is valuable or not in a given context. Also drop the unused convert_to_explicit_type macros.
* | | Remove Z_PARAM separate params where they don't make senseNikita Popov2021-01-141-72/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | Separation can only possibly make sense for array parameters (or something that can contain arrays, like zval parameters). It never makes sense to separate a bool. The deref parameters are also of dubious utility, but leaving them for now.
* | | Remove SEPARATE_ZVAL_IF_NOT_REF() macroNikita Popov2021-01-141-13/+10
| | | | | | | | | | | | | | | This macro hasn't made sense since PHP 7. The correct pattern to use is ZVAL_DEREF + SEPARATE_ZVAL_NOREF.
* | | Remove SEPARATE_ARG_IF_REF macroNikita Popov2021-01-141-7/+0
| | | | | | | | | | | | | | | | | | | | | The name doesn't correspond to what it does at all, and all the existing usages appear to be unnecessary. Usage of this macro can be replaced by ZVAL_DEREF + Z_TRY_ADDREF_P.
* | | Merge branch 'PHP-8.0'Nikita Popov2021-01-141-1/+1
|\ \ \ | |/ / | | | | | | | | | * PHP-8.0: Fixed bug #80617: Type narrowing warning in ZEND_TYPE_INIT_CODE
| * | Fixed bug #80617: Type narrowing warning in ZEND_TYPE_INIT_CODENikita Popov2021-01-141-1/+1
| | |
* | | Merge branch 'PHP-8.0'Nikita Popov2021-01-142-3/+43
|\ \ \ | |/ / | | | | | | | | | * PHP-8.0: Fixed bug #80596: Fix anonymous class union typehint errors
| * | Fixed bug #80596: Fix anonymous class union typehint errorsDaniil Gentili2021-01-142-3/+43
| | | | | | | | | | | | | | | | | | | | | Cut off part after null byte when resolving the class name, to avoid cutting off a larger part lateron. Closes GH-6601.
* | | Fix #51758: delete an outdated comment from zend_object_handler.h [ci skip]sj-i2021-01-141-5/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The same description was originally written in a commit in 2004 which fixes a bug in the pre-released simplexml. https://github.com/php/php-src/commit/c8c0e979826b677de5f786920289056242ea5c54 One requested to put the description in somewhere. https://externals.io/message/7789 Then it was added as a comment in zend_object_handler.h . https://github.com/php/php-src/commit/7d3215d33321173c58db4d86b7398e16c5c55d13 At the time of the comment written, the refcount of RHS was simply incremented before calling the write handler in the process of ZEND_ASSIGN_OBJ. https://github.com/php/php-src/blob/c8c0e979826b677de5f786920289056242ea5c54/Zend/zend_execute.c#L407 The refcount of a zval may be 0 or 1 if the write handler is called from zend_API in that era. https://github.com/php/php-src/blob/c8c0e979826b677de5f786920289056242ea5c54/Zend/zend_API.c#L1058-L1170 The original fix in simplexml was removed in 2018, because scalar types don't have reference counter anymore as of PHP7. https://github.com/php/php-src/commit/f7f790fcc9d57bcd0b6d356994c67ec746a5ac23 https://github.com/php/php-src/commit/4a475a4976db92e71949786cdf5990c61514261e It seems that the original intent of this prescription was preventing unintended modification to the RHS and values which share the memory location with the RHS in assignments. In the first place, it is not usual trying to change the RHS in a write handler, IMHO. I don't think the description makes sense in the current situation about handling of refcount, so I simply delete the whole sentences. Because write_dimension has no return value, the mentioning about the return value is moved to the comment for write_property only. Closes GH-6597.
* | | Always use CG(arena) for unin type listsDmitry Stogov2021-01-121-30/+29
| | |
* | | Merge branch 'PHP-8.0'Nikita Popov2021-01-122-15/+56
|\ \ \ | |/ / | | | | | | | | | * PHP-8.0: Add support for union types for internal functions
| * | Add support for union types for internal functionsNikita Popov2021-01-122-15/+56
| | | | | | | | | | | | | | | | | | | | | | | | | | | This closes the last hole in the supported types for internal function arginfo types. It's now possible to represent unions of multiple classes. This is done by storing them as TypeA|TypeB and PHP will then convert this into an appropriate union type list. Closes GH-6581.
* | | PHP array cannot refer to EG(symbol_table) any more. Replace corresponding ↵Dmitry Stogov2021-01-113-52/+20
| | | | | | | | | | | | checks by ZEND_ASSERT().
* | | Remove some INDIRECT handling in VMNikita Popov2021-01-065-110/+34
| | |
* | | Restrict allowed usages of $GLOBALSNikita Popov2021-01-0631-608/+842
| | | | | | | | | | | | | | | | | | | | | | | | | | | This restricts allowed usage of $GLOBALS, with the effect that plain PHP arrays can no longer contain INDIRECT elements. RFC: https://wiki.php.net/rfc/restrict_globals_usage Closes GH-6487.
* | | Merge branch 'PHP-8.0'Nikita Popov2021-01-052-1/+19
|\ \ \ | |/ / | | | | | | | | | * PHP-8.0: Fix infinite recursion in unlinked_instanceof
| * | Fix infinite recursion in unlinked_instanceofNikita Popov2021-01-052-1/+19
| | | | | | | | | | | | | | | | | | | | | I suspect this is only a partial fix for the issue, it's probably possible to recurse through a more complex pathway as well. Fixes oss-fuzz #28961.
* | | Fix lexing of zero octal followed by whitespaceNikita Popov2021-01-052-0/+13
| | | | | | | | | | | | | | | | | | | | | We'd call strtol starting at the whitespace, and strtol strips whitespace... Fixes oss-fuzz #29272.
* | | Implement Explicit octal notation for integers RFCGeorge Peter Banyard2021-01-042-4/+47
| | | | | | | | | | | | | | | | | | | | | | | | RFC: https://wiki.php.net/rfc/explicit_octal_notation Add an extensive test suits for other variants of integer literals Closes GH-6360
* | | Use Z_PARAM_OBJ macros when zval isn't neededTyson Andre2021-01-023-19/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In some cases, like spl_object_id, the code is simpler but equally efficient after optimizations. In other cases, like get_mangled_object_vars(), the compiler can't infer that the object in the zval won't change. Closes GH-6567