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

217 Commits

Author SHA1 Message Date
Arnaud Le Blanc 34a85fbea0 Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  [ci skip] NEWS
  [ci skip] NEWS
  Fix generator memory leaks when interrupted during argument evaluation (#9756)
2022-11-04 16:02:04 +01:00
Arnaud Le Blanc 4011657719 Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  [ci skip] NEWS
  Fix generator memory leaks when interrupted during argument evaluation (#9756)
2022-11-04 15:59:14 +01:00
Arnaud Le Blanc 5d1f3e047c Fix generator memory leaks when interrupted during argument evaluation (#9756) 2022-11-04 15:55:55 +01:00
Arnaud Le Blanc cfd5fb98e4 Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  [ci skip] NEWS
  [ci skip] NEWS
  Fix compilation warning
  Fix crash when memory limit is exceeded during generator initialization
2022-10-22 10:44:55 +02:00
Arnaud Le Blanc ebe58459aa Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  [ci skip] NEWS
  Fix compilation warning
  Fix crash when memory limit is exceeded during generator initialization
2022-10-22 10:44:06 +02:00
Arnaud Le Blanc 26c7c82d32 Fix crash when memory limit is exceeded during generator initialization 2022-10-22 10:40:28 +02:00
Arnaud Le Blanc a1295cbfce Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  [ci skip] NEWS
  [ci skip] NEWS
  Restore extra_named_params when restoring frozen call stack
2022-10-16 12:45:41 +02:00
Arnaud Le Blanc 2831e0c624 Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  [ci skip] NEWS
  Restore extra_named_params when restoring frozen call stack
2022-10-16 12:43:34 +02:00
Arnaud Le Blanc 86e1fea39a Restore extra_named_params when restoring frozen call stack 2022-10-16 12:40:09 +02:00
Bob Weinand ceda8a8c41 Merge branch 'PHP-8.1' 2022-04-04 14:25:42 +02:00
Bob Weinand e0025562d0 Merge branch 'PHP-8.0' into PHP-8.1 2022-04-04 14:25:23 +02:00
Bob Weinand 9cb512ecc1 Ensure correct target opline for exceptions thrown during yield from
Also appends the exception during a yield from values dtor instead of prepending it

Fixing regression introduced in 13649451c2.
2022-04-04 14:24:39 +02:00
Bob Weinand 703763f43b Merge branch 'PHP-8.1' 2022-04-01 17:51:43 +02:00
Bob Weinand e4c7ffc152 Fix deprecated warning in new gh8289.phpt test 2022-04-01 17:51:18 +02:00
Bob Weinand 914c1ba1e7 Merge branch 'PHP-8.1' 2022-04-01 17:38:56 +02:00
Bob Weinand 16dcededa8 Merge branch 'PHP-8.0' into PHP-8.1 2022-04-01 17:38:10 +02:00
Bob Weinand 13649451c2 Fix GH-8289: Exceptions thrown within a yielded from iterator are not rethrown into the generator
This also fixes the fact that exception traces were not including the generator frame when thrown in a yielded from iterator.
2022-04-01 17:32:48 +02:00
Dmitry Stogov 83d96d6779 Merge branch 'PHP-8.1'
* PHP-8.1:
  Fix use after free
2022-03-01 01:34:27 +03:00
Dmitry Stogov ba6bb8579a Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Fix use after free
2022-03-01 01:34:17 +03:00
Dmitry Stogov 01702a851b Fix use after free
Fixes oss-fuzz #44885
2022-03-01 01:33:22 +03:00
Dmitry Stogov 90e4d5456b Merge branch 'PHP-8.1'
* PHP-8.1:
  Fix memory leak
2022-02-18 12:21:48 +03:00
Dmitry Stogov 22328f68aa Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Fix memory leak
2022-02-18 12:21:15 +03:00
Dmitry Stogov 84a638a346 Fix memory leak
Fixes oss-fuzz #44685
2022-02-18 12:20:40 +03:00
Nikita Popov 902d64390e Deprecate implicit dynamic properties
Writing to a proprety that hasn't been declared is deprecated,
unless the class uses the #[AllowDynamicProperties] attribute or
defines __get()/__set().

RFC: https://wiki.php.net/rfc/deprecate_dynamic_properties
2021-11-26 14:10:11 +01:00
Nikita Popov 9c1d7b43e9 Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Don't replace tmp with cv in YIELD argument
2021-10-12 14:27:07 +02:00
Nikita Popov 9ebe8494b8 Don't replace tmp with cv in YIELD argument
For by-ref generators, these may have different behavior.

Fixes oss-fuzz 6059739298004992.
2021-10-12 14:26:53 +02:00
Javier Eguiluz ffc8717401 Fix some typos (#7320) 2021-07-31 08:34:57 +02:00
Nikita Popov 9e66455fbc Merge branch 'PHP-8.0'
* PHP-8.0:
  Fix parameter name in count() error message
2021-07-29 14:25:22 +02:00
Nikita Popov 6c7b322de2 Fix parameter name in count() error message
This parameter has been renamed to $value.
2021-07-29 14:25:13 +02:00
Máté Kocsis 663536d7d9 Improve class inheritance error messages (#7307) 2021-07-27 09:42:37 +02:00
Nikita Popov 814a932734 Add ZEND_ACC_NOT_SERIALIZABLE flag
This prevents serialization and unserialization of a class and its
children in a way that does not depend on the zend_class_serialize_deny
and zend_class_unserialize_deny handlers that will be going away
in PHP 9 together with the Serializable interface.

In stubs, `@not-serializable` can be used to set this flag.

This patch only uses the new flag for a handful of Zend classes,
converting the remainder is left for later.

Closes GH-7249.
Fixes bug #81111.
2021-07-19 15:59:11 +02:00
Máté Kocsis 75a678a7e3 Declare tentative return types for Zend (#7251)
Co-authored-by: Nikita Popov <nikita.ppv@gmail.com>
2021-07-19 13:44:20 +02:00
Nikita Popov de6e401e05 Use common formatting for backtraces (#6977)
This makes debug_print_backtrace() use the same formatting as exception
backtraces. The only difference is that the final #{main} is omitted,
because it wouldn't make sense for limited backtraces, and wasn't there
previously either.
2021-05-18 11:43:37 +02:00
Nikita Popov 4411026217 Close generator already in dtor phase
In the added test case, the Closure ends up being freed before
the generator during GC.

This patch closes the generator (and thus releases the held
closure / execute_data) already during dtor_obj, which will avoid
ordering issues in free_obj. dtor_obj is not always called, but
if it isn't, then we also won't run GC and will free_obj in
reverse construction order.

Fixes oss-fuzz #33947.
2021-05-04 16:59:59 +02:00
Dmitry Stogov ca49e53670 Stop inserting fake frames on VM stack.
Now similar "fake" frames now materialized when fetching debug
backtraces. The patch also fixes few incorrect backtraces for generators
in *.phpt tests.
2021-04-15 15:30:10 +03:00
Nikita Popov bbc0dd402a Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Short-circuit get_gc for currently running generator
2020-11-18 12:46:12 +01:00
Nikita Popov 99a8ec6e24 Short-circuit get_gc for currently running generator 2020-11-18 12:45:29 +01:00
Nikita Popov dd4a080133 Simplify and fix generator tree management
This makes a number of related changes to the generator tree
management, that should hopefully make it easier to understand,
more robust and faster for the common linear-chain case. Fixes
https://bugs.php.net/bug.php?id=80240, which was the original
motivation here.

 * Generators now only add a ref to their direct parent.
 * Nodes only store their children, not their leafs, which avoids
   any need for leaf updating. This means it's no longer possible
   to fetch the child for a certain leaf, which is something we
   only needed in one place (update_current). If multi-children
   nodes are involved, this will require doing a walk in the other
   direction (from leaf to root). It does not affect the common
   case of single-child nodes.
 * The root/leaf pointers are now seen as a pair. One leaf generator
   can point to the current root. If a different leaf generator is
   used, we'll move the root pointer over to that one. Again, this
   is a cache to make the common linear chain case fast, trees may
   need to scan up the parent link.

Closes GH-6344.
2020-10-22 10:25:25 +02:00
Nikita Popov 28e21d80b0 Fix leak when setting dynamic property on generator 2020-10-16 16:58:27 +02:00
George Peter Banyard 2ee7e2982f Promote count() warning to TypeError
Closes GH-6180
2020-09-21 21:29:15 +01: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
Bob Weinand 6d538e83aa Fix OSS Fuzz issue: yielding from an aborted generator 2020-09-15 20:07:33 +02:00
Bob Weinand ad61e141dd Fix crashes with unproper cleaning of repeated yield from
Closes GH-6130
2020-09-14 20:49:24 +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
Nikita Popov 174dadf6b4 Don't allow dynamic properties on generators
Noticed this because we leak those properties in GC. This was
never intended to be allowed.
2020-09-07 19:08:04 +02:00
Nikita Popov ddc2a2d381 Merge branch 'PHP-7.4'
* PHP-7.4:
  Fix throwing of yield from related exceptions into generator
2020-09-02 10:53:44 +02:00
Nikita Popov c6fd37cee3 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix throwing of yield from related exceptions into generator
2020-09-02 10:53:13 +02:00
Nikita Popov 2e9e706a82 Fix throwing of yield from related exceptions into generator
Use the general zend_generator_throw_exception() helper for this.
Otherwise we don't handle the off-by-one opline correctly (should
we maybe just stop doing that?)

This is a followup to ad750c3bb6,
which fixed a different yield from exception handling problem that
happened to show up in the same test case from oss-fuzz #25321.
Now both issues should be fixed.
2020-09-02 10:52:55 +02:00
Nikita Popov ad97739eac Merge branch 'PHP-7.4'
* PHP-7.4:
  Fix handling of exception if valid() during yield from
2020-08-31 10:52:07 +02:00
Nikita Popov b396fb348b Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix handling of exception if valid() during yield from
2020-08-31 10:51:49 +02:00