summaryrefslogtreecommitdiff
path: root/tests/basic
Commit message (Collapse)AuthorAgeFilesLines
* Merge branch 'PHP-8.0'Christoph M. Becker2020-12-231-0/+28
|\ | | | | | | | | * PHP-8.0: Fix #80384: limit read buffer size
| * Merge branch 'PHP-7.4' into PHP-8.0Christoph M. Becker2020-12-231-0/+28
| |\ | | | | | | | | | | | | * PHP-7.4: Fix #80384: limit read buffer size
| | * Fix #80384: limit read buffer sizeAdam Seitz2020-12-231-0/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In the case of a stream with no filters, php_stream_fill_read_buffer only reads stream->chunk_size into the read buffer. If the stream has filters attached, it could unnecessarily buffer a large amount of data. With this change, php_stream_fill_read_buffer only proceeds until either the requested size or stream->chunk_size is available in the read buffer. Co-authored-by: Christoph M. Becker <cmbecker69@gmx.de> Closes GH-6444.
* | | Use ephemeral port in more server testsNikita Popov2020-10-231-2/+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.
* | Merge branch 'PHP-7.4'Stanislav Malyshev2020-09-283-4/+32
|\ \ | |/ | | | | | | | | | | | | | | * PHP-7.4: Update UPGRADING Update UPGRADING Update NEWS & UPGRADING Do not decode cookie names anymore Fix bug #79601 (Wrong ciphertext/tag in AES-CCM encryption for a 12 bytes IV)
| * Merge branch 'PHP-7.3' into PHP-7.4Stanislav Malyshev2020-09-283-4/+32
| |\ | | | | | | | | | | | | | | | | | | | | | * PHP-7.3: Update UPGRADING Update NEWS & UPGRADING Do not decode cookie names anymore Fix bug #79601 (Wrong ciphertext/tag in AES-CCM encryption for a 12 bytes IV)
| | * Merge branch 'PHP-7.2' into PHP-7.3Stanislav Malyshev2020-09-283-4/+32
| | |\ | | | | | | | | | | | | | | | | | | | | | | | | * PHP-7.2: Update NEWS & UPGRADING Do not decode cookie names anymore Fix bug #79601 (Wrong ciphertext/tag in AES-CCM encryption for a 12 bytes IV)
| | | * Do not decode cookie names anymoreStanislav Malyshev2020-09-263-4/+32
| | | |
* | | | Add many missing closing PHP tags to testsMáté Kocsis2020-08-0910-0/+10
| | | | | | | | | | | | | | | | Closes GH-5958
* | | | Fix #78236: convert error on receiving variables when duplicate [Christoph M. Becker2020-07-231-0/+17
| | | | | | | | | | | | | | | | | | | | | | | | When an input variable name contains a non matched open bracket, we not only have to replace that with an underscore, but also all following forbidden characters.
* | | | Honor script time limit when calling shutdown functionsAlex Dowad2020-05-132-4/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A time limit can be set on PHP script execution via `set_time_limit` (or .ini file). When the time limit is reached, the OS will notify PHP and `timed_out` and `vm_interrupt` flags are set. While these flags are regularly checked when executing PHP code, once the end of the script is reached, they are not checked while invoking shutdown functions (registered via `register_shutdown_function`). Of course, if the shutdown functions are implemented *in* PHP, then the interrupt flag will be checked while the VM is running PHP bytecode and the timeout will take effect. But if the shutdown functions are built-in (implemented in C), it will not. Since the shutdown functions are invoked through `zend_call_function`, add a check of the `vm_interrupt` flag there. Then, the script time limit will be respected when *entering* each shutdown function. The fact still remains that if a shutdown function is built-in and runs for a long time, script execution will not time out until it finishes and the interpreter tries to invoke the next one. Still, the behavior of scripts with execution time limits will be more consistent after this patch. To make the execution time-out feature work even more precisely, it would be necessary to scrutinize all the built-in functions and add checks of the `vm_interrupt` flag in any which can run for a long time. That might not be worth the effort, though. It should be mentioned that this patch does not solely affect shutdown functions, neither does it solely allow for interruption of running code due to script execution timeout. Anything else which causes `vm_interrupt` to be set, such as the PHP interpreter receiving a signal, will take effect when exiting from an internal function. And not just internal functions which are called because they were registered to run at shutdown; there are other cases where a series of internal functions might run in the midst of a script. In all such cases, it will be possible to interrupt the interpreter now. Closes GH-5543.
* | | | Make float to string casts locale-independentMáté Kocsis2020-05-081-0/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | From now on, float to string casting will always behave locale-independently. RFC: https://wiki.php.net/rfc/locale_independent_float_to_string Closes GH-5224 Co-authored-by: George Peter Banyard <girgias@php.net>
* | | | Completely remove disabled functions from function tableNikita Popov2020-04-301-3/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently, disabling a function only replaces the internal function handler with one that throws a warning, and a few places in the engine special-case such functions, such as function_exists. This leaves us with a Schrödinger's function, which both does not exist (function_exists returns false) and does exist (you cannot define a function with the same name). In particular, this prevents the implementation of robust polyfills, as reported in https://bugs.php.net/bug.php?id=79382: if (!function_exists('getallheaders')) { function getallheaders(...) { ... } } If getallheaders() is a disabled function, this code will break. This patch changes disable_functions to remove the functions from the function table completely. For all intents and purposes, it will look like the function does not exist. This also renders two bits of PHP functionality obsolete and thus deprecated: * ReflectionFunction::isDisabled(), as it will no longer be possible to construct the ReflectionFunction of a disabled function in the first place. * get_defined_functions() with $exclude_disabled=false, as get_defined_functions() now never returns disabled functions. Fixed bug #79382. Closes GH-5473.
* | | | Improve undefined variable error messagesMáté Kocsis2020-03-314-4/+4
| | | | | | | | | | | | | | | | Closes GH-5312
* | | | Reindent phpt filesNikita Popov2020-02-0311-23/+23
| | | |
* | | | Merge branch 'PHP-7.4'Christoph M. Becker2019-12-121-0/+16
|\ \ \ \ | |/ / / | | | | | | | | | | | | * PHP-7.4: Fix #78929: plus signs in cookie values are converted to spaces
| * | | Fix #78929: plus signs in cookie values are converted to spacesKachalin Alexey2019-12-121-0/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | We switch the cookie value parsing function from `php_url_decode()` to `php_raw_url_decode()`, so that cookie values are now parsed according to RFC 6265, section 4.1.1. We also refactor to remove duplicate code without changing the execution flow.
* | | | Merge branch 'PHP-7.4'Nikita Popov2019-12-0512-202/+52
|\ \ \ \ | |/ / / | | | | | | | | | | | | * PHP-7.4: Fix timeout tests
| * | | Fix timeout testsNikita Popov2019-12-0512-202/+52
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | After taking a more detailed look at our commonly failing timeout tests... turns out that most of them are useless as written and don't test what they're supposed to. This PR has a couple of changes: * Tests for timeout in while/for/foreach should just have the loop as an infinite loop. Calling into something like busy_wait means that we just end up always testing whatever busy_wait does. * Tests for timeouts in calls need to be based on something like sleep, otherwise we'd have to introduce a loop, and we'd end up testing timeout of the looping structure instead. Using sleep only works on Windows, because that's the only system where sleep counts towards the timeout. As such, many of those tests are now Windows only. * Removed some tests where I don't see a good way to test what they're supposed to test. E.g. how can we test a timeout in eval() specifically? The shutdown function tests are marked as XFAIL, as we are currently missing a timeout check in call_user_function. I believe that's a legitimate issue. Closes GH-4969.
* | | | Clean DONE tags from testsFabien Villepinte2019-11-071-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Remove most of the `===DONE===` tags and its variations. Keep `===DONE===` if the test output otherwise becomes empty. Closes GH-4872.
* | | | Merge branch 'PHP-7.4'Fabien Villepinte2019-10-208-1/+29
|\ \ \ \ | |/ / /
| * | | Improve the error message in timeout testsFabien Villepinte2019-10-208-1/+29
| | | | | | | | | | | | | | | | Closes GH-4818.
* | | | Convert some notices to warningsNikita Popov2019-10-024-4/+4
| | | | | | | | | | | | | | | | Part of https://wiki.php.net/rfc/engine_warnings.
* | | | Merge branch 'PHP-7.4'Nikita Popov2019-09-301-1/+1
|\ \ \ \ | |/ / /
| * | | Fix borked SKIPIFsFabien Villepinte2019-09-301-1/+1
| | | |
* | | | Merge branch 'PHP-7.4'Nikita Popov2019-07-121-7/+7
|\ \ \ \ | |/ / /
| * | | Swap implode() argument order in some testsNikita Popov2019-07-121-7/+7
| | | |
* | | | Merge branch 'PHP-7.4'Nikita Popov2019-07-111-1/+3
|\ \ \ \ | |/ / /
| * | | Switch to using shell-less proc_open() in various server testsNikita Popov2019-07-111-1/+3
| | | |
* | | | Merge branch 'PHP-7.4'Nikita Popov2019-07-081-5/+5
|\ \ \ \ | |/ / /
| * | | Make busy wait busierNikita Popov2019-07-081-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Another stab in the dark to fix the intermittent failures of timeout tests on macos CI: We're using ITIMER_PROF, which means that the timer counts against user+system time. The "busy" wait loop counts against real time. Currently it calls microtime() on every iteration. If that call is implemented as a syscall rather than going through vDSO or commpage we might be seeing many context switches here which drive up the real time, but not user or system time. See if making the loop busier and calling microtime() less helps the situation.
* | | | Merge branch 'PHP-7.4'Christoph M. Becker2019-05-271-6/+0
|\ \ \ \ | |/ / / | | | | | | | | | | | | * PHP-7.4: Make more tests run on Windows
| * | | Make more tests run on WindowsGabriel Caruso2019-05-271-6/+0
| | | |
* | | | Merge branch 'PHP-7.4'Nikita Popov2019-04-171-2/+2
|\ \ \ \ | |/ / /
| * | | Remove some uses of deprecated internal_encoding settings in testsNikita Popov2019-04-171-2/+2
| | | |
* | | | Merge branch 'PHP-7.4'Peter Kokot2019-03-1511-11/+11
|\ \ \ \ | |/ / / | | | | | | | | | | | | * PHP-7.4: Replace dirname(__FILE__) by __DIR__ in tests
| * | | Replace dirname(__FILE__) by __DIR__ in testsFabien Villepinte2019-03-1511-11/+11
| | | |
* | | | Merge branch 'PHP-7.4'Nikita Popov2019-02-201-0/+2
|\ \ \ \ | |/ / /
| * | | Implement fine-grained conflict handlingNikita Popov2019-02-201-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | Tests can specify conflict keys, either in --CONFLICTS-- or a per-directory CONFLICTS file. Non-conflicting tests may be run in parallel.
* | | | Remove unnecessary CLI checks in testsGabriel Caruso2019-01-312-8/+0
| | | |
* | | | Remove track_errors and $php_errormsgNikita Popov2019-01-281-33/+0
|/ / / | | | | | | | | | | | | This has been deprecated in PHP 7.2 as part of https://wiki.php.net/rfc/deprecations_php_7_2.
* | | Merge branch 'PHP-7.3'Nikita Popov2019-01-181-0/+34
|\ \ \ | |/ /
| * | Merge branch 'PHP-7.2' into PHP-7.3Nikita Popov2019-01-181-0/+34
| |\ \ | | |/
| | * Fix seeking in php://inputLauri Kenttä2019-01-181-0/+34
| | |
| | * Sync leading and final newlines in *.phpt sectionsPeter Kokot2018-10-152-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds missing newlines, trims multiple redundant final newlines into a single one, and trims redundant leading newlines in all *.phpt sections. According to POSIX, a line is a sequence of zero or more non-' <newline>' characters plus a terminating '<newline>' character. [1] Files should normally have at least one final newline character. C89 [2] and later standards [3] mention a final newline: "A source file that is not empty shall end in a new-line character, which shall not be immediately preceded by a backslash character." Although it is not mandatory for all files to have a final newline fixed, a more consistent and homogeneous approach brings less of commit differences issues and a better development experience in certain text editors and IDEs. [1] http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_206 [2] https://port70.net/~nsz/c/c89/c89-draft.html#2.1.1.2 [3] https://port70.net/~nsz/c/c99/n1256.html#5.1.1.2
| | * Trim trailing whitespace in *.phptPeter Kokot2018-10-1426-45/+45
| | |
| | * Sync leading and final newlines in source code filesPeter Kokot2018-10-141-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds missing newlines, trims multiple redundant final newlines into a single one, and trims redundant leading newlines. According to POSIX, a line is a sequence of zero or more non-' <newline>' characters plus a terminating '<newline>' character. [1] Files should normally have at least one final newline character. C89 [2] and later standards [3] mention a final newline: "A source file that is not empty shall end in a new-line character, which shall not be immediately preceded by a backslash character." Although it is not mandatory for all files to have a final newline fixed, a more consistent and homogeneous approach brings less of commit differences issues and a better development experience in certain text editors and IDEs. [1] http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_206 [2] https://port70.net/~nsz/c/c89/c89-draft.html#2.1.1.2 [3] https://port70.net/~nsz/c/c99/n1256.html#5.1.1.2
| * | Sync leading and final newlines in *.phpt sectionsPeter Kokot2018-10-151-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds missing newlines, trims multiple redundant final newlines into a single one, and trims redundant leading newlines in all *.phpt sections. According to POSIX, a line is a sequence of zero or more non-' <newline>' characters plus a terminating '<newline>' character. [1] Files should normally have at least one final newline character. C89 [2] and later standards [3] mention a final newline: "A source file that is not empty shall end in a new-line character, which shall not be immediately preceded by a backslash character." Although it is not mandatory for all files to have a final newline fixed, a more consistent and homogeneous approach brings less of commit differences issues and a better development experience in certain text editors and IDEs. [1] http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_206 [2] https://port70.net/~nsz/c/c89/c89-draft.html#2.1.1.2 [3] https://port70.net/~nsz/c/c99/n1256.html#5.1.1.2
| * | Trim trailing whitespace in *.phptPeter Kokot2018-10-1426-45/+45
| | |
| * | Sync leading and final newlines in source code filesPeter Kokot2018-10-141-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds missing newlines, trims multiple redundant final newlines into a single one, and trims redundant leading newlines. According to POSIX, a line is a sequence of zero or more non-' <newline>' characters plus a terminating '<newline>' character. [1] Files should normally have at least one final newline character. C89 [2] and later standards [3] mention a final newline: "A source file that is not empty shall end in a new-line character, which shall not be immediately preceded by a backslash character." Although it is not mandatory for all files to have a final newline fixed, a more consistent and homogeneous approach brings less of commit differences issues and a better development experience in certain text editors and IDEs. [1] http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_206 [2] https://port70.net/~nsz/c/c89/c89-draft.html#2.1.1.2 [3] https://port70.net/~nsz/c/c99/n1256.html#5.1.1.2