1
0
mirror of https://github.com/php/php-src.git synced 2026-03-25 16:52:18 +01:00
Commit Graph

686 Commits

Author SHA1 Message Date
Dmitry Stogov
57a3fbb1e1 Fixed INIT_METHOD_CALL + IS_VAR + reference in tracing JIT 2020-09-22 00:47:23 +03:00
Dmitry Stogov
5a085777b7 Fixed incorrect JIT for FETCH_THIS+SEND_REF 2020-09-21 21:53:03 +03:00
Nikita Popov
edf22962ef Make constant redeclaration a warning
We missed the change to make this an Error exception in PHP 8,
but at least elevate it to a warning, to avoid a notice -> exception
jump at a later time.
2020-09-21 17:04:39 +02:00
Nikita Popov
c5401854fc Run tidy
This should fix most of the remaining issues with tabs and spaces
being mixed in tests.
2020-09-18 14:28:32 +02:00
Máté Kocsis
9975986b7e Improve error messages mentioning parameters instead of arguments
Closes GH-5999
2020-09-09 10:47:43 +02:00
Dmitry Stogov
c5b42be40e Fixed memory leak 2020-09-09 11:09:20 +03:00
Michael Voříšek
cb284f668c Fix typo in test description
Closes GH-6062.
2020-09-02 13:07:40 +02:00
Máté Kocsis
7aacc705d0 Add many missing closing PHP tags to tests
Closes GH-5958
2020-08-09 22:03:36 +02:00
Nikita Popov
c48b745f00 Promote "undefined array key" notice to warning
This implements the last remaining part of the
https://wiki.php.net/rfc/engine_warnings RFC.

Closes GH-5927.
2020-08-03 14:40:50 +02:00
Dmitry Stogov
41de27ecc2 Skip tests leaking because of preloading failure. 2020-07-30 14:04:14 +03:00
Dmitry Stogov
02fae1fc53 Fixed bug #79888 (Incorrect execution with JIT enabled) 2020-07-29 17:32:57 +03:00
George Peter Banyard
b2248789ed Implement 'Saner Numeric Strings' RFC:
RFC: https://wiki.php.net/rfc/saner-numeric-strings

This removes the -1 allow_error mode from is_numeric_string functions and replaces it by
a trailing boolean out argument to preserve BC in a couple of places.

Most of the changes can be resumed to "numeric" strings which emitted a E_NOTICE now emit
a E_WARNING and "numeric" strings which emitted a E_WARNING now throw a TypeError.

This mostly affects:
 - String offsets
 - Arithmetic operations
 - Bitwise operations

Closes GH-5762
2020-07-29 02:51:09 +01:00
Ilija Tovilo
9bf119832d Implement nullsafe ?-> operator
RFC: https://wiki.php.net/rfc/nullsafe_operator

Closes GH-5619.

Co-authored-by: Nikita Popov <nikita.ppv@gmail.com>
2020-07-24 10:05:03 +02:00
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
Ilija Tovilo
1c967df5a0 Fix free of uninitialized memory in MATCH_ERROR
As suggested by Tyson Andre:
https://github.com/php/php-src/pull/5371#issuecomment-657081464

Also fix line number of unhandled match error

Closes GH-5841.
2020-07-12 13:33:36 +02:00
Máté Kocsis
d30cd7d7e7 Review the usage of apostrophes in error messages
Closes GH-5590
2020-07-10 21:05:28 +02: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
Fabien Villepinte
0c6d06ecfa Replace EXPECTF when possible
Closes GH-5779
2020-06-29 21:31:44 +02:00
Dmitry Stogov
ea2b0d3c8b Fixed JIT failures on Windows 2020-06-22 14:57:04 +03:00
Christoph M. Becker
6bc375f40a Mark failing tests as XFAIL for now
These test fail on Window since some recent changes to JIT; we mark
them as XFAIL until the issues are resolved.
2020-06-20 11:07:57 +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
Máté Kocsis
aa9b0ccda8 Add tests to check mismatching function signatures
Closes GH-5666
2020-06-06 09:23:34 +02:00
Christoph M. Becker
d23cd354c0 Fix #79665: ini_get() and opcache_get_configuration() inconsistency
Overriding the given INI values in modifier callbacks is not possible,
so instead of enforcing "normalized" internal values, we just reject
the attempted changes.
2020-06-03 11:07:25 +02:00
Tyson Andre
32a1ebbd43 Clean up calls to extension_loaded('json') in tests
These are no longer needed after https://wiki.php.net/rfc/always_enable_json

Closes GH-5637
2020-05-28 15:07:47 -04:00
Máté Kocsis
fbe30592d6 Improve type error messages when an object is given
From now on, we always display the given object's type instead of just reporting "object".
Additionally, make the format of return type errors match the format of argument errors.

Closes GH-5625
2020-05-26 19:06:19 +02:00
Nikita Popov
0a74da385d Add support for replaying warnings in opcache
If opcache.record_warnings is enabled, opcache will record
compilation warnings and replay them when the file is included
again. The primary use case I have in mind for this is automated
testing of the opcache file cache.

This resolves bug #76535.
2020-05-20 11:20:21 +02:00
Nikita Popov
057875d161 Disable JIT in file cache test
File cache and JIT are currently incomatible.
2020-05-20 09:50:12 +02:00
Dmitry Stogov
0695048e20 JIT refactoring to allow run-time changes of JIT options (triggers, optimization_level, debug flags, etc) 2020-05-18 10:23:06 +03:00
Máté Kocsis
1179686f62 Improve error messages for invalid property access
Closes GH-5446
Co-authored-by:  Nikita Popov <nikita.ppv@gmail.com>
2020-05-18 08:27:00 +02:00
Nikita Popov
4c24545aab Merge branch 'PHP-7.4'
* PHP-7.4:
  Fixed bug #79548
2020-05-04 16:30:34 +02:00
Nikita Popov
21a9ad910b Fixed bug #79548
When duplicating user functions with static variables, make sure
that we init a new map ptr slot for the static variables.
2020-05-04 16:27:45 +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
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
Christoph M. Becker
a1eaaa692e Fix #79475: [JIT] func_get_args() assertion violation
`func_get_args()` may return `zend_empty_array`, which has refcount 2
to enforce separation.   We have to cater to that during type inference
so that the optimization in the JIT macro `SEPARATE_ARRAY` doesn't
prevent the separation.
2020-04-17 09:53:23 +02:00
Nikita Popov
2d8f9f34dd Merge branch 'PHP-7.4'
* PHP-7.4:
  Fix literal compaction collision between string and double
2020-04-01 14:23:07 +02:00
Nikita Popov
59c8d6a863 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix literal compaction collision between string and double
2020-04-01 14:22:27 +02:00
Nikita Popov
14b770d407 Fix literal compaction collision between string and double
For the sake of simplicity I'm using a separate hashtable, rather
than trying to do hash perturabation on the double strings.
2020-04-01 14:20:59 +02:00
Máté Kocsis
36935e42ea Improve undefined variable error messages
Closes GH-5312
2020-03-31 13:02:32 +02:00
Dmitry Stogov
5a05fef2af Merge branch 'PHP-7.4'
* PHP-7.4:
  Fixed bug #79412 (Opcache chokes and uses 100% CPU on specific script).
2020-03-25 17:38:08 +03:00
Dmitry Stogov
91ee85c20c Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fixed bug #79412 (Opcache chokes and uses 100% CPU on specific script).
2020-03-25 17:31:33 +03:00
Dmitry Stogov
65120cfc09 Fixed bug #79412 (Opcache chokes and uses 100% CPU on specific script). 2020-03-25 17:31:06 +03:00
Dmitry Stogov
0684b9fcdc Always print numeric opline numbers 2020-03-25 14:26:42 +03:00
Nikita Popov
568592f1e9 Merge branch 'PHP-7.4'
* PHP-7.4:
  Add test file
2020-03-23 17:14:42 +01:00
Nikita Popov
534e15b477 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Add test file
2020-03-23 17:14:16 +01:00
Nikita Popov
2e8db5d6be Add test file
Forgot the git add again...
2020-03-23 17:13:57 +01:00
Nikita Popov
1ba6e66c46 Improve type inference
After thinking about this a bit more, the code here was too
conservative. We know that everything but an object is going to
throw, so it's sufficient to restrict the type to MAY_BE_OBJECT.

The change in the test is weird but not incorrect, because it
operates on empty inferred types, in which case the code must be
dead (which it is). We should probably add a more explicit removal
of code working on empty types.
2020-03-17 15:41:47 +01:00
Dmitry Stogov
29bf7902b3 Fixed RC inference for ZEND_ASSIGN_STATIC_PROP and removed useless checks during RC inference 2020-03-14 01:17:45 +03:00
Dmitry Stogov
78b64bd4ed Merge branch 'PHP-7.4'
* PHP-7.4:
  Check asserts early
  identation fix
  Call global code of preloaded script in global context
  Avoid "Anonymous class wasn't preloaded" error by lazely loading of not preloaded part of a preloaded script
2020-03-13 11:42:07 +03:00