Commit Graph

989 Commits

Author SHA1 Message Date
Christoph M. Becker
c49fb83c38 Extract test helper function for SeCreateSymbolicLinkPrivilege check 2020-07-02 12:23:49 +02:00
Nikita Popov
2f56b0018e Merge branch 'PHP-7.3' into PHP-7.4 2020-06-19 10:47:01 +02:00
Nikita Popov
32f377b0b9 Fixed bug #79710
Make sure we don't use zresource after the stream has been destroyed.
2020-06-19 10:46:26 +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
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
Christoph M. Becker
4576da0aa7 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #79393: Null coalescing operator failing with SplFixedArray
2020-03-23 13:31:25 +01:00
Christoph M. Becker
47c745555c Fix #79393: Null coalescing operator failing with SplFixedArray
We favor the KISS principle over optimization[1] – SPL is already
special enough.

[1] <352f3d4476 (r112498098)>ff
2020-03-23 13:29:25 +01:00
Christoph M. Becker
a595b82665 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Skip test on Windows if privileges are insufficient
2020-03-06 16:40:14 +01:00
Christoph M. Becker
dc4f42508d Skip test on Windows if privileges are insufficient 2020-03-06 16:38:49 +01:00
Christoph M. Becker
b761997de3 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #75673: SplStack::unserialize() behavior
2020-03-06 09:11:10 +01:00
Christoph M. Becker
b84277297a Fix #75673: SplStack::unserialize() behavior
Even though `SplStack::unserialize()` is not supposed to be called on
an already constructed instance, it is probably better if the method
clears the stack before actually unserializing.
2020-03-06 09:09:49 +01:00
Nikita Popov
3f020aef85 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fixed bug #79151
2020-01-23 14:21:14 +01:00
Nikita Popov
db9776c53c Fixed bug #79151
Make sure we also NULL out next/prev of the removed element on
pop/shift. This only matter is that element is still being referenced
by an iterator.
2020-01-23 14:20:26 +01:00
Christoph M. Becker
4cd6d384bd Fix #78976: SplFileObject::fputcsv returns -1 on failure
`php_stream_write()` returns `-1` on failure now, which has to be
catered to by `SplFileObject::fputcsv()` which still is supposed to
return `false` on failure.
2019-12-17 17:52:18 +01:00
Stanislav Malyshev
d9f57e8316 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fixed bug #78910
  Fix #78878: Buffer underflow in bc_shift_addsub
  Fix test
  Fix #78862: link() silently truncates after a null byte on Windows
  Fix #78863: DirectoryIterator class silently truncates after a null byte
  Fix #78943: mail() may release string with refcount==1 twice
2019-12-16 00:39:37 -08:00
Stanislav Malyshev
a65b8abf2c Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Fixed bug #78910
  Fix #78878: Buffer underflow in bc_shift_addsub
  Fix test
  Fix #78862: link() silently truncates after a null byte on Windows
  Fix #78863: DirectoryIterator class silently truncates after a null byte
2019-12-16 00:38:54 -08:00
Stanislav Malyshev
b771a18133 Fix test 2019-12-16 00:03:18 -08:00
Christoph M. Becker
a5a15965da Fix #78863: DirectoryIterator class silently truncates after a null byte
Since the constructor of DirectoryIterator and friends is supposed to
accepts paths (i.e. strings without NUL bytes), we must not accept
arbitrary strings.
2019-12-16 00:02:57 -08:00
Nikita Popov
4b9ebd837b Allow throwing exception while loading parent class
This is a fix for symfony/symfony#32995.

The behavior is:

* Throwing exception when loading parent/interface is allowed
  (and we will also throw one if the class is simply not found).
* If this happens, the bucket key for the class is reset, so
  it's possibly to try registering the same class again.
* However, if the class has already been used due to a variance
  obligation, the exception is upgraded to a fatal error, as we
  cannot safely unregister the class stub anymore.
2019-09-12 16:41:18 +02:00
Nikita Popov
51fd8bd3ee Merge branch 'PHP-7.3' into PHP-7.4 2019-09-09 17:29:49 +02:00
Nikita Popov
3f2d5c612e Merge branch 'PHP-7.2' into PHP-7.3 2019-09-09 17:29:39 +02:00
CHU Zhaowei
1ac6b0251b Fix bug #72884 isCloneable() on SplFileObject should return false 2019-09-09 17:27:17 +02:00
Nikita Popov
9483c50772 Fixed bug #78456 2019-08-26 11:08:42 +02:00
Nikita Popov
9173c21a35 Support variable element size in spl heap implementation
This allows us to drop the intermediate allocation for
spl_pqueue_elem.

This fixes GC for SplPriorityQueue, because we can now directly
return a well-formed GC child buffer.
2019-08-23 15:29:53 +02:00
Nikita Popov
13e92223c0 Fixed bug #78436 2019-08-23 15:27:28 +02:00
Nikita Popov
34885408db Fixed bug #78409
This removes an incorrect optimization (I think this code used to be
necessary to properly handle references in the Serializable based
implementation, but now this code just avoids an array duplication
in a way that is not sound).
2019-08-15 10:40:28 +02:00
Nikita Popov
bc690d63f6 Adjust GC count in SPL test 2019-08-13 12:34:48 +02:00
Nikita Popov
3121b7174f Deprecate Reflection export() methods
And remove the Reflector::export() interface method.
2019-07-22 11:39:52 +02:00
Nikita Popov
0ba7c3eadf Deprecate array_key_exists() on objects 2019-07-22 11:39:52 +02:00
Peter Kokot
f5e4771824 Remove checks for always enabled spl and pcre
Closes GH-4397
2019-07-13 14:47:37 +02:00
Nikita Popov
2e56e14e39 Swap implode() argument order in some tests 2019-07-12 12:54:10 +02:00
Nikita Popov
c42b7dd6d3 Throw notice on array access on illegal type
No notice is thrown for list() accesses, because we did not come
to an agreement regarding patterns like

    while ([$key, $value] = yield $it->next()) { ... }

where silent null access may be desirable.

No effort is made to suppress multiple notices in access chains
likes $x[0][0][0], because the technical complexity this causes
does not seem worthwhile.

RFC: https://wiki.php.net/rfc/notice-for-non-valid-array-container
2019-07-10 12:02:14 +02:00
Nikita Popov
4e9a65447f Fix file conflicts in SplFileObject fputcsv tests 2019-06-17 15:08:52 +02:00
Nikita Popov
89b2d88659 Register class before fetching parent
We want the class declaration to be available while compiling the
parent class.
2019-06-11 13:09:33 +02:00
Nikita Popov
a31f46421d Allow exceptions in __toString()
RFC: https://wiki.php.net/rfc/tostring_exceptions

And convert some object to string conversion related recoverable
fatal errors into Error exceptions.

Improve exception safety of internal code performing string
conversions.
2019-06-05 14:25:07 +02:00
Nikita Popov
46d5a9bef9 Avoid concurrent directory writes in FilesystemIterator test
The test directory is often used for temporary files, let's use
the source directory, which should be more stable. If that doesn't
work we need to create a temporary directory.
2019-06-05 09:58:59 +02:00
Gabriel Caruso
4bb6f9ba99 Make more tests run on Windows 2019-05-27 10:51:53 +02:00
Jaroslav Hanslík
d6c0c5ef8e Fixed some arg infos to match documentation 2019-05-22 09:05:32 +02:00
Peter Kokot
8ef2121ee1 Fix comment to match the future zts configuration option 2019-05-11 15:03:17 +02:00
Peter Kokot
c453196be4 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Convert CRLF line endings to LF
2019-05-07 04:35:43 +02:00
Peter Kokot
d153fbc5a9 Convert CRLF line endings to LF
This patch simplifies line endings tracked in the Git repository and
syncs them to all include the LF style instead of the CRLF files.

Newline characters:
- LF (\n) (*nix and Mac)
- CRLF (\r\n) (Windows)
- CR (\r) (old Mac, obsolete)

To see which line endings are in the index and in the working copy the
following command can be used:
`git ls-files --eol`

Git additionally provides `.gitattributes` file to specify if some files
need to have specific line endings on all platforms (either CRLF or LF).

Changed files shouldn't cause issues on modern Windows platforms because
also Git can do output conversion is core.autocrlf=true is set on
Windows and use CRLF newlines in all files in the working tree.

Unless CRLF files are tracked specifically, Git by default tracks all
files in the index using LF newlines.
2019-05-07 04:34:37 +02:00
Peter Kokot
74e72496fa Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Update NEWS
  Update NEWS
  Fix #77024: SplFileObject::__toString() may return array
2019-04-28 00:51:38 +02:00
Peter Kokot
1bdd97a601 Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Update NEWS
  Fix #77024: SplFileObject::__toString() may return array
2019-04-28 00:50:54 +02:00
Craig Duncan
91c6fb881e Fix #77024: SplFileObject::__toString() may return array
- Correct the behaviour of casting spl files to strings
- Add a test for Bug 77024
2019-04-28 00:44:48 +02:00
Nikita Popov
32fb2d9343 Merge branch 'PHP-7.3' into PHP-7.4 2019-04-16 10:39:48 +02:00
Nikita Popov
9a9eed472b Fix second part of bug #77903
When a HT iterator is one past the end and we rehash, we need to make
sure that it is move to the new one past the end position, to make
sure that newly inserted elements are picked up.
2019-04-16 10:38:20 +02:00
Nikita Popov
e1b4cabbd6 Partial fix for bug #77903
In the hash position APIs, make sure we always advance to the next
non-undef element and not just when the position is 0 (similar to
what foreach does). This can happen when the position of an
ArrayIterator is one past its current end and a new element is
inserted not directly at that position because the array is packed.

There is still a bug here (as shown in the tests), but this is a
separate issue that also affects plain array iteration in foreach.
2019-04-16 10:23:11 +02:00
Nikita Popov
2d823cb681 Fix error message in spl_autoload test 2019-04-11 15:22:59 +02:00
Nikita Popov
e2ea0f105c Fix bug #77866: Port Serializable SPL classes to use __unserialize()
Payloads created using Serializable are still supported.
2019-04-10 09:36:39 +02:00
Peter Kokot
bb8ea4d64d Clean ext/spl/tests/bug42364.phpt files after tests 2019-04-02 23:24:21 +02:00