1
0
mirror of https://github.com/php/php-src.git synced 2026-04-13 02:52:48 +02:00
Commit Graph

1528 Commits

Author SHA1 Message Date
Nikita Popov
f7f557926e Fix arg/func info
* mysqli_get_server_info() cannot return null. The underlying API
   is infallible.
 * mysqli_select_db() func info is redundant.
 * mb_detect_order() can only return array|true, not array|false.

Also make the func_info.phpt test that is supposed to catch these
kinds of issues actually work.
2020-07-21 15:00:33 +02:00
Nikita Popov
ae2b214be2 Check for redundant func info 2020-07-21 13:01:12 +02:00
Nikita Popov
3a9036ac54 Stricter verification of func info against arg info
Make sure they're actually the same up to cases where func info
allows more accurate expressions. There are some awkward edge cases
around true/false/null limitations in union types.
2020-07-21 11:47:52 +02:00
Nikita Popov
e4c1366b63 Remove some redundant func info
This is fully covered by arginfo.

The array_merge_recursive() RC information was also wrong,
it should be the same as array_merge().
2020-07-21 11:10:07 +02:00
Nikita Popov
33ddc3bb96 Fix mb_ereg_search* arg and func info 2020-07-21 10:40:08 +02:00
Nikita Popov
be9c5daf28 Remove null from highlight_* return types
Also fix show_source() discrepancy in func_info.
2020-07-21 10:40:08 +02:00
Nikita Popov
9d37a57411 Remove bool return type from assert_options
Not seeing any way this function can return bool.
2020-07-21 10:18:33 +02:00
Nikita Popov
fda78e5965 Fix iptcembed func info
This function can return true with $spool >= 2.
2020-07-21 10:18:33 +02:00
Dmitry Stogov
91d4d2443f Fixed pg_select() function info 2020-07-21 09:58:36 +03:00
Dmitry Stogov
e0af92c16e Eliminate useless exception checks 2020-07-17 10:13:23 +03:00
Dmitry Stogov
a167e0426d Eliminate some reference-counting 2020-07-17 00:40:10 +03:00
Dmitry Stogov
48963378c1 Improved reference-counting inference 2020-07-13 13:08:32 +03:00
Ilija Tovilo
9fa1d13301 Implement match expression
RFC: https://wiki.php.net/rfc/match_expression_v2

Closes GH-5371.
2020-07-09 23:52:17 +02:00
Dmitry Stogov
0d9bebac00 Fixed mysqli_fetch_row() function info 2020-07-09 17:24:06 +03:00
Dmitry Stogov
9e8a8e6ab9 Use information about recorded classes for speculative FETCH_OBJ optimization 2020-07-08 14:09:28 +03:00
Dmitry Stogov
ab5f8f4baf More accurate reference-counter inference (with support for ext/intl/tests/bug72241.phpt) 2020-07-07 19:11:27 +03:00
Nikita Popov
15c265b789 Revert "More accurate reference-counter inference"
This reverts commit b35255ad21.

Temporarily revert this, because it causes a memory leak on the
ext/intl/tests/bug72241.phpt test case, because temporary arrays
are not handled correctly.
2020-07-07 16:53:00 +02:00
Dmitry Stogov
ff3c40206c More accurate reference-counter inference 2020-07-06 17:55:23 +03:00
Dmitry Stogov
b35255ad21 More accurate reference-counter inference 2020-07-06 15:53:28 +03:00
Nikita Popov
344c077400 Use zend_string_equals API in a couple places 2020-07-03 17:02:28 +02:00
Nikita Popov
16cb88f31a Fix func info for get_class_methods() 2020-07-02 17:23:57 +02:00
Dmitry Stogov
2068f019e3 Eliminate useless exception checks 2020-07-02 12:42:09 +03:00
Dmitry Stogov
24a8065f8b Tracing JIT support for include() and generators 2020-06-29 21:40:49 +03:00
Nikita Popov
315ea609da Remove restriction on method call inlining
In PHP 8, we are guaranteed that $this exists, so we no longer have
to forbid this case.
2020-06-29 09:54:31 +02:00
Nikita Popov
bc62acf874 Merge branch 'PHP-7.4'
* PHP-7.4:
  Don't inline static call to instance method
2020-06-29 09:53:09 +02:00
Nikita Popov
fabcd9f14e Don't inline static call to instance method
Fixes the failure in bug79740.phpt with opcache.
2020-06-29 09:52:37 +02:00
Dmitry Stogov
50af4de0fe Improve tracing JIT for FETCH_THIS + FETCH_OBJ_* 2020-06-25 17:33:53 +03:00
Vladyslav Startsev
2c97b401c6 make bcpowmod stricter by not returning false, instead throw exception
Closes GH-5747
2020-06-22 09:31:55 +02:00
Dmitry Stogov
6fa126e966 MAY_BE_INDIRECT inference 2020-06-18 18:54:32 +03:00
Máté Kocsis
b516566b84 Convert CURL resources to objects
Closes GH-5402

Co-authored-by: Nikita Popov <nikita.ppv@gmail.com>
2020-06-17 16:11:57 +02:00
Christoph M. Becker
92c4b06513 Use ZEND_UNREACHABLE() instead of ZEND_ASSERT(0)
Instead of marking unreachable code with `ZEND_ASSERT(0)`, we introduce
`ZEND_UNREACHABLE()`, so that MSVC which does not consider `assert(0)`
to mark unreachable code does no longer trigger C4715[1] warnings in
debug builds.  This may be useful for other compilers as well.

[1] <https://docs.microsoft.com/de-de/cpp/error-messages/compiler-warnings/compiler-warning-level-1-c4715?view=vs-2019>
2020-06-16 18:39:09 +02:00
twosee
83a77015ad Add helper APIs for maybe-interned string creation
Add ZVAL_CHAR/RETVAL_CHAR/RETURN_CHAR as a shortcut for using
ZVAL_INTERNED_STRING and ZSTR_CHAR.

Add zend_string_init_fast() as a helper for the empty string /
one char interned string / zend_string_init() pattern.

Also add corresponding ZVAL_STRINGL_FAST etc macros.

Closes GH-5684.
2020-06-08 15:31:52 +02:00
Tyson Andre
543684e796 Optimize out no-op yield from statements
If the array is empty, then I'd expect that the generator is never left,
and that can be converted to a no-op and the return value would always be `null`.

Make `yield from [];` as efficient as `if (false) { yield null; }`
when opcache's sccp pass is enabled.

Closes GH-5679
2020-06-08 09:17:13 -04:00
twosee
7d6a0ba808 Fix expression warnings and break warnings
Close GH-5675.
2020-06-07 10:41:11 +02:00
Ilija Tovilo
c599d173ab Fix php_get_args function info return type and add arg check
Closes GH-5648.
2020-05-31 17:15:58 +02:00
Dmitry Stogov
1d98bd41e5 Fixed incorrect type inference 2020-05-28 17:10:05 +03:00
Nicolas Grekas
caca664871 Fix func info for sodium_crypto_aead_xchacha20poly1305_ietf_decrypt 2020-05-28 10:44:26 +02:00
Dmitry Stogov
bd329a6019 Keep information about SEND_UNPACK/SEND_ARRAY in call_info 2020-05-27 22:15:14 +03:00
Máté Kocsis
b3718430de Annotate internal functions with the mixed type
Closes GH-5618
2020-05-25 17:30:57 +02:00
Nikita Popov
33b5c026aa Extract zend_foreach_op_array()
Move this functionality from zend_call_graph into zend_optimizer,
because we use this pattern in a number of places.
2020-05-19 11:15:54 +02:00
Dmitry Stogov
2224f63bb5 Prevent usage of uninitialized class entry 2020-05-12 23:34:07 +03:00
Tyson Andre
9f8f84adbc Evaluate str_starts_with and str_ends_with on constants
When both arguments are strings,
this is guaranteed not to emit notices.

Closes GH-5539
2020-05-07 16:24:03 +02:00
Nikita Popov
5bc1e224db Make numeric operations on resources, arrays and objects type errors
RFC: https://wiki.php.net/rfc/arithmetic_operator_type_checks

Closes GH-5331.
2020-05-05 16:11:13 +02:00
Nikita Popov
f55b413d60 Merge branch 'PHP-7.4'
* PHP-7.4:
  Fixed bug #79535
2020-05-04 14:52:42 +02:00
Nikita Popov
733d84dbdf Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fixed bug #79535
2020-05-04 14:52:18 +02:00
Nikita Popov
7c1316ec6a Fixed bug #79535
We did not allocate a cache slot for FETCH_CLASS. This is already
fixed on newer PHP versions.
2020-05-04 14:51:18 +02:00
Tyson Andre
d63eca285a Fix miscellaneous typos in code comments/var names
Closes GH-5501
2020-05-01 15:49:05 +02:00
Tyson Andre
54febdbc7d Fix other typos in param name/code comments
Closes GH-5502
2020-05-01 12:23:16 +02:00
Nikita Popov
53eee290b6 Completely remove disabled functions from function table
Currently, disabling a function only replaces the internal
function handler with one that throws a warning, and a few
places in the engine special-case such functions, such as
function_exists. This leaves us with a Schrödinger's function,
which both does not exist (function_exists returns false) and
does exist (you cannot define a function with the same name).
In particular, this prevents the implementation of robust
polyfills, as reported in https://bugs.php.net/bug.php?id=79382:

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

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

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

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

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

Fixed bug #79382.

Closes GH-5473.
2020-04-30 09:53:57 +02:00
Nikita Popov
f38d6cea42 Check func_info consistency
Make sure explicitly specified func_info is a subset of
automatically computed info. This will at least prevent
cases where a type is removed from stubs, but not removed
from func_info.

Closes GH-5471.
2020-04-27 16:25:59 +02:00