Niels Dossche
1cdcbc05b0
Fix GH-11972: RecursiveCallbackFilterIterator regression in 8.1.18
...
When you do an assignment between two zvals (no, not zval*), you copy
all fields. This includes the additional u2 data. So that means for
example the Z_NEXT index gets copied, which in some cases can therefore
cause a cycle in zend_hash lookups.
Instead of doing an assignment, we should be doing a ZVAL_COPY (or
ZVAL_COPY_VALUE for non-refcounting cases). This avoids copying u2.
Closes GH-12086.
2023-08-30 22:30:59 +02:00
nielsdos
81e50b4ee3
Fix GH-11178: Segmentation fault in spl_array_it_get_current_data (PHP 8.1.18)
...
Dynamic property case in zend_get_property_info() can return NULL for
prop info. This was not handled.
Closes GH-11182.
2023-05-03 19:42:04 +02:00
Ilija Tovilo
9aaa5cd093
By-ref modification of typed and readonly props through ArrayIterator
...
Fixes GH-10844
Closes GH-10872
2023-03-25 16:14:19 +01:00
NathanFreeman
49b2ff5dbb
Fix GH-10519: Array Data Address Reference Issue
...
We need to carry around a reference to the underlying Bucket to be able to modify it by reference.
Closes GH-10749
Signed-off-by: George Peter Banyard <girgias@php.net>
2023-03-10 14:23:30 +00:00
Christoph M. Becker
549cf3a24d
Merge branch 'PHP-8.0' into PHP-8.1
...
* PHP-8.0:
Fix GH-8366: ArrayIterator may leak when calling __construct()
2022-04-15 19:08:28 +02:00
Christoph M. Becker
1762a87932
Fix GH-8366: ArrayIterator may leak when calling __construct()
...
When we detach an iterator, we also have to delete it.
Closes GH-8374.
2022-04-15 19:05:18 +02:00
Nikita Popov
5b2ddf5a17
Export zend_use_resource_as_offset()
...
Use a common implementation to generate this error message, as
we do so in quite a few places dealing with array keys.
2021-08-31 10:58:01 +02:00
Nikita Popov
6d505d4445
Add RETURN/RETVAL_COPY_DEREF() macros
...
These were missing from the set...
I think quite a few of these usages don't actually need the DEREF,
but I've just kept things as is for now.
2021-07-22 09:44:19 +02:00
Nikita Popov
54c4c7d747
Merge branch 'PHP-8.0'
...
* PHP-8.0:
Fix ArrayObject::exchangeArray() return type
2021-07-06 10:52:46 +02:00
Nikita Popov
bcefc31e4e
Fix ArrayObject::exchangeArray() return type
...
This method cannot return null.
2021-07-06 10:52:08 +02:00
Patrick Allaert
aff365871a
Fixed some spaces used instead of tabs
2021-06-29 11:30:26 +02:00
George Peter Banyard
ff1145943f
Refactor spl_array_has_dimension_ex()
...
Use early returns instead of else blocks
Add comments, especially to explain why we need a check_empty == 2 check
2021-06-18 00:47:04 +01:00
Nikita Popov
71fb83567f
Fix bug #80945 : Don't throw undefined array key warning in ArrayObject unset()
...
This makes the behavior of ArrayObject the same as far plain
arrays, which don't throw a warning when unsetting a key that
already doesn't exit.
2021-06-14 10:14:38 +02:00
Nikita Popov
9d2a466c4b
Remove explicit assignments of zend_objects_destroy_object
...
This is the default handler, no need to set it explicitly. This
makes it easier to see which objects really have a custom dtor_obj.
2021-06-09 11:29:50 +02:00
George Peter Banyard
b6958bb847
Implement "Deprecate implicit non-integer-compatible float to int conversions" RFC. ( #6661 )
...
RFC: https://wiki.php.net/rfc/implicit-float-int-deprecate
Co-authored-by: Nikita Popov <nikita.ppv@gmail.com>
2021-05-31 15:48:45 +01:00
KsaR
01b3fc03c3
Update http->https in license ( #6945 )
...
1. Update: http://www.php.net/license/3_01.txt to https, as there is anyway server header "Location:" to https.
2. Update few license 3.0 to 3.01 as 3.0 states "php 5.1.1, 4.1.1, and earlier".
3. In some license comments is "at through the world-wide-web" while most is without "at", so deleted.
4. fixed indentation in some files before |
2021-05-06 12:16:35 +02:00
George Peter Banyard
5caaf40b43
Introduce pseudo-keyword ZEND_FALLTHROUGH
...
And use it instead of comments
2021-04-07 00:46:29 +01:00
Dmitry Stogov
c28751c69c
Merge branch 'PHP-8.0'
...
* PHP-8.0:
Fixed bug #80802 : (zend_jit_fetch_indirect_var assert failure with tracing JIT)
2021-03-02 00:01:01 +03:00
Dmitry Stogov
957cb13a49
Fixed bug #80802 : (zend_jit_fetch_indirect_var assert failure with tracing JIT)
2021-03-01 23:57:20 +03:00
Máté Kocsis
4f4c031f62
Generate ext/spl class entries from stubs
...
Closes GH-6709
2021-02-18 13:01:51 +01:00
Nikita Popov
f0b387d1e4
Merge branch 'PHP-8.0'
...
* PHP-8.0:
Fixed bug #80719
2021-02-11 16:14:12 +01:00
Nikita Popov
226395a335
Merge branch 'PHP-7.4' into PHP-8.0
...
* PHP-7.4:
Fixed bug #80719
2021-02-11 16:13:56 +01:00
Nikita Popov
c34c523467
Fixed bug #80719
2021-02-11 16:12:06 +01:00
Nikita Popov
0368dc9f28
Fix proptable canonicalization bypass in ArrayObject
...
When an ArrayObject wraps an object, we should be using the
proptable canonicalilzation rules, which require all keys to be
strings.
2021-01-26 14:05:41 +01:00
Nikita Popov
3e01f5afb1
Replace zend_bool uses with bool
...
We're starting to see a mix between uses of zend_bool and bool.
Replace all usages with the standard bool type everywhere.
Of course, zend_bool is retained as an alias.
2021-01-15 12:33:06 +01:00
Nikita Popov
aa51785889
Remove SEPARATE_ARG_IF_REF macro
...
The name doesn't correspond to what it does at all, and all the
existing usages appear to be unnecessary.
Usage of this macro can be replaced by ZVAL_DEREF + Z_TRY_ADDREF_P.
2021-01-14 10:53:56 +01:00
Nikita Popov
d8b22c56cf
Fix INDIRECT elements leaked by SPL __serialize implementations
2021-01-12 15:35:19 +01:00
Nikita Popov
8b2b8563ef
Remove some unnecessary zend_delete_global_variable uses
2021-01-08 11:31:31 +01:00
Nikita Popov
bfe7a1168a
Properly validate ArrayObject::asort() argument
2020-10-22 15:20:43 +02:00
Nikita Popov
2c1b5c4365
Support GC for AppendIterator
...
This also requires adding GC support for ArrayIterator internal
iterators.
2020-10-01 16:18:23 +02:00
George Peter Banyard
9affbef0e6
Use normal error in SPL for 'An iterator cannot be used with foreach by reference'
2020-09-15 12:49:59 +02:00
George Peter Banyard
61c299fe9c
Error promotions in SPL
...
Warning to Error promotion and a Notice to Warning promotion to align
with the behaviour specified in the Reclassify Engine Warnings RFC.
Closes GH-6072
2020-09-03 19:27:02 +02:00
Máté Kocsis
f7fbc6333f
Add more precise type info for stubs
...
Closes GH-6005
2020-09-01 16:35:56 +02:00
Nikita Popov
f965e20059
Promote ArrayObject modification during sorting to Error exception
2020-08-28 10:42:14 +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
Nikita Popov
7a4b594c6f
Convert SPL illegal offset type into TypeError
...
Make this consistent with the corresponding engine behavior.
Also adjust the messages to match.
2020-08-03 11:17:49 +02:00
Nikita Popov
d65d3f5298
Fix bug #79108
...
Don't expose references in debug_backtrace() or exception traces.
This is regardless of whether the argument is by-reference or not.
As a side-effect of this change, exception traces may now acquire
the interior value of a reference, which may be unexpected for
some internal functions. This is what necessitated the change in
the spl_array sort implementation.
2020-07-24 12:23:34 +02:00
Nikita Popov
1cba736470
Throw correct exception from ArrayObject sort methods
...
Let normal zpp throw ArgumentCountErrors.
2020-07-17 10:46:11 +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
Max Semenik
2b5de6f839
Remove proto comments from C files
...
Closes GH-5758
2020-07-06 21:13:34 +02:00
Nikita Popov
312201dce4
Add get_gc handle for object iterators
...
Optional handler with the same semantics as the object handler.
2020-07-01 15:17:22 +02:00
Nikita Popov
15846ff115
Add ZVAL_OBJ_COPY macro
...
For the common ZVAL_OBJ + GC_ADDREF pattern.
This mirrors the existing ZVAL_STR_COPY API.
2020-06-17 16:36:56 +02:00
Máté Kocsis
d7f7080bb5
Generate methods entries from stubs for ext/spl
...
Closes GH-5458
2020-04-25 23:54:56 +02:00
Alex Dowad
c36b9e93fa
Remove unneeded prototype for spl_array_get_iterator
2020-04-23 10:05:21 +02:00
Nikita Popov
3d5db42ca5
Merge branch 'PHP-7.4'
...
* PHP-7.4:
Fix bug #67369 ArrayObject serializatino drops the iterator class
2020-04-20 11:56:35 +02:00
Alex Dowad
0d11d37357
Fix bug #67369 ArrayObject serializatino drops the iterator class
...
When ArrayObject is round-tripped through serialize() and unserialize(),
it forgets any iterator class name which was set using ::setIteratorClass().
Fix that.
2020-04-20 11:55:18 +02:00
Christoph M. Becker
9809713844
Merge branch 'PHP-7.4'
...
* PHP-7.4:
Fix #69264 : __debugInfo() ignored while extending SPL classes
2020-04-06 12:04:12 +02:00
Christoph M. Becker
22a077b642
Fix #69264 : __debugInfo() ignored while extending SPL classes
...
We actually implement `::__debugInfo()` and drop the `get_debug_info()`
handlers of all relevant SPL classes. This is cleaner and gives more
flexibility regarding overriding the functionality in descendant
classes.
2020-04-06 12:01:29 +02:00
Máté Kocsis
d2b902f174
Add some stubs for SPL
...
Closes GH-5245
2020-03-10 11:41:48 +01:00
Máté Kocsis
b7d2882fee
Use zend_parse_parameters_none() instead of zend_parse_parameters_none_throw()
2020-01-03 13:22:39 +01:00