summaryrefslogtreecommitdiff
path: root/ext/spl/tests
Commit message (Collapse)AuthorAgeFilesLines
* Fixed error messageDmitry Stogov2021-02-244-12/+12
|
* Fixed bug #80724Cameron Porter2021-02-233-2/+83
| | | | | | | | | FilesystemIterator::FOLLOW_SYMLINKS is currently treated as a directory key mode flag, even though it does not change the way that the key during iteration is set. To address this, FOLLOW_SYMLINKS has been converted into an OTHER flag. Closes GH-6695.
* Merge branch 'PHP-8.0'Nikita Popov2021-02-151-0/+12
|\ | | | | | | | | | | * PHP-8.0: Fix leak when breaking out of FilesystemIterator Fixed bug #80600
| * Merge branch 'PHP-7.4' into PHP-8.0Nikita Popov2021-02-151-0/+12
| |\ | | | | | | | | | | | | * PHP-7.4: Fix leak when breaking out of FilesystemIterator
| | * Fix leak when breaking out of FilesystemIteratorNikita Popov2021-02-151-0/+12
| | | | | | | | | | | | | | | | | | | | | | | | We need to always destroy current, not just when iter.data is not set. Take this opportunity to clean up the iterator destructor code a bit, to remove redundant checks and incorrect comments.
* | | Deprecate passing null to non-nullable arg of internal functionNikita Popov2021-02-1111-26/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This deprecates passing null to non-nullable scale arguments of internal functions, with the eventual goal of making the behavior consistent with userland functions, where null is never accepted for non-nullable arguments. This change is expected to cause quite a lot of fallout. In most cases, calling code should be adjusted to avoid passing null. In some cases, PHP should be adjusted to make some function arguments nullable. I have already fixed a number of functions before landing this, but feel free to file a bug if you encounter a function that doesn't accept null, but probably should. (The rule of thumb for this to be applicable is that the function must have special behavior for 0 or "", which is distinct from the natural behavior of the parameter.) RFC: https://wiki.php.net/rfc/deprecate_null_to_scalar_internal_arg Closes GH-6475.
* | | Merge branch 'PHP-8.0'Nikita Popov2021-02-113-6/+25
|\ \ \ | |/ / | | | | | | | | | * PHP-8.0: Fixed bug #80719
| * | Merge branch 'PHP-7.4' into PHP-8.0Nikita Popov2021-02-113-6/+25
| |\ \ | | |/ | | | | | | | | | * PHP-7.4: Fixed bug #80719
| | * Fixed bug #80719Nikita Popov2021-02-113-6/+21
| | |
* | | Fix proptable canonicalization bypass in ArrayObjectNikita Popov2021-01-261-0/+33
| | | | | | | | | | | | | | | | | | When an ArrayObject wraps an object, we should be using the proptable canonicalilzation rules, which require all keys to be strings.
* | | Fix INDIRECT elements leaked by SPL __serialize implementationsNikita Popov2021-01-121-0/+0
|/ /
* | Fix #62004: SplFileObject: fgets after seek returns wrong lineChristoph M. Becker2020-11-307-4/+44
| | | | | | | | | | | | | | | | | | | | | | | | As it is, `::seek(0)` sets the file pointer to the beginning of the file, but `::seek($n)` where `$n > 0` sets the file pointer to the beginning of the following line, having line `$n` already read into the line buffer. This is pretty inconsistent; we fix it by always seeking to the beginning of the line. We also add a test case for the duplicate bug #46569. Closes GH-6434.
* | Use separate directory in dit_004.phptNikita Popov2020-10-261-1/+15
| | | | | | | | | | Make sure the directory is not modified while we're iterating it, which may give unstable results.
* | Properly validate ArrayObject::asort() argumentNikita Popov2020-10-222-2/+2
| |
* | Add additional initialization checks to SplFileInfoNikita Popov2020-10-191-0/+19
| |
* | Update ext/spl parameter namesNikita Popov2020-10-0727-40/+40
| | | | | | | | Closes GH-6284.
* | Support GC for AppendIteratorNikita Popov2020-10-011-2/+0
| | | | | | | | | | This also requires adding GC support for ArrayIterator internal iterators.
* | Fix bug #65387Nikita Popov2020-10-011-0/+54
| | | | | | | | | | Add GC support to dual_it. This is still missing AppendIterator support.
* | Consistent error handling for fgetcsv/fputcsvNikita Popov2020-09-238-31/+56
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Normalize the behavior between the file functions and those on SplFileObject. Be consistent about throwing regardless of whether the delimiter etc is empty or has too many characters. I don't think it's worthwhile to distinguish these cases. Back when we looked into this originally, there was some hope that we might want to add support for multiple-character delimiter etc, but after a cursory look, I really don't think this is going to happen (for fputcsv maybe, but for fgetcsv this just makes an already broken function much more complicated.) Closes GH-6188.
* | SplFixedArray is Aggregate, not IterableAlex Dowad2020-09-236-157/+108
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | One strange feature of SplFixedArray was that it could not be used in nested foreach loops. If one did so, the inner loop would overwrite the iteration state of the outer loop. To illustrate: $spl = SplFixedArray::fromArray([0, 1]); foreach ($spl as $a) { foreach ($spl as $b) { echo "$a $b"; } } Would only print two lines: 0 0 0 1 Use the new InternalIterator feature which was introduced in ff19ec2df3 to convert SplFixedArray to an Aggregate rather than Iterable. As a bonus, we get to trim down some ugly code! Yay!
* | Throw warning for failed object to int/float conversionNikita Popov2020-09-211-1/+1
| | | | | | | | | | | | We previously couldn't increase the error level here because it was coupled to comparison handling. This is no longer the case in PHP 8.
* | Run tidyNikita Popov2020-09-181-8/+8
| | | | | | | | | | This should fix most of the remaining issues with tabs and spaces being mixed in tests.
* | Use ValueError instead of exceptions in SPL extensionGeorge Peter Banyard2020-09-1511-83/+61
| |
* | Use normal error in SPL for uninitialized objectsGeorge Peter Banyard2020-09-155-26/+26
| |
* | Use normal error in SPL for 'An iterator cannot be used with foreach by ↵George Peter Banyard2020-09-156-6/+6
| | | | | | | | reference'
* | Update array parameter names for named parametersLarry Garfield2020-09-142-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * The array "subject" of a function gets called $array. * Further parameters should be self-descriptive if used as a named parameter, and a full word, not an abbreviation. * If there is a "bunch more arrays" variadic, it gets called $arrays (because that's what was already there). * A few functions have a variadic "a bunch more arrays, and then a callable", and were already called $rest. I left those as is and died a little inside. * Any callable provided to an array function that acts on the array is called $callback. (Nearly all were already, I just fixed the one or two outliers.) * array_multisort() is beyond help so I ran screaming.
* | Improve error messages mentioning parameters instead of argumentsMáté Kocsis2020-09-0913-21/+21
| | | | | | | | Closes GH-5999
* | Make null byte error a ValueErrorNikita Popov2020-09-083-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | Currently we treat paths with null bytes as a TypeError, which is incorrect, and rather inconsistent, as we treat empty paths as ValueError. We do this because the error is generated by zpp and it's easier to always throw TypeError there. This changes the zpp implementation to throw a TypeError only if the type is actually wrong and throw ValueError for null bytes. The error message is also split accordingly, to be more precise. Closes GH-6094.
* | Fix UNKNOWN default values in various extensionsMáté Kocsis2020-09-071-1/+1
| | | | | | | | Closes GH-6075
* | Use ZPP instead of custom type checksMáté Kocsis2020-09-041-3/+3
| | | | | | | | We can add these types as a native type declaration to stubs as a side-effect. Closes GH-6068
* | Error promotions in SPLGeorge Peter Banyard2020-09-033-19/+25
| | | | | | | | | | | | | | 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
* | Refactor parts of SPL Dir/SplFileObjectGeorge Peter Banyard2020-09-031-0/+64
| | | | | | | | | | | | | | | | | | | | | | | | This fixes a way it was possible to trigger an Internel Error by disabling function (via the INI setting) when SPL was acting as a proxy to the function call. Fix flock_compat layer as it needs to used in SPL now. Use macro to check if object is initialized Closes GH-6014
* | Add more precise type info for stubsMáté Kocsis2020-09-0113-22/+22
| | | | | | | | Closes GH-6005
* | Promote ArrayObject modification during sorting to Error exceptionNikita Popov2020-08-282-6/+14
| |
* | Fixed bug #79987 (Memory leak in SplFileInfo because of missing ↵Dmitry Stogov2020-08-181-0/+19
| | | | | | | | zend_restore_error_handling())
* | Add many missing closing PHP tags to testsMáté Kocsis2020-08-0929-0/+29
| | | | | | | | Closes GH-5958
* | Promote "undefined array key" notice to warningNikita Popov2020-08-0319-47/+48
| | | | | | | | | | | | | | This implements the last remaining part of the https://wiki.php.net/rfc/engine_warnings RFC. Closes GH-5927.
* | Convert SPL illegal offset type into TypeErrorNikita Popov2020-08-032-11/+39
| | | | | | | | | | Make this consistent with the corresponding engine behavior. Also adjust the messages to match.
* | Improve a few parameter names in ext/splMáté Kocsis2020-08-033-45/+45
| | | | | | | | Use the same names which are used by zend functions.
* | Improved number to string comparison semanticsNikita Popov2020-07-221-1/+1
| | | | | | | | | | | | RFC: https://wiki.php.net/rfc/string_to_number_comparison Closes GH-3886.
* | Only set DIT type on successful initializationNikita Popov2020-07-171-0/+14
| |
* | Convert SPL fatal error to Error exceptionNikita Popov2020-07-171-3/+4
| |
* | Throw correct exception from ArrayObject sort methodsNikita Popov2020-07-174-20/+28
| | | | | | | | Let normal zpp throw ArgumentCountErrors.
* | Improve output of tokens in Parse ErrorsRowan Tommins2020-07-131-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently, unexpected tokens in the parser are shown as the text found, plus the internal token name, including the notorious "unexpected '::' (T_PAAMAYIM_NEKUDOTAYIM)". This commit replaces that with a more user-friendly format, with two main types of token: * Tokens which always represent the same text are shown like 'unexpected token "::"' and 'expected "::"' * Tokens which have variable text are given a user-friendly name, and show like 'unexpected identifier "foo"', and 'expected identifer'. A few tokens have special cases: * unexpected token """ -> unexpected double-quote mark * unexpected quoted string "'foo'" -> unexpected single-quoted string "foo" * unexpected quoted string ""foo"" -> unexpected double-quoted string "foo" * unexpected illegal character "_" -> unexpected character 0xNN (where _ is almost certainly a control character, and NN is the hexadecimal value of the byte) The \ token has a special case in the implementation just to stop bison making a mess of escaping it and it coming out as \\
* | Review the usage of apostrophes in error messagesMáté Kocsis2020-07-1031-73/+73
| | | | | | | | Closes GH-5590
* | Don't allow separation in CallbackFilterIteratorNikita Popov2020-07-071-2/+2
| | | | | | | | | | As the name might suggest, this is a *filter* iterator. If you want to have a *map* iterator, write one, or use a generator.
* | Merge branch 'PHP-7.4'Christoph M. Becker2020-07-021-6/+2
|\ \ | |/ | | | | | | * PHP-7.4: Extract test helper function for SeCreateSymbolicLinkPrivilege check
| * Extract test helper function for SeCreateSymbolicLinkPrivilege checkChristoph M. Becker2020-07-021-6/+2
| |
* | [ci skip] Various typo fixes in stub comments and CHANGES fileAyesh Karunaratne2020-06-251-1/+1
| |
* | Make sorting stableNikita Popov2020-06-251-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Make user-exposed sorts stable, by storing the position of elements in the original array, and using those positions as a fallback comparison criterion. The base sort is still hybrid q/insert. The use of true/false comparison functions is deprecated (but still supported) and should be replaced by -1/0/1 comparison functions, driven by the <=> operator. RFC: https://wiki.php.net/rfc/stable_sorting Closes GH-5236.