1
0
mirror of https://github.com/php/php-src.git synced 2026-04-20 06:21:12 +02:00
Commit Graph

2600 Commits

Author SHA1 Message Date
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
Remi Collet
ef2fd0e5b5 fix [-Wstrict-prototypes] buid warnings 2021-11-24 14:55:11 +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
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
Máté Kocsis
8e6e9838b0 Add support for generating MAY_BE_ARRAY_OF_REF func info flag (#7416) 2021-08-30 13:50:34 +02:00
Máté Kocsis
bdfe0ab505 Generate Zend, ext/spl and ext/json optimizer func info from stubs
Closes GH-7397
2021-08-25 10:37:27 +02:00
Kamil Tekiela
6b1337b736 Fix typo [no-ci] 2021-07-30 13:58:28 +01:00
Andrii Dembitskyi
d7b77a40e6 Fix SplFileObject::fseek() method description (#7321) 2021-07-30 13:50:43 +01: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
Máté Kocsis
23b1c4a982 Migrate to PHP-Parser 4.12.0 and regenerate some arginfos 2021-07-22 09:40:16 +02:00
Máté Kocsis
7a9a37d909 Actually, abstract methods don't have a body 2021-07-20 01:00:10 +02:00
Máté Kocsis
fc0d8983d3 Fix some smaller formatting inconsistencies in stubs 2021-07-20 00:52:26 +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
Máté Kocsis
b3e0888129 Declare tentative return types in ext/spl - part 3 (#7239) 2021-07-16 12:09:05 +02:00
Máté Kocsis
fae7cec6fb Merge branch 'PHP-8.0'
* PHP-8.0:
  Fix some more ext/spl return types
2021-07-15 16:41:52 +02:00
Máté Kocsis
fc6656e0ac Fix some more ext/spl return types
Closes GH-7242
2021-07-15 16:40:29 +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
Nikita Popov
11f62c989e Revert "IteratorIterator::getInnerIterator() can't return null"
This reverts commit c252420d08.

This (currently) does not hold for invalid AppendIterators,
revert for now.
2021-07-15 11:01:28 +02:00
Nikita Popov
c252420d08 IteratorIterator::getInnerIterator() can't return null
If ther IteratorIterator is initialized (which we check), then
zobject cannot be undef and the return value cannot be null.
2021-07-15 10:42:34 +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
Máté Kocsis
1bd779c231 Merge branch 'PHP-8.0'
* PHP-8.0:
  Fix some return types in ext/spl
2021-07-14 12:38:17 +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
d618ed0a2d Fix some return types in ext/spl
Closes GH-7237
2021-07-14 12:33:14 +02:00
Máté Kocsis
c6357b804e Declare tentative return types for ext/spl - part 1 (#7115) 2021-07-13 13:04:45 +02:00
Máté Kocsis
0192fd20cc Merge branch 'PHP-8.0' 2021-07-12 10:32:07 +02:00
Máté Kocsis
80e5ad5a29 Various ext/spl stub fixes
Closes GH-7215
2021-07-12 10:27:05 +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
1a81251dbb Use some early returns in spl_directory 2021-07-06 12:37:22 +02:00
Nikita Popov
bb97c947e3 Slightly clarify current_zval handling in spl_directory
This used COPY_DEREF in some places where references can't occur.
2021-07-06 11:37:42 +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
Nikita Popov
f7b1238f13 Handle out of order destruction of RecursiveIteratorIterator 2021-07-02 17:14:00 +02:00