Ilija Tovilo
5c10aa43c2
Merge branch 'PHP-8.0' into PHP-8.1
...
* PHP-8.0:
Fix spl test cleanup
2022-07-21 17:21:18 +02:00
Ilija Tovilo
3962f00b01
Fix spl test cleanup
2022-07-21 17:20:30 +02:00
George Peter Banyard
e67336f46a
Merge branch 'PHP-8.0' into PHP-8.1
...
* PHP-8.0:
Revert "Fix GH-8563 Different results for seek() on SplFileObject and SplTempFileObject"
2022-07-05 21:33:47 +01:00
George Peter Banyard
79a283240e
Revert "Fix GH-8563 Different results for seek() on SplFileObject and SplTempFileObject"
...
Although the fix is partially correct it also breaks long standing behaviour which has been produced since PHP 5.3.
This reverts commit 6f87a5c633 .
2022-07-05 21:28:59 +01:00
George Peter Banyard
080fde2605
Merge branch 'PHP-8.0' into PHP-8.1
...
* PHP-8.0:
Fix GH-8563 Different results for seek() on SplFileObject and SplTempFileObject
2022-06-20 12:53:01 +01:00
George Peter Banyard
6f87a5c633
Fix GH-8563 Different results for seek() on SplFileObject and SplTempFileObject
...
With memory streams if we get a NULL buffer we must not instantiate an empty line
2022-06-20 12:47:37 +01:00
George Peter Banyard
f800c60f13
Merge branch 'PHP-8.0' into PHP-8.1
2022-06-08 11:43:22 +01:00
George Peter Banyard
52eb52d652
Backport fcba0a49fc
...
Forgot this file exists in lower branches
2022-06-08 11:43:12 +01:00
George Peter Banyard
660ef91fbc
Fix GH-8273: SplFileObject: key() returns wrong value
2022-04-23 14:00:11 +01:00
George Peter Banyard
6186ecd436
Fix GH-8273: SplFileObject: key() returns wrong value
2022-04-23 13:56:38 +01: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
Christoph M. Becker
3a71fcf5ca
Merge branch 'PHP-8.0' into PHP-8.1
...
* PHP-8.0:
Fix GH-8121: SplFileObject - seek and key with csv file inconsistent
2022-03-08 16:57:58 +01:00
Christoph M. Becker
1d9a1f9be3
Fix GH-8121: SplFileObject - seek and key with csv file inconsistent
...
First, we must not free the current line before we call
`spl_filesystem_file_read_csv()`, because then the `current_line` will
not be properly updated. Since the EOF check is superfluous here, we
move that part of the code to the branch for subtypes. This issue has
been introduced by the fix for bug 75917.
Second, we only must increase the `current_line` if we're not reading
ahead. This issue has been introduced by the fix for bug 62004.
Closes GH-8138.
2022-03-08 16:54:02 +01:00
Tyson Andre
5d907dfcee
Merge branch 'PHP-8.0' into PHP-8.1
2022-02-23 19:26:24 -05:00
Tyson Andre
cd1c6f0b81
Fixes infinite recursion introduced by patch to SplFixedArray ( #8105 )
...
Closes GH-8079
Track whether the spl_fixedarray was modified since the last call to
get_properties
2022-02-23 19:23:00 -05:00
Dmitry Stogov
a584d12667
Merge branch 'PHP-8.0' into PHP-8.1
...
* PHP-8.0:
Fixed GH-8044 (var_export/debug_zval_dump HT_ASSERT_RC1 debug failure for SplFixedArray)
2022-02-11 15:35:57 +03:00
Dmitry Stogov
52ae6417ca
Fixed GH-8044 (var_export/debug_zval_dump HT_ASSERT_RC1 debug failure for SplFixedArray)
2022-02-11 15:33:31 +03:00
Christoph M. Becker
0ed39ed809
Fix GH-7809: Cloning a faked SplFileInfo object may segfault
...
While the `path` is not supposed to be `NULL` for normal operation, it
is possible to create `SplFileInfo` objects where that is the case, and
we must not follow the null pointer.
Closes GH-7814.
2021-12-23 23:10:51 +01:00
Christoph M. Becker
6f325104eb
Merge branch 'PHP-8.0' into PHP-8.1
...
* PHP-8.0:
Fix #75917 : SplFileObject::seek broken with CSV flags
2021-12-06 19:02:32 +01:00
Aliaksandr Bystry
daf79e2d91
Fix #75917 : SplFileObject::seek broken with CSV flags
...
Closes GH-7697.
2021-12-06 18:59:48 +01:00
Nikita Popov
d7ad32649a
Merge branch 'PHP-8.0' into PHP-8.1
...
* PHP-8.0:
Fixed bug #81587
2021-11-04 10:38:08 +01:00
Nikita Popov
4b9fbc6627
Fixed bug #81587
...
iterator_funcs_ptr may be null for Iterators with custom
get_iterator. Ideally MultipleIterator would make use of get_iterator,
but this would require a large implementation change.
2021-11-04 10:34:52 +01:00
Christoph M. Becker
96ac919957
Merge branch 'PHP-8.0' into PHP-8.1
...
* PHP-8.0:
Fix #81477 : LimitIterator + SplFileObject regression in 8.0.1
2021-09-29 16:18:36 +02:00
Christoph M. Becker
ee5711de33
Fix #81477 : LimitIterator + SplFileObject regression in 8.0.1
...
We must not free the read line, if the `READ_AHEAD` flag is set. This
also restores the expectations of SplFileObject_next_variation002.phpt.
Closes GH-7518.
2021-09-29 16:17:14 +02:00
Christoph M. Becker
e73cc7aea9
Merge branch 'PHP-8.0' into PHP-8.1
...
* PHP-8.0:
Fix #80663 : Recursive SplFixedArray::setSize() may cause double-free
2021-09-28 15:55:11 +02:00
Christoph M. Becker
6154aa652d
Merge branch 'PHP-7.4' into PHP-8.0
...
* PHP-7.4:
Fix #80663 : Recursive SplFixedArray::setSize() may cause double-free
2021-09-28 15:52:58 +02:00
Christoph M. Becker
2d6684091f
Fix #80663 : Recursive SplFixedArray::setSize() may cause double-free
...
We address the `::setSize(0)` case by setting `array->element = NULL`
and `array->size = 0` before we destroy the elements.
Co-authored-by: Tyson Andre <tyson.andre@uwaterloo.ca >
Closes GH-7503.
2021-09-28 15:48:53 +02:00
Nikita Popov
eac65680ab
Merge branch 'PHP-8.0' into PHP-8.1
...
* PHP-8.0:
Fix leak when iterating uninitialized RecursiveIteratorIterator
2021-09-24 13:18:00 +02:00
Nikita Popov
3adbafeef7
Fix leak when iterating uninitialized RecursiveIteratorIterator
2021-09-24 13:17:34 +02:00
Tyson Andre
27976d7dc7
Merge branch 'PHP-8.0' into PHP-8.1
2021-09-13 21:18:56 -04:00
Tyson Andre
753645a6f8
Merge remote-tracking branch 'origin/PHP-7.4' into PHP-8.0
2021-09-13 21:00:53 -04:00
Tyson Andre
b053192a03
Fix #81429 : Handle resizing in SplFixedArray::offsetSet ( #7487 )
...
offsetSet did not account for the fact that the array may no longer exist after
the field is overwritten. This fixes that.
Add test of resizing both to the empty array and a smaller array - there should
be no valgrind warnings with a proper fix.
Alternate approach to #7486 (described in https://bugs.php.net/bug.php?id=81429 )
2021-09-13 20:59:06 -04: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
Máté Kocsis
b3e0888129
Declare tentative return types in ext/spl - part 3 ( #7239 )
2021-07-16 12:09:05 +02:00
Nikita Popov
c2b29308ff
Merge branch 'PHP-8.0'
...
* PHP-8.0:
Fix RecursiveIteratorIterator segfault for invalid aggregate
2021-07-15 13:11:39 +02:00
Nikita Popov
b9ae73eee9
Fix RecursiveIteratorIterator segfault for invalid aggregate
...
The code was assuming that the returned value is an object.
Reuse the logic from IteratorIterator.
2021-07-15 13:11:28 +02:00
Nikita Popov
f556a30b92
Narrow ArrayIterator::key() return type
...
This can only return string|int|null, not any key type.
2021-07-15 11:03:50 +02:00
Máté Kocsis
6d805ed275
Declare tentative return types for ext/spl - part 2
...
Closes GH-7235
2021-07-14 15:19:51 +02:00
Nikita Popov
42cb5b5fa8
Throw from MultipleIterator::key/current() for invalid iterator
...
Calling current()/key() on an invalid iterator is an error
condition. Throw instead of returning false.
2021-07-14 12:40:45 +02:00
Nikita Popov
58f3f751ca
Throw from SplObjectStorage::current() for invalid iterator
...
Accessing key()/current() on an invalid iterator is an error
condition. Throw instead of returning null.
2021-07-14 12:34:39 +02:00
Máté Kocsis
c6357b804e
Declare tentative return types for ext/spl - part 1 ( #7115 )
2021-07-13 13:04:45 +02:00
Nikita Popov
8a67dfd16b
Ensure correct return type from SplFileObject::getCurrentLine()
...
This is necessary to maintain return type consistency once
tentative return types are added.
2021-07-06 14:32:39 +02:00
Nikita Popov
188b1d4c7c
SplFileObject::fgetcsv(): Consistently return false on failure
...
Both the documentation and the stubs state that this method is
supposed to return false on failure. However, if the line read
(rather than the getcsv operation) fails, it would incorrectly
return null instead.
2021-07-06 14:24:26 +02:00
Nikita Popov
ac7a28189a
Add initialization checks to DirectoryIterator methods
2021-07-06 13:08:53 +02:00
Nikita Popov
f7b1238f13
Handle out of order destruction of RecursiveIteratorIterator
2021-07-02 17:14:00 +02:00
Nikita Popov
c2a8934b86
Fix typo in RecursiveIteratorIterator get_gc handler
2021-07-02 16:11:48 +02:00
George Peter Banyard
e9e06279c1
Refactor SplFixedArray ( #7168 )
...
* Move spl_offset_convert_to_long() to spl_fixedarray.c
It is only used there, which explains its weird offset semantics
* Refactor SplFixedArray offset handling
- Implement warning for resource type
- Throw a proper TypeError instead of a RuntimeException
* Use a proper Error to signal that [] cannot be used with SplFixedArray
* Refactor SplFixedArray has_dimension helper
* Drop some ZPP tests
2021-06-18 15:22:52 +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
805471e86b
Fix bug #81112 : Implement JsonSerializable for SplFixedArray
...
This returns an array for SplFixedArray JSON encoding, which
is more appropriate than an object with integer string keys.
Closes GH-7117.
2021-06-14 10:07:45 +02:00