summaryrefslogtreecommitdiff
path: root/Zend/tests
Commit message (Collapse)AuthorAgeFilesLines
* Merge branch 'PHP-7.3' into PHP-7.4Nikita Popov2019-10-281-0/+24
|\ | | | | | | | | * PHP-7.3: Fix bug #78752
| * Merge branch 'PHP-7.2' into PHP-7.3Nikita Popov2019-10-281-0/+24
| |\ | | | | | | | | | | | | * PHP-7.2: Fix bug #78752
| | * Fix bug #78752Nikita Popov2019-10-281-0/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | NULL out the execute_data before destroying it, otherwise GC may trigger while the execute_data is partially destroyed, resulting in double-frees. The handling of call stack unfreezing is a bit awkward because it's a ZEND_API function, so we can't change the signature.
* | | Fix bug #78226: Don't call __set() on uninitialized typed propertiesNikita Popov2019-10-251-0/+54
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Assigning to an uninitialized typed property will no longer trigger a call to __set(). However, calls to __set() are still triggered if the property is explicitly unset(). This gives us both the behavior people generally expect, and still allows ORMs to do lazy initialization by unsetting properties. For PHP 8, we should fine a way to forbid unsetting of declared properties entirely, and provide a different way to achieve lazy initialization.
* | | Don't autoload when checking property typesNikita Popov2019-10-231-0/+51
| | | | | | | | | | | | | | | | | | | | | | | | | | | Noticed while working on union types: We do not load argument and return types during type checks, but we do load property types. I'm normalizing the behavior towards the existing status quo (not loading), though we may consider loading everywhere (all types, and instanceof) in order to properly support class aliases.
* | | Fix static prop cleanup for dl'ed internal classesNikita Popov2019-10-211-0/+2
| | |
* | | Fix leak with cycle in static prop of internal classNikita Popov2019-10-211-0/+12
| | | | | | | | | | | | | | | More the cleanup of interned classes before the final GC run, just like it is done for user classes.
* | | Fix handling of overflowing invalid octal in tokenizerNikita Popov2019-10-141-1/+1
| | | | | | | | | | | | | | | If token_get_all() is used, we still need to correctly distinguish LNUMBER vs DNUMBER here for backwards compatibility.
* | | Return error_zval form get_property_ptr_ptr on exceptionNikita Popov2019-10-102-10/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This goes in the reverse direction of 4463acb9513dfb62206760c49b3da1fe4d92f40a. After looking around a bit, it seems that we already check for Z_ISERROR_P() on the get_property_ptr_ptr return value in other places. So do this in zend_fetch_property_address() as well, and also make sure that EG(error_zval) is indeed returned on exception in get_property_ptr_ptr. In particular, this fixes the duplicate exceptions that we used to get because first get_property_ptr_ptr threw one and then read_property throws the same exception again.
* | | Fix leak when property AST evaluation failsNikita Popov2019-10-101-6/+7
| | |
* | | Merge branch 'PHP-7.3' into PHP-7.4Nikita Popov2019-10-101-0/+15
|\ \ \ | |/ /
| * | Merge branch 'PHP-7.2' into PHP-7.3Nikita Popov2019-10-101-0/+15
| |\ \ | | |/
| | * Fix leak on static method call on non-existent classNikita Popov2019-10-101-0/+15
| | |
* | | Fix leak on "Cannot assign by reference to overloaded object" errorNikita Popov2019-10-101-6/+11
| | |
* | | Merge branch 'PHP-7.3' into PHP-7.4Nikita Popov2019-10-091-0/+14
|\ \ \ | |/ /
| * | Fixed bug #78658Nikita Popov2019-10-091-0/+14
| | |
* | | Handle "non well formed" exception during ZPPNikita Popov2019-10-082-2/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously if the "non well formed" notice was converted into an exception we'd still end up executing the function. Also drop the now unnecessary EG(exception) checks in the engine. Additionally remote a bogus exception in zend_is_callable: It should only be writing to error, but not directly throwing.
* | | Fixed bug #78648Nikita Popov2019-10-081-2/+17
| | |
* | | Fixed bug #78644Nikita Popov2019-10-081-0/+16
| | | | | | | | | | | | | | | | | | Make sure the initialize the result of FETCH_OBJ_UNSET operations. I'm using a NULL value rather than ERROR here, because the latter no longer exists in master.
* | | Fix leak when include fails in a read operationNikita Popov2019-10-071-0/+12
| | | | | | | | | | | | | | | | | | | | | Usually it will already fail when opening, but reads can also fail since PHP 7.4, in which case we still need to place the file handle in open_files to make sure the destructor will run on it.
* | | Fixed bug #78632Nikita Popov2019-10-041-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I'm going for a very conservative fix here, where the previous logic is restored for the case where an object is passed to method_exists(). We might want to check against EG(scope) instead, but this seems like a safer choice. This means that behavior in PHP 7.4 changes only for method_exists('C', 'privateMethodNotOnC'), which should be sensible.
* | | Fix use-after-free with delayed interned memoized const operandNikita Popov2019-10-041-0/+12
| | | | | | | | | | | | | | | We should addref CONST operands during memoization, as they might be destroyed by later compilation, e.g. through interning.
* | | Fix crash when unpacking into array literal with string keysNikita Popov2019-10-041-0/+20
| | |
* | | Merge branch 'PHP-7.3' into PHP-7.4Nikita Popov2019-10-021-0/+8
|\ \ \ | |/ /
| * | Merge branch 'PHP-7.2' into PHP-7.3Nikita Popov2019-10-021-0/+8
| |\ \ | | |/
| | * Fix segfault with __COMPILER_HALT_OFFSET__ and trailing {}Nikita Popov2019-10-021-0/+8
| | | | | | | | | | | | Fixes OSS-Fuzz #17895.
* | | Remove func copy optimization for private method with static varsNikita Popov2019-10-011-0/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Not NULLing the static_variables pointer for shadow methods during static var shutdown would be a way to avoid this leak, but unless there's evidence that inherited private methods with static vars are actually a common use-case, I don't think we should keep this kind of fragile edge-case optimization. Fixes OSS-Fuzz #17875.
* | | Merge branch 'PHP-7.3' into PHP-7.4Nikita Popov2019-09-281-0/+20
|\ \ \ | |/ /
| * | Don't throw warnings during heredoc scan-aheadNikita Popov2019-09-281-0/+20
| | | | | | | | | | | | Otherwise these warnings will turn up twice (or more...)
* | | Merge branch 'PHP-7.3' into PHP-7.4Nikita Popov2019-09-261-0/+17
|\ \ \ | |/ /
| * | Merge branch 'PHP-7.2' into PHP-7.3Nikita Popov2019-09-261-0/+17
| |\ \ | | |/
| | * Fix memory leak with ** on array operandsNikita Popov2019-09-261-0/+17
| | |
* | | Merge branch 'PHP-7.3' into PHP-7.4Nikita Popov2019-09-261-0/+4
|\ \ \ | |/ /
| * | Merge branch 'PHP-7.2' into PHP-7.3Nikita Popov2019-09-261-0/+4
| |\ \ | | |/
| | * Fix null-pointer deref in if stmt printingNikita Popov2019-09-261-0/+4
| | | | | | | | | | | | Fixes OSS-Fuzz #17721.
* | | Fixed bug #78589Nikita Popov2019-09-241-0/+19
| | | | | | | | | | | | | | | Don't protect GC while destroying zvals. We may need to add GC roots during this phase.
* | | Fix test after unserialize changeNikita Popov2019-09-161-10/+1
| | |
* | | Fixed incorrect usage of QM_ASSIGN instructionDmitry Stogov2019-09-132-11/+16
| | |
* | | Fixed bug #78531 (Crash when using undefined variable as objectDmitry Stogov2019-09-131-0/+18
| | |
* | | Allow throwing exception while loading parent classNikita Popov2019-09-128-12/+130
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a fix for symfony/symfony#32995. The behavior is: * Throwing exception when loading parent/interface is allowed (and we will also throw one if the class is simply not found). * If this happens, the bucket key for the class is reset, so it's possibly to try registering the same class again. * However, if the class has already been used due to a variance obligation, the exception is upgraded to a fatal error, as we cannot safely unregister the class stub anymore.
* | | Improve "already declared" error messageNikita Popov2019-09-111-0/+14
| | | | | | | | | | | | | | | | | | If this error is missing because the rtd_key was renamed to lcname, fetch the class based on lcname and use the class type and cased name from there.
* | | Only allow "nearly linked" classes for parent/interfaceNikita Popov2019-09-113-1/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The requirements for parent/interface are difference than for the variance checks in type declarations. The latter can work on fully unlinked classes, but the former need inheritance to be essentially finished, only variance checks may still be outstanding. Adding a new flag for this because we have lots of space, but we could also represent these "inheritance states" more compactly in the future.
* | | new_variable '{' expr '}' is deprecated as wellChristoph M. Becker2019-09-091-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Curly brace syntax for accessing array elements and string offsets is deprecated [1]; this should also be the case for respective `new` expressions. This issue has been reported by brzuchal@php.net. [1] <https://wiki.php.net/rfc/deprecate_curly_braces_array_access>
* | | Fixed bug #78502Nikita Popov2019-09-061-0/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We need to make sure that the function is fully compiled before we calculate the stack size. There already was a check for directly recursive calls, but the same issue exists with indirectly recursive calls. I'm using DONE_PASS_TWO as the indication that the function is fully compiled.
* | | Improve exception handling for abstract/deprecated callsNikita Popov2019-09-042-0/+51
| | | | | | | | | | | | | | | | | | Reuse existing arg freeing loop instead of duplicating it. Additionally also handle deprecated in DO_FCALL_BY_NAME.
* | | Fix handling of abstract/deprecated exceptionNikita Popov2019-09-041-0/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The exception mechanism assumes that exceptions from DO_FCALL are already happening after the function call. This means that we are currently leaking the passed arguments, and I think we can also corrupt the VM stack due to incorrect frame linking in some cases (there are assertion failures if the VM stack page size is reduced). Instead handle the stack frame freeing manually for this special case.
* | | Report false for inherited private methods in method_exists()Nikita Popov2019-09-032-2/+2
| | | | | | | | | | | | | | | These shadow methods only exist as internal implementation markers. This mirrors the behavior of property_exists().
* | | Addref static vars when not copying private methodNikita Popov2019-08-291-0/+35
| | | | | | | | | | | | | | | | | | While we don't need to give this method separate static vars, we do still need to perform an addref, as there will be a corresponding delref in the dtor.
* | | Merge branch 'PHP-7.3' into PHP-7.4Nikita Popov2019-08-291-0/+11
|\ \ \ | |/ /
| * | Merge branch 'PHP-7.2' into PHP-7.3Nikita Popov2019-08-291-0/+11
| |\ \ | | |/