Christoph M. Becker
3de0ccfe09
Merge branch 'PHP-8.1'
...
* PHP-8.1:
Fix GH-8366: ArrayIterator may leak when calling __construct()
2022-04-15 19:10:29 +02: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
George Peter Banyard
cfc38a6014
SPL: minor refactoring ( #8341 )
...
Use more appropriate types and return macros
2022-04-13 20:34:23 +01:00
George Peter Banyard
db0db2204f
Use zend_result/bool in spl_array.c
2022-03-23 22:21:04 +00:00
George Peter Banyard
2fa33d1def
Use ZEND_THROWS() where applicable in spl_array.c
2022-03-23 22:13:08 +00:00
George Peter Banyard
69ea2d8600
Convert check + exception to assertion
...
Move the inside the __unserialize() method as that's the only one which now needs this check
Closes GH-8207
2022-03-23 22:02:27 +00:00
Nikita Popov
f13c22fbfb
Remove unnecessary zend_user_iterator use in spl_array
...
We no longer use any functionality of zend_user_iterator here.
2021-09-24 15:12:55 +02:00
Nikita Popov
15bbf6f337
Automatically determine whether to reuse get_iterator()
...
Same as with the IteratorAggregate case, allow reusing get_iterator
if none of the Iterator methods are overridden. Drop the
REUSE_GET_ITERATOR flag that previously allowed ArrayIterator to
opt-in to unconditional get_iterator reuse, and drop the override
handling it did, in favor of the automated approach.
2021-09-24 15:11:26 +02:00
Nikita Popov
d0dbf7296b
Initialize iterator_funcs_ptr upfront
...
Same as we do for the IteratorAggregate case, initialize the
Iterator methods upfront. This is preparation for an upcoming
change to automatically determine whether get_iterator can be
reused in a child class, in the same way we already do for
IteratorAggregate.
2021-09-24 14:57:13 +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