1
0
mirror of https://github.com/php/php-src.git synced 2026-04-21 23:18:13 +02:00
Commit Graph

63 Commits

Author SHA1 Message Date
Niels Dossche f16b34f1d0 Implement GH-10024: support linting multiple files at once using php -l
This is supported in both the CLI and CGI modes. For CLI this required
little changes.

For CGI, the tricky part was that the options parsing happens inside the
loop. This means that options passed after the -l flag were previously
simply ignored. As we now re-enter the loop we would parse the options
again, and if they are handled but don't set the script name, then CGI
will think you want to read from standard in. To keep the same "don't
parse options" behaviour I simply wrapped the options handling inside an
if.

Closes GH-10024.
Closes GH-10710.
2023-07-05 15:20:36 +02:00
Niels Dossche dcc3255b18 Fix GH-10489: run-tests.php does not escape path when building cmd (#10560)
Multiple tests had to be changed to escape the arguments in shell
commands. Some tests are skipped because they behave differently with
spaces in the path versus without. One notable example of this is the
hashbang test which does not work because spaces in hashbangs paths are
not supported in Linux.

Co-authored-by: Michael Voříšek <mvorisek@mvorisek.cz>
2023-02-25 14:02:06 +00:00
dwo0 9c6dd46f27 Skip tests if extension or SAPI is not included. (#9939)
* Skip test if SAPI is not enabled.
* Skip test if simplexml extension is disabled.
2022-11-11 21:17:15 -05:00
Michael Voříšek bd3cd6a41a Fix unstable sapi test, fix GH-9140 (#9184) 2022-08-04 22:35:44 +01:00
Eric Norris 09237f6126 Update request startup error messages 2022-07-18 23:19:59 +01:00
Jakub Zelenka 922371f3b1 Do not send X-Powered-By if headers sent (#9039)
Co-authored-by: Eric Norris <erictnorris@gmail.com>
2022-07-18 18:01:05 +01:00
Christoph M. Becker b7f3b67060 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #81518: Header injection via default_mimetype / default_charset
2021-10-14 12:21:35 +02:00
Christoph M. Becker 365769366b Fix #81518: Header injection via default_mimetype / default_charset
We forbid setting these INI options to values containing NUL bytes, CR
or LF.

Closes GH-7574.
2021-10-14 12:16:19 +02:00
Christoph M. Becker bb4dbbc150 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #80849: HTTP Status header truncation
2021-07-15 19:13:58 +02:00
Christoph M. Becker a054ef2aad Fix #80849: HTTP Status header truncation
While truncating the contents of a header is okay, we must never omit
the trailing CRLF.

Closes GH-7238.
2021-07-15 19:10:53 +02:00
Nikita Popov c5401854fc Run tidy
This should fix most of the remaining issues with tabs and spaces
being mixed in tests.
2020-09-18 14:28:32 +02:00
Máté Kocsis 7aacc705d0 Add many missing closing PHP tags to tests
Closes GH-5958
2020-08-09 22:03:36 +02:00
Nikita Popov 956dde0bc0 Simplify and fix php-cgi detection
Make it work for installed PHP binaries.
2020-06-26 14:17:56 +02:00
Nikita Popov f8d795820e Reindent phpt files 2020-02-03 22:52:20 +01:00
Nikita Popov 16f194c75e Merge branch 'PHP-7.4'
* PHP-7.4:
  Fix bug #78323: Code 0 is returned on invalid options
2020-01-27 13:32:51 +01:00
Nikita Popov 1cccbb8ff1 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix bug #78323: Code 0 is returned on invalid options
2020-01-27 13:32:38 +01:00
Ivan Mikheykin fd08f062ae Fix bug #78323: Code 0 is returned on invalid options
Set CLI exit code to 1 when invalid parameters are passed,
and print error to stderr.
2020-01-27 13:32:19 +01:00
Fabien Villepinte a555cc0b3d Clean DONE tags from tests
Remove most of the `===DONE===` tags and its variations.
Keep `===DONE===` if the test output otherwise becomes empty.

Closes GH-4872.
2019-11-07 21:31:47 +01:00
Nikita Popov c5f1b384b5 Move shebang handling into the lexer
Instead of handling shebang lines by adjusting the file pointer in
individual SAPIs, move the handling into the lexer, where this is
both a lot simpler and more robust. Whether the shebang should be
skipped is controlled by CG(skip_shebang) -- we might want to do
that in more cases.

This fixed bugs #60677 and #78066.
2019-07-15 16:25:49 +02:00
Fabien Villepinte 26dfce7f36 Replace dirname(__FILE__) by __DIR__ in tests 2019-03-15 22:55:30 +01:00
Peter Kokot c245898bfa Update and fix remaining year ranges (2019)
This patch follows previous license year ranges updates. With new
approach source code files now have simplified headers with license
information without year ranges.
2019-02-08 23:14:29 +01:00
Christoph M. Becker 1acac320c5 Clean up server-tests.php remains
sapi/tests/ has been introduced as a generic means to test different
SAPIs[1].  run-tests2.php has later be renamed to server-tests.php and
recently been dropped[2].  However, the sapi/tests/test00?.php test
cases remained, even though they make no sense for run-tests.php,
since they use an unsupported format for the `--ENV--` section and the
completely unsupported `--HEADERS--` section, respectively.  While
these tests ran successfully under run-tests.php, that was only by
accident, and they did not really test something useful.  Therefore, we
remove these tests altogether.

sapi/tests/bug69487.phpt is actually a CGI test (CGI is enforced due to
the `--POST--` section), so we move it to sapi/cgi/tests, which leaves
sapi/tests/ empty.  Thus, we also remove the sapi/ directory from
run-tests.php.

Finally, we remove the `--HEADERS--` and `--REQUEST--` sections from
the list of allowed run-tests.php sections.

[1] <http://git.php.net/?p=php-src.git;a=commit;h=b671380b6b5b6e1f4f235e810afa4199e989d2ba>
[2] <http://git.php.net/?p=php-src.git;a=commit;h=4f36acb9e65935aa657f1f22e2320a401bdbdad3>
2018-11-23 16:24:51 +01:00
Peter Kokot 782352c54a Trim trailing whitespace in *.phpt 2018-10-14 19:45:12 +02:00
Gabriel Caruso 9c144e0d82 Trim trailing whitespace in tests 2018-10-14 12:07:20 -03:00
Christoph M. Becker c266a19094 Merge branch 'PHP-7.3'
* PHP-7.3:
  Fix #76954: apache_response_headers removes last character from header name
2018-10-08 12:33:32 +02:00
Christoph M. Becker 6178786233 Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Fix #76954: apache_response_headers removes last character from header name
2018-10-08 12:32:52 +02:00
Christoph M. Becker 879c937a27 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Fix #76954: apache_response_headers removes last character from header name
2018-10-08 12:30:45 +02:00
stodorovic 47b89bc531 Fix #76954: apache_response_headers removes last character from header name 2018-10-08 12:29:31 +02:00
Gabriel Caruso 2f7003847d Make more tests run on Linux 2018-08-28 21:20:00 -03:00
Gabriel Caruso ded3d984c6 Use EXPECT instead of EXPECTF when possible
EXPECTF logic in run-tests.php is considerable, so let's avoid it.
2018-02-20 21:53:48 +01:00
Gabriel Caruso 21e3b0c70c Remove trailing whitespace in inc files 2018-02-10 19:20:23 +01:00
Anatol Belski 0b30461764 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Follow up on bug #75574 for FCGI side
2017-11-28 20:34:44 +01:00
Anatol Belski 8b57a5bca0 Follow up on bug #75574 for FCGI side 2017-11-28 20:33:11 +01:00
Nikita Popov 5af586bec5 Remove more PHP 6 leftovers from tests 2016-11-24 22:39:39 +01:00
Andrea Faulds 3ed8b7a87b Use "Standard input code" instead of "php://stdin" 2016-11-12 17:26:20 +00:00
Andrea Faulds a103aa2dbd Show "php://stdin" instead of "-" in error messages 2016-11-12 17:26:20 +00:00
Anatol Belski 59541795e2 fork test 2015-09-30 11:13:29 +02:00
Anatol Belski e80306cbe8 fix tests on Windows 2015-09-30 11:13:28 +02:00
Anatol Belski 353d996c9f tweak cgi binary search 2015-09-30 11:13:27 +02:00
Aaron Piotrowski e97d5fab35 Update exception names in tests after formatting changes. 2015-05-17 17:31:43 -05:00
Nikita Popov 3ae995f03c Tweak uncaught exception message display
This implements a reduced variant of #1226 with just the following
change:

-Fatal error: Uncaught exception 'EngineException' with message 'Call to private method foo::bar() from context ''' in %s:%d
+Fatal error: Uncaught EngineException: Call to private method foo::bar() from context '' in %s:%d

The '' wrapper around messages is very weird if the exception
message itself contains ''. Futhermore having the message wrapped
in '' doesn't work for the "and defined" suffix of
TypeExceptions.
2015-05-17 18:47:06 +02:00
Nikita Popov c9f27ee422 Display EngineExceptions like ordinary exceptions
TypeException stays as-is for now because it uses messages that are
incompatible with the way exception messages are displayed.

closure_038.phpt and a few others now show that we're generating
too many exceptions for compound operations on undefined properties
-- this needs to be fixed in a followup.
2015-05-15 23:40:32 +02:00
Rasmus Lerdorf 40955e27f7 This test depends on expose_php being on 2014-07-14 08:21:27 -07:00
Yasuo Ohgaki cbd108abf1 Implement RFC https://wiki.php.net/rfc/default_encoding 2014-02-13 11:54:52 +09:00
Xinchen Hui ebefbdb76d Fix test failed 2012-08-18 12:21:48 +08:00
Xinchen Hui 8f89cfb548 Fix test (no charset outputed) 2012-07-18 19:50:30 +08:00
Rasmus Lerdorf 523fd2c244 Fix broken apache_request_headers test
This test depends on the default_charset setting, so set it to
UTF-8 for consistent output
2012-05-23 17:38:23 -07:00
Stanislav Malyshev 1919ec5a55 restore BC 2012-05-08 10:19:24 -07:00
Stanislav Malyshev 20364bcff9 fix bug #61807 - Buffer Overflow in apache_request_headers 2012-05-08 10:19:23 -07:00
Xinchen Hui efd671f242 Fixed bug Fixed bug #61605 (header_remove() does not remove all headers) 2012-04-04 16:14:28 +08:00