1
0
mirror of https://github.com/php/php-src.git synced 2026-04-27 18:23:26 +02:00
Commit Graph

15196 Commits

Author SHA1 Message Date
Fabien Villepinte 78c753e8ee Fix typo in tests 2019-10-10 15:57:57 +02:00
Nikita Popov 93b39f68f5 Merge branch 'PHP-7.4' 2019-10-10 15:17:44 +02:00
Nikita Popov 5a076e670a Return error_zval form get_property_ptr_ptr on exception
This goes in the reverse direction of 4463acb951.
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.
2019-10-10 15:14:04 +02:00
Nikita Popov 2118f6a898 Merge branch 'PHP-7.4' 2019-10-10 14:44:53 +02:00
Nikita Popov 4463acb951 Explicitly check for exceptions in by-ref obj prop assign
Relying on setting ERROR if an exception happened during the
property address fetch is both a bit fragile and may pessimize
other codepaths that will check for exceptions in the VM. Adding
an extra exception check instead, which should also allow us to
drop the use of ERROR in this area in master.
2019-10-10 14:41:35 +02:00
Nikita Popov fea482ee5c Merge branch 'PHP-7.4' 2019-10-10 12:45:38 +02:00
Nikita Popov 12f4e9e020 Fix leak when property AST evaluation fails 2019-10-10 12:44:55 +02:00
Nikita Popov 1ab489e99a Merge branch 'PHP-7.4' 2019-10-10 11:42:05 +02:00
Nikita Popov b02cf8b66e Merge branch 'PHP-7.3' into PHP-7.4 2019-10-10 11:41:51 +02:00
Nikita Popov 4ba8d78100 Merge branch 'PHP-7.2' into PHP-7.3 2019-10-10 11:41:29 +02:00
Nikita Popov 96c84b7bc1 Fix leak on static method call on non-existent class 2019-10-10 11:40:49 +02:00
Nikita Popov 595e8c6773 Merge branch 'PHP-7.4' 2019-10-10 11:17:55 +02:00
Nikita Popov 6878c583b0 Report error if stream_read is not implemented
We need to return -1 in this case. Slightly restructure the code
to avoid unnecessary conditions.
2019-10-10 11:13:10 +02:00
Nikita Popov 51501dacb1 Merge branch 'PHP-7.4' 2019-10-10 10:08:32 +02:00
Nikita Popov 382f9b28e8 Fix leak on "Cannot assign by reference to overloaded object" error 2019-10-10 10:07:54 +02:00
Nikita Popov b093abcde3 Fix exception handling for call_user_func_array() with invalid type
Now that this throws an exception, the call frame cleanup will be
handled by exception handling -- remove it here to avoid double
frees.
2019-10-10 09:55:19 +02:00
Nikita Popov efed9f6b15 Merge branch 'PHP-7.4' 2019-10-09 17:01:02 +02:00
Nikita Popov 91eb632472 Merge branch 'PHP-7.3' into PHP-7.4 2019-10-09 17:00:55 +02:00
Nikita Popov 6fd6ad8f53 Fixed bug #78658 2019-10-09 17:00:27 +02:00
Dmitry Stogov d37f5da75e typo and cleanup 2019-10-09 17:58:35 +03:00
Nikita Popov 9c9a833f9c Actually remove the YIELD key specialization
I only adjusted the code before, without switching to TMPVAR.
2019-10-09 14:11:07 +02:00
Nikita Popov 165a065a12 Reduce YIELD key specialization
Keeping the value specialization for now, which is more commonly
applicable.
2019-10-09 13:59:07 +02:00
Nikita Popov da3b245715 Reduce YIELD_FROM specialization
Generator delegation is a complex compound operation, it does not
make a lot of sense to optimize refcounting here to this degree.
2019-10-09 13:53:07 +02:00
Nikita Popov 2aba10be4a Reduce ZEND_THROW specialization
Throwing is very expensive due to the need of gathering the backtrace,
so it makes little sense to optimize refcounting to this degree.
2019-10-09 13:17:25 +02:00
Dmitry Stogov f6f32f2cf0 SAMRT BRANCH improvement.
Avoid need of insertion NOP opcoes between unrelated SMART BRANCH instruction and following JMPZ/JMPNZ.
Now instead of checking the opcode of following instruction, the same information is encoded into SMART BRANH result_type.
2019-10-09 13:48:39 +03:00
Nikita Popov a32f130f94 Merge branch 'PHP-7.4' 2019-10-08 17:34:25 +02:00
Nikita Popov bea832cbf6 Don't check type of simple parameter default values
After fixing the int->double coercion case, this is already verified
at compile-time, so there is no need to redo this type check on
every call.

Only perform the type check every time for the case of AST default
values.
2019-10-08 17:29:41 +02:00
Nikita Popov 7c1bc91e52 Merge branch 'PHP-7.4' 2019-10-08 17:19:52 +02:00
Nikita Popov 21148679d1 Handle "non well formed" exception during ZPP
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.
2019-10-08 17:17:49 +02:00
Dmitry Stogov 31c3b0c7cc Fixed Zend/tests/bug70785.phpt on builds wothout global regesters 2019-10-08 17:08:59 +03:00
Nikita Popov cffa81e438 Merge branch 'PHP-7.4' 2019-10-08 15:52:18 +02:00
Dmitry Stogov 56ae3f6c4a Added "const" qualifier 2019-10-08 16:50:04 +03:00
Nikita Popov 9004102b99 Fixed bug #78648 2019-10-08 15:39:22 +02:00
Dmitry Stogov eec04f6b56 Encapsulate all SMART BRANCH related logic inside macros. Result of SMART BRANCH may be uninitialized (on exception). 2019-10-08 16:37:21 +03:00
Nikita Popov d98497615c Merge branch 'PHP-7.4' 2019-10-08 14:33:01 +02:00
Nikita Popov ad3ddf46f9 Fixed bug #78644
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.
2019-10-08 14:32:49 +02:00
Christoph M. Becker 26f45cb4bb 7.3.12 is next 2019-10-08 12:04:25 +02:00
Nikita Popov e9f4676b3f Merge branch 'PHP-7.4' 2019-10-07 17:31:12 +02:00
Nikita Popov 2f64844495 Fix leak when include fails in a read operation
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.
2019-10-07 17:29:33 +02:00
Dmitry Stogov b02b81299c Comparison cleanup:
- introduce zend_compare() that returns -1,0,1 dirctly (without intermediate zval)
- remove compare_objects() object handler, and keep only compare() handler
2019-10-07 17:57:49 +03:00
Nikita Popov 57670c6769 Check num required args is correct in debug builds
Also replace the assertion failure with an E_CORE_ERROR that
includes the function name, so these are easier to debug.
2019-10-07 16:34:05 +02:00
Nikita Popov 5f80eb7842 Fix required number of arguments in stubs
* get_parent_class() argument is optional
* Mark array_filter() $callback as optional
* The $base of gmp_strval() is optional
* DateTime constructor also accepts zero arguments
* hash_update_file() stream context is optional
* xmlwriter_write_dtd_entity() $isparam argument is optional
2019-10-07 16:33:41 +02:00
Nikita Popov 5050507282 Merge branch 'PHP-7.4' 2019-10-04 22:47:10 +02:00
Nikita Popov b078ae6c01 Merge branch 'PHP-7.3' into PHP-7.4 2019-10-04 22:46:53 +02:00
Nikita Popov 239e2dda64 Make sure T_ERROR is returned for all lexer exceptions
This originally manifested as a leak in oss-fuzz #18000. The following
is a reduced test case:

    <?php
    [
        5 => 1,
        "foo" > 1,
        "      " => "" == 0
    ];
    <<<BAR
    $x
     BAR;

Because this particular error condition did not return T_ERROR,
EG(exception) was set while performing binary operation constant
evaluation, which checks exceptions for cast failures.

Instead of adding this indirect test case, I'm adding an assertion
that the lexer has to return T_ERROR if EG(exception) is set.
2019-10-04 22:42:14 +02:00
Nikita Popov fec0ff8cb0 Merge branch 'PHP-7.4' 2019-10-04 12:42:58 +02:00
Nikita Popov ca652aafa8 Fixed bug #78632
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.
2019-10-04 12:41:49 +02:00
Nikita Popov d44cf9b539 Replace "unexpected character" warning with ParseError
Closes GH-4767.
2019-10-04 11:28:58 +02:00
Nikita Popov 11d139625f Merge branch 'PHP-7.4' 2019-10-04 10:39:32 +02:00
Nikita Popov 9659562cb5 Fix use-after-free with delayed interned memoized const operand
We should addref CONST operands during memoization, as they might
be destroyed by later compilation, e.g. through interning.
2019-10-04 10:38:11 +02:00