summaryrefslogtreecommitdiff
path: root/ext/standard/tests
Commit message (Collapse)AuthorAgeFilesLines
* Use ephemeral port in more server testsNikita Popov2020-10-232-4/+0
| | | | | | | | | | | Port the main php_cli_server.inc to use ephemeral ports, thus allowing CLI server tests to be parallelized. A complication here is that we also need to give each test a separate doc root, to avoid index.php files writing over each other. Closes GH-6375.
* Fixed bug #80256Nikita Popov2020-10-201-0/+29
| | | | | | Remove the transfer_encoding stream filter immediately when we destroy the old stream, to make sure it doesn't get attached to the new stream.
* Remove string length limit from levenshtein()Nikita Popov2020-10-091-3/+5
| | | | | | | | | As noted on https://bugs.php.net/bug.php?id=80073, I don't think having this limitation makes sense. The similar_text() function has much worse asymptotic complexity than levenshtein() and does not enforce such a limitation. levenshtein() does have fairly high memory requirements, but they are a fixed factor of the string length (and subject to memory limit).
* Update ext/sockets parameter namesNikita Popov2020-10-064-4/+4
| | | | | | | Also change $max_length to $length in a number of filesystem APIs, where our usage was inconsistent. Closes GH-6276.
* Update ext/posix parameter namesNikita Popov2020-10-061-8/+8
| | | | Closes GH-6275.
* Fix #64060: lstat_stat_variation7.phpt fails on certain file systemsChristoph M. Becker2020-10-021-0/+1
| | | | Closes GH-6194.
* Review parameter names in ext/pcreMáté Kocsis2020-10-021-1/+1
| | | | Closes GH-6259
* Update ext/standard parameter namesNikita Popov2020-09-2983-5366/+5366
| | | | Closes GH-6214.
* Don't accept dir handle in Directory methodsNikita Popov2020-09-291-6/+3
| | | | | | This is an artifact of the shared implementation with readdir() etc. The method versions should not accept an explicit dir handle, as they work on the dir handle from the object.
* Merge branch 'PHP-7.4'Nikita Popov2020-09-295-0/+30
|\ | | | | | | | | | | * PHP-7.4: Fix bug #80137 Fix bug #80138
| * Merge branch 'PHP-7.3' into PHP-7.4Nikita Popov2020-09-295-0/+30
| |\ | | | | | | | | | | | | | | | * PHP-7.3: Fix bug #80137 Fix bug #80138
| | * Fix bug #80137Matthias Karbe2020-09-292-0/+12
| | | | | | | | | | | | | | | | | | | | | Skip getprotobyname() and getprotobynumber() tests on *nix if there is no /etc/protocols file. Closes GH-6193.
| | * Fix bug #80138Matthias Karbe2020-09-293-0/+18
| | | | | | | | | | | | | | | | | | | | | Skip getservbyname() and getservbyport() tests on *nix if there is no /etc/services file. Closes GH-6191.
* | | Update mbstring parameter namesNikita Popov2020-09-283-7/+7
| | | | | | | | | | | | Closes GH-6207.
* | | Use callable type in register_shutdown_function()Nikita Popov2020-09-252-8/+8
| | | | | | | | | | | | | | | | | | To make things a bit less weird, split off the function name into a zval stored separately from the arguments. This allows us to use normal zpp and get standard behavior.
* | | Unify 32-bit/64-bit str_split testsNikita Popov2020-09-254-296/+0
| | | | | | | | | | | | | | | | | | The 32-bit tests work on both 32-bit and 64-bit. I dropped the 64-bit variants as they only test one additional case that I don't think adds particular value.
* | | Normalize substr() behaviorNikita Popov2020-09-252-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Make the behavior of substr(), mb_substr(), iconv_substr() and grapheme_substr() consistent when it comes to the handling of out of bounds offsets. substr() will now always clamp out of bounds offsets to the string boundary. Cases that previously returned false will now return an empty string. This means that substr() itself *always* returns a string now (like mb_substr() already did before.) Closes GH-6182.
* | | Fix #80139: copy_variation5.phpt fails when run on bind mountChristoph M. Becker2020-09-231-2/+1
| | | | | | | | | | | | | | | This test case is not supposed to run on case-insensitive file system; just checking for macOS/Windows doesn't cut it.
* | | Clean up file created during testingChristoph M. Becker2020-09-231-0/+4
| | |
* | | Merge branch 'PHP-7.4' into masterChristoph M. Becker2020-09-231-0/+8
|\ \ \ | |/ / | | | | | | | | | * PHP-7.4: Fix #76735: Incorrect message in fopen on invalid mode
| * | Merge branch 'PHP-7.3' into PHP-7.4Christoph M. Becker2020-09-231-0/+8
| |\ \ | | |/ | | | | | | | | | * PHP-7.3: Fix #76735: Incorrect message in fopen on invalid mode
| | * Fix #76735: Incorrect message in fopen on invalid modeChristoph M. Becker2020-09-231-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | We have to log errors in `stream_opener` callbacks to the wrapper's error log, because otherwise we may pick up an unrelated `errno` or a most generic message. Closes GH-6187.
* | | Consistent error handling for fgetcsv/fputcsvNikita Popov2020-09-236-3767/+968
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | | Merge branch 'PHP-7.4' into masterChristoph M. Becker2020-09-221-0/+28
|\ \ \ | |/ / | | | | | | | | | * PHP-7.4: Fix #76943: Inconsistent stream_wrapper_restore() errors
| * | Merge branch 'PHP-7.3' into PHP-7.4Christoph M. Becker2020-09-221-0/+28
| |\ \ | | |/ | | | | | | | | | * PHP-7.3: Fix #76943: Inconsistent stream_wrapper_restore() errors
| | * Fix #76943: Inconsistent stream_wrapper_restore() errorsChristoph M. Becker2020-09-221-0/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If restoring of any not registered built-in wrapper is requested, the function is supposed to fail with a warning, so we have to check this condition first. Furthermore, to be able to detect whether a built-in wrapper has been changed, it is not sufficient to check whether *any* userland wrapper has been registered, but rather whether the specific wrapper has been modified. Closes GH-6183.
* | | Promote pack/unpack format errorsNikita Popov2020-09-224-57/+63
| | | | | | | | | | | | | | | | | | | | | Errors related to invalid format strings (unlike data mismatch errors) should throw ValueError. Closes GH-6185.
* | | Convert unpack offset warning to ValueErrorNikita Popov2020-09-221-0/+13
| | |
* | | Support uuencoding empty stringNikita Popov2020-09-221-4/+9
| | | | | | | | | | | | | | | | | | | | | Cross checking implementations from other languages, empty strings are always allowed. PHP's output is peculiar due to it's insistence to encode a trailing \0, but otherwise sensible and does round-trip as expected.
* | | Don't return false for empty string in soundex()Nikita Popov2020-09-221-1/+1
| | | | | | | | | | | | | | | | | | | | | Return "0000" instead of false to have a consistent return type. "0000" is already a possible return value if the string doesn't contain any letters, such as with soundex(" "). We can treat the case of soundex("") exactly the same.
* | | Skip if https wrapper isn't presentLevi Morrison2020-09-221-0/+1
| | |
* | | Validate phonemes parameter of metaphone()Nikita Popov2020-09-221-4/+6
| | | | | | | | | | | | And thus avoid the false return value.
* | | Check string bounds in strspn/strcspnNikita Popov2020-09-2212-9615/+4662
| | | | | | | | | | | | | | | strspn/strcspn are string search functions, and as such should throw ValueError on out-of-bounds offsets, just like strpos etc do.
* | | Promote substr_replace warningsNikita Popov2020-09-221-25/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The implementation here was pretty confused. In reality the only error condition it has right now is that for a string input, from & length cannot be arrays. The fact that the array lengths are the same was probably supposed to be checked for the case of array input, as it wouldn't matter otherwise.
* | | Promote count() warning to TypeErrorGeorge Peter Banyard2020-09-217-1010/+86
| | | | | | | | | | | | Closes GH-6180
* | | Throw warning for failed object to int/float conversionNikita Popov2020-09-216-31/+24
| | | | | | | | | | | | | | | | | | 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.
* | | Consolidate the usage of "either" and "one of" in error messagesMáté Kocsis2020-09-202-5/+5
| | | | | | | | | | | | Closes GH-6173
* | | Merge branch 'PHP-7.4' into masterChristoph M. Becker2020-09-2011-0/+27
|\ \ \ | |/ / | | | | | | | | | * PHP-7.4: Fix #80114: parse_url does not accept URLs with port 0
| * | Merge branch 'PHP-7.3' into PHP-7.4Christoph M. Becker2020-09-2011-0/+27
| |\ \ | | |/ | | | | | | | | | * PHP-7.3: Fix #80114: parse_url does not accept URLs with port 0
| | * Fix #80114: parse_url does not accept URLs with port 0Christoph M. Becker2020-09-2011-0/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | URIs with a 0 port are generally valid, so `parse_url()` should recognize such URIs, but still report the port as missing. Co-authored-by: twosee <twose@qq.com> Closes GH-6152.
* | | Run tidyNikita Popov2020-09-1883-200/+200
| | | | | | | | | | | | | | | This should fix most of the remaining issues with tabs and spaces being mixed in tests.
* | | Allow http tests to run in parallel by using ephemeral portsSara Golemon2020-09-1725-201/+188
| | |
* | | Promote a few remaining errors in ext/standardMáté Kocsis2020-09-1535-928/+1057
| | | | | | | | | | | | Closes GH-6110
* | | Update array parameter names for named parametersLarry Garfield2020-09-145-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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.
* | | Normalize behaviour of DNS function on WindowsGeorge Peter Banyard2020-09-122-0/+50
| | | | | | | | | | | | | | | | | | This is a follow-up on commit 4a438b44694d4caf86d8e57266ed2fc2f4ae6213 Add some tests to hopefully not forget it next time
* | | Also forbid null bytes in mail()Nikita Popov2020-09-111-0/+38
| | | | | | | | | | | | | | | I've adjusted mb_send_mail() already, but of course the handling in mail() should be the same.
* | | Merge branch 'PHP-7.4' into masterChristoph M. Becker2020-09-112-1/+16
|\ \ \ | |/ / | | | | | | | | | * PHP-7.4: Fix #80067: Omitting the port in bindto setting errors
| * | Merge branch 'PHP-7.3' into PHP-7.4Christoph M. Becker2020-09-112-1/+16
| |\ \ | | |/ | | | | | | | | | * PHP-7.3: Fix #80067: Omitting the port in bindto setting errors
| | * Fix #80067: Omitting the port in bindto setting errorsChristoph M. Becker2020-09-112-1/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A recent commit[1] which fixed a memory leak introduced a regression regarding the formerly liberal handling of IP addresses to bind to. We fix this by reverting that commit, and fix the memory leak where it actually occurs. In other words, this fix is less intrusive than the former fix. [1] <http://git.php.net/?p=php-src.git;a=commit;h=0b8c83f5936581942715d14883cdebddc18bad30> Closes GH-6104.
* | | Consolidate new union type ZPP macro namesMáté Kocsis2020-09-113-53/+53
| | | | | | | | | | | | | | | | | | | | | They will now follow the canonical order of types. Older macros are left intact due to maintaining BC. Closes GH-6112