1
0
mirror of https://github.com/php/php-src.git synced 2026-04-21 15:08:16 +02:00
Commit Graph

16481 Commits

Author SHA1 Message Date
Dmitry Stogov c732ab400a Change Zend Stream API to use zend_string* instead of char*.
This allows to eliminate re-calculation of string lenght and hash value.
See the detailed list of changes in UPGRADING.INTERNALS.
2021-03-16 20:31:36 +03:00
Nikita Popov e35f9dfecc Don't check executability
As $(PHP) is not an absolute path, test -x doesn't do anything
meaningful. Rely on the autoconf check.
2021-03-16 14:36:10 +01:00
Nikita Popov 59e610092a Check for WRONG_PROPERTY_INFO 2021-03-16 14:24:48 +01:00
Nikita Popov 4f750f7171 Revert "Remove some unnecessary explicit header dependencies"
This reverts commit c386b1fb17.

It looks like at least some of these might be needed for ordering
in a clean build?
2021-03-16 14:22:25 +01:00
Nikita Popov 9b816d83f6 Automatically run zend_vm_gen.php if zend_vm_def.h changes 2021-03-16 13:08:37 +01:00
Nikita Popov c386b1fb17 Remove some unnecessary explicit header dependencies
These are now automatically tracked by the build system.
2021-03-16 13:02:23 +01:00
Nikita Popov 77ebf81492 Merge branch 'PHP-8.0'
* PHP-8.0:
  Fix refcount inference for typed properties
2021-03-16 11:18:12 +01:00
Nikita Popov 53e9c36cd9 Add sanity check for type of read_property return value
If an internal class overrides read_property and declared property
types, make sure that the returned value matches the declared
type (in debug builds).
2021-03-16 10:42:47 +01:00
Dmitry Stogov d5a15d2c91 Remove deprecated code 2021-03-13 01:04:43 +03:00
Dmitry Stogov fe3dbe5294 Fixed compilation warning 2021-03-12 21:50:26 +03:00
Dmitry Stogov 3d11743372 Inline "array" part of FE_FETCH_R handler into HYBRID VM 2021-03-11 22:33:01 +03:00
Dmitry Stogov 278d452a6a zend_verify_recv_arg_type_helper is not "cold". 2021-03-11 15:57:02 +03:00
Dmitry Stogov d0e043b294 Avoid repeatable work when error_reporting() is called with the same argument few times. 2021-03-11 14:27:53 +03:00
Dmitry Stogov 65859fe17e Inheritance cache optimization 2021-03-11 13:42:35 +03:00
Máté Kocsis 495bf5cdd0 Merge branch 'PHP-8.0' 2021-03-06 00:56:47 +01:00
Máté Kocsis 0f8312342f Fix the error message of attribute flag validation 2021-03-06 00:56:25 +01:00
Levi Morrison 2317b81c62 Add const to zend_extension_version_info.build_id
This is a follow-up to:
https://github.com/php/php-src/commit/3c6ab4b3ea5854fd44a2945bb65bf027a6c94890

Closes GH-6744.
2021-03-02 18:42:58 -07:00
Dmitry Stogov 9da66e6ad0 Optimized object conversion to array without rebulding properties HashTable 2021-03-01 22:37:37 +03:00
Nikita Popov 056eac6b03 Merge branch 'PHP-8.0'
* PHP-8.0:
  Fixed bug #80811
2021-03-01 16:30:19 +01:00
Nikita Popov 75a4f484f0 Fixed bug #80811
When filling in defaults for skipped params, make sure that
reference parameters get the expected reference wrapper.
2021-03-01 16:30:01 +01:00
Nikita Popov 26c3fa2759 Merge branch 'PHP-8.0'
* PHP-8.0:
  Always remove HT iterators, even for uninit HT
2021-03-01 16:22:51 +01:00
Nikita Popov 5875bf754e Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Always remove HT iterators, even for uninit HT
2021-03-01 16:22:29 +01:00
Nikita Popov 2c508c4d40 Always remove HT iterators, even for uninit HT
Fixes oss-fuzz #31423.
2021-03-01 16:22:11 +01:00
Dmitry Stogov b0c7ea4919 Change the order of properties used in foreach(), var_dump(), serialize(), comparison, etc. Now properties are ordered according to their layout in zend_object structure. 2021-03-01 13:43:22 +03:00
Nikita Popov 47a2e5c785 Reference dynamic functions through dynamic_defs
Currently, dynamically declared functions and closures are inserted
into the function table under a runtime definition key, and then later
possibly renamed. When opcache is not used and a file containing a
closure is repeatedly included, this leads to a very large memory leak,
as the no longer needed closure declarations will never be freed
(https://bugs.php.net/bug.php?id=76982).

With this patch, dynamic functions are instead stored in a
dynamic_func_defs member on the op_array, which opcodes reference
by index. When the parent op_array is destroyed, the dynamic_func_defs
it contains are also destroyed (unless they are stilled used elsewhere,
e.g. because they have been bound, or are used by a live closure). This
resolves the fundamental part of the leak, though doesn't completely
fix it yet due to some arena allocations.

The main non-obvious change here is to static variable handling:
We can't destroy static_variables_ptr in destroy_op_array, as e.g.
that would clear the static variables in a dynamic function when
the op_array containing it is destroyed. Static variable destruction
is separated out for this reason (we already do static variable
destruction separately for normal functions, so we only need to
handle main scripts).

Closes GH-5595.
2021-03-01 11:35:54 +01:00
Dmitry Stogov 72c3ededed Change the order of properties used for var_dump(), serialize(), comparison, etc.
Now properties are ordered according to their layout in zend_object structure.
2021-03-01 13:29:49 +03:00
Max Semenik b86dfb0e74 Fix E_DEPRECATED in zend_vm_gen.php
explode(): Passing null to parameter #2 ($string) of type string is
deprecated

Closes GH-6698.
2021-03-01 11:22:18 +01:00
Dmitry Stogov 0f6c00200b Speed up __sleep() and __wakeup() calls 2021-02-25 12:16:22 +03:00
Dmitry Stogov 5caf29a01e Switch few functions useful in Symphony apps to new ZPP API. 2021-02-24 19:13:11 +03:00
Dmitry Stogov 99d0f502dc Fixed error message 2021-02-24 19:12:32 +03:00
Dylan T e5551d50e7 zend_compile.c: fix typo
Don't mind me, I just happened to be browsing this code. 🙃

Closes GH-6721.

[ci skip]
2021-02-24 10:10:19 +01:00
Máté Kocsis 4c6533c257 Generate class entries from stubs for com, standard, xmlreader, xmlwriter, xsl, zip, Zend
Closes GH-6706
2021-02-22 15:24:03 +01:00
Nikita Popov 8e8e0017b9 Merge branch 'PHP-8.0'
* PHP-8.0:
  Fix trampoline leak on dynamic static call of non-static method
2021-02-22 10:33:16 +01:00
Nikita Popov ab98944195 Fix trampoline leak on dynamic static call of non-static method
Fixes oss-fuzz #30317.
2021-02-22 10:32:59 +01:00
Nikita Popov b3f4a3105c Don't resolve special class names
Adjust zend_resolve_class_name() to not resolve special class names.
This avoids the need to only call this function after a preliminary
check for non-default fetch types. Doing so is somewhat fragile
when dynamic class names are involved.

Fixes oss-fuzz #31139.
2021-02-22 10:11:14 +01:00
Nikita Popov de03bc8eb7 Merge branch 'PHP-8.0'
* PHP-8.0:
  Fixed bug #80781
2021-02-22 09:38:44 +01:00
Nikita Popov ed4f90f0c7 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fixed bug #80781
2021-02-22 09:38:34 +01:00
Nikita Popov 6dd85f83f7 Fixed bug #80781
zend_find_array_dim_slow() may throw, make sure to handle this.
This backports the code we already use for this on PHP-8.0,
and also backports an exception check that makes this easier to
catch.
2021-02-22 09:36:43 +01:00
Markus Staab fd3692ba41 Fix typo [ci skip]
Closes GH-6713.
2021-02-22 09:02:31 +01:00
Nikita Popov f37fe68e63 Fix closure GC handler for fake closures
Fixes oss-fuzz #31135.
2021-02-20 11:16:37 +01:00
Dmitry Stogov 59590663d7 Fixed NULL pointer dereference 2021-02-20 11:20:29 +03:00
Dmitry Stogov 5e01542526 Improve basename(). Avoid calling mblen() for ASCII compatible locales. 2021-02-19 15:42:21 +03:00
Anton Vasiliev be9200998f Fix typo
Closes GH-6708

Signed-off-by: George Peter Banyard <girgias@php.net>
2021-02-18 18:04:51 +00:00
Nikita Popov a843c8a4b6 Fix crash during default value evaluation 2021-02-18 16:44:10 +01:00
Dmitry Stogov 9619562dbc Properly relove self::CONSTANT at compile time 2021-02-18 17:18:57 +03:00
Nikita Popov db2e2af13a Fixed bug #53826
We should handle the case where the method doesn't exist, and
where it is not visible the same way.
2021-02-18 14:17:47 +01:00
Dmitry Stogov 6e988eaefb We don't need map_ptr slots for op_array.run_time_cache during preloading. 2021-02-18 15:46:48 +03:00
Nikita Popov 6b0f14fe3b Fixed bug #75474
For fake closures, we need to share static variables with the
original function, not work on a separate copy. Calling a function
through Closure::fromCallable() should have the same behavior as
calling it directly.
2021-02-18 11:39:28 +01:00
Nikita Popov 5d160e309e Fix static variable behavior with inheritance
When a method is inherited, the static variables will now always
use the initial values, rather than the values at the time of
inheritance. As such, behavior no longer depends on whether
inheritance happens before or after a method has been called.

This is implemented by always keeping static_variables as the
original values, and static_variables_ptr as the modified copy.

Closes GH-6705.
2021-02-18 11:18:19 +01:00
Nikita Popov de5b42219c Avoid writing zend_vm_opcodes.h if it did not change
Now that we track header changes, a change to zend_vm_opcodes.h
requires rebuilding essentially the whole tree. In most cases,
changes to zend_vm_def.h don't actually result in any header
changes though.

Avoid touching the file by first checking whether the to be written
contents are actually the same.
2021-02-17 17:18:57 +01:00