Commit Graph

1408 Commits

Author SHA1 Message Date
Máté Kocsis
d1764ca330
Make error messages more consistent by fixing capitalization
Closes GH-5066 As a first step, let's capitalize their initial letter when it is applicable.
2020-01-17 14:52:46 +01:00
Máté Kocsis
0b4778c377
Fix #78880: Another bunch of spelling errors 2020-01-16 09:46:47 +01:00
Nikita Popov
7ce531f2c2 Make constant() error handling consistent with plain const lookup
This means we get an Error exception and a much better error
message indicating the root cause (e.g. accessing a private class
constant).
2020-01-10 13:39:56 +01:00
Nikita Popov
ae5d7604f6 Fix #65274: Add class name to undef class constant error 2020-01-08 14:18:14 +01:00
George Peter Banyard
bfe3f934a3 Add warning and convert to exception in string offset assignment:
Convert the empty string assignment to an Error as per RFC [1]
Add a warning that only the first byte will be assigned to the offset if provided
a needle that is longer than one byte.

[1] https://wiki.php.net/rfc/engine_warnings
2020-01-07 21:54:42 +01:00
Christoph M. Becker
dabc28d182 Fix #78880: Spelling error report
We fix the most often occuring typos according to a recent codespell
report[1] in tests, code comments and documentation.

[1] <https://fossies.org/linux/test/php-src-master-f8f48ce.191129.tar.gz/codespell.html>.
2019-12-21 11:58:00 +01:00
Christoph M. Becker
4c5a178df8 Merge branch 'PHP-7.4'
* PHP-7.4:
  Fix #78929: plus signs in cookie values are converted to spaces
2019-12-12 14:22:32 +01:00
Kachalin Alexey
79376ab209 Fix #78929: plus signs in cookie values are converted to spaces
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.
2019-12-12 14:21:46 +01:00
Máté Kocsis
b2dc833c1a
Only accept string as the format parameter of *printf() functions 2019-12-09 19:43:34 +01:00
Nikita Popov
cec7bd58f8 Merge branch 'PHP-7.4'
* PHP-7.4:
  Fix timeout tests
2019-12-05 11:19:27 +01:00
Nikita Popov
e760d94f4b Fix timeout tests
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.
2019-12-05 11:19:23 +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
kharhamel
82dc9a31c3 Convert warnings to Errors in sprintf() functions
Closes GH-4837.
2019-10-28 11:58:59 +01:00
Fabien Villepinte
cdacad8e50 Merge branch 'PHP-7.4' 2019-10-20 10:57:31 +02:00
Fabien Villepinte
62b053a3be Improve the error message in timeout tests
Closes GH-4818.
2019-10-20 10:55:27 +02:00
Nikita Popov
93b39f68f5 Merge branch 'PHP-7.4' 2019-10-10 15:17:44 +02:00
Nikita Popov
5a076e670a Return error_zval form get_property_ptr_ptr on exception
This goes in the reverse direction of 4463acb951.
After looking around a bit, it seems that we already check for
Z_ISERROR_P() on the get_property_ptr_ptr return value in other places.
So do this in zend_fetch_property_address() as well, and also make
sure that EG(error_zval) is indeed returned on exception in
get_property_ptr_ptr.

In particular, this fixes the duplicate exceptions that we used to
get because first get_property_ptr_ptr threw one and then
read_property throws the same exception again.
2019-10-10 15:14:04 +02:00
Nikita Popov
2118f6a898 Merge branch 'PHP-7.4' 2019-10-10 14:44:53 +02:00
Nikita Popov
4463acb951 Explicitly check for exceptions in by-ref obj prop assign
Relying on setting ERROR if an exception happened during the
property address fetch is both a bit fragile and may pessimize
other codepaths that will check for exceptions in the VM. Adding
an extra exception check instead, which should also allow us to
drop the use of ERROR in this area in master.
2019-10-10 14:41:35 +02:00
Nikita Popov
d44cf9b539 Replace "unexpected character" warning with ParseError
Closes GH-4767.
2019-10-04 11:28:58 +02:00
Nikita Popov
2f92957fd3 Convert some notices to warnings
Part of https://wiki.php.net/rfc/engine_warnings.
2019-10-02 10:34:08 +02:00
Nikita Popov
235983dfde Merge branch 'PHP-7.4' 2019-09-30 17:52:39 +02:00
Fabien Villepinte
0aa3acc6c4 Fix borked SKIPIFs 2019-09-30 17:51:41 +02:00
Nikita Popov
e8b0163e0b Promote write "use scalar as array" warning to Error 2019-09-27 15:49:18 +02:00
Nikita Popov
0ebf2bdba0 Convert "Illegal offset type" warnings to exceptions 2019-09-27 13:00:07 +02:00
Nikita Popov
a66c60cce3 Throw Error when writing property of non-object
This removes object auto-vivification support.

This also means that we can remove the corresponding special
handling for typed properites: We no longer need to check that a
property is convertible to stdClass if such a conversion might
take place indirectly due to a nested property write.

Additionally OBJ_W style operations now no longer modify the
object operand, and as such we no longer need to treat op1 as a
def in SSA form.

The next step would be to actually compile the whole LHS of OBJ_W
operations in R rather than W mode, but that causes issues with
SimpleXML, whose object handlers depend on the current compilation
structure.

Part of https://wiki.php.net/rfc/engine_warnings.
2019-09-27 10:11:47 +02:00
Nikita Popov
5dcbc65a53 Canonicalize typed prop/param default value errors
Use shared logic to determine what values are valid, and a single
error message format.
2019-09-23 16:20:26 +02:00
Nikita Popov
f61f122b9a Merge branch 'PHP-7.4' 2019-09-12 16:41:45 +02: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
d37d418927 Merge branch 'PHP-7.4' 2019-07-23 11:28:10 +02:00
George Peter Banyard
6d6d954d0d Cleanup of remaining E_STRICT in tests 2019-07-23 11:27:23 +02:00
Nikita Popov
eb766751dc Merge branch 'PHP-7.4' 2019-07-19 10:06:30 +02:00
rjhdby
d574df63dc Deprecate alternative array access syntax
RFC: https://wiki.php.net/rfc/deprecate_curly_braces_array_access
2019-07-19 10:06:10 +02:00
Nikita Popov
0146bab449 Merge branch 'PHP-7.4' 2019-07-12 12:55:21 +02:00
Nikita Popov
2e56e14e39 Swap implode() argument order in some tests 2019-07-12 12:54:10 +02:00
Nikita Popov
74bf7bfb88 Merge branch 'PHP-7.4' 2019-07-11 15:49:02 +02:00
Nikita Popov
17f7fb7605 Switch to using shell-less proc_open() in various server tests 2019-07-11 15:48:10 +02:00
Nikita Popov
106f71cc94 Merge branch 'PHP-7.4' 2019-07-10 12:05:24 +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
f01c7e959f Merge branch 'PHP-7.4' 2019-07-08 13:36:26 +02:00
Nikita Popov
392398bfe6 Make busy wait busier
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.
2019-07-08 13:35:29 +02:00
Nikita Popov
32c68428a9 Backport test fix
Closes GH-3816.
2019-07-02 16:11:54 +02:00
Nikita Popov
e4fae9c061 Merge branch 'PHP-7.4' 2019-06-11 13:16:38 +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
7686b0b889 Merge branch 'PHP-7.4' 2019-06-05 14:53:50 +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
Christoph M. Becker
2e91a90f0b Merge branch 'PHP-7.4'
* PHP-7.4:
  Make more tests run on Windows
2019-05-27 10:52:25 +02:00
Gabriel Caruso
4bb6f9ba99 Make more tests run on Windows 2019-05-27 10:51:53 +02:00
Nikita Popov
fd2db11929 Always generate fatal error for LSP failures
RFC: https://wiki.php.net/rfc/lsp_errors
2019-05-07 13:45:28 +02:00
Nikita Popov
f9e918b17d Merge branch 'PHP-7.4' 2019-04-17 14:25:34 +02:00
Nikita Popov
487d4d07b4 Remove some uses of deprecated internal_encoding settings in tests 2019-04-17 14:24:11 +02:00
Nikita Popov
6d71d983da Merge branch 'PHP-7.4' 2019-03-27 13:05:04 +01:00
Nikita Popov
d1e5006c14 Fix lineno for more inheritance errors
And also include explicit linenos in tests.
2019-03-27 13:02:28 +01:00
Peter Kokot
6426420f61 Merge branch 'PHP-7.4'
* PHP-7.4:
  Replace dirname(__FILE__) by __DIR__ in tests
2019-03-15 23:36:47 +01:00
Fabien Villepinte
26dfce7f36 Replace dirname(__FILE__) by __DIR__ in tests 2019-03-15 22:55:30 +01:00
Nikita Popov
852485d8ec Adjust tests for zpp TypeError change 2019-03-11 11:32:20 +01:00
Gabriel Caruso
726919e4b5 Merge branch 'PHP-7.4'
* PHP-7.4:
  Use EXPECT when possible
  Fix tests filenames
2019-03-11 00:07:32 -03:00
Gabriel Caruso
6c4e2079c0 Use EXPECT when possible
EXPECTF logic in run-tests.php is considerable, so let's avoid it.
2019-03-11 00:05:44 -03:00
Nikita Popov
b4cbf6faca Fix tests bareword fallback with error suppression
Re-merge commit a369326003 into PHP-7.4
(cherry picked from commit aad39879f2)
(cherry picked from commit 76f8a908bb)
2019-02-25 17:43:07 +01:00
Nikita Popov
c8e2b333cb Merge branch 'PHP-7.4' 2019-02-20 11:22:31 +01:00
Nikita Popov
c0e15a3b7f Implement fine-grained conflict handling
Tests can specify conflict keys, either in --CONFLICTS-- or
a per-directory CONFLICTS file. Non-conflicting tests may be run
in parallel.
2019-02-20 11:20:40 +01:00
Nikita Popov
8f473ccf50 Merge branch 'PHP-7.4' 2019-02-19 17:12:33 +01:00
Nikita Popov
002c096871 Remove some zpp failure tests
These tests exclusively check zpp failure conditions, so drop them.
2019-02-19 17:12:08 +01:00
Nikita Popov
29aa080f0d Merge branch 'PHP-7.4' 2019-02-18 15:31:15 +01:00
Andrea Faulds
39792f5bb7 run-tests.php: experimental parallel testing support 2019-02-18 14:58:53 +01:00
Nikita Popov
924142fef0 Merge branch 'PHP-7.4' 2019-02-14 12:51:39 +01:00
David Walker
e63febb1c7 Fixed bug #75921
Ensure that the "creating default object from empty value" warning is
always thrown. Previously some cases were missing the warning, in
particular those going through FETCH_OBJ_W rather than a dedicated
opcode (like ASSIGN_OBJ).

One slightly unfortunate side-effect of this change is that something
like $a->b->c = 'd' will now generate two warnings rather than one
when $a is null (one for property b, one for property c).
2019-02-14 12:50:25 +01:00
Nikita Popov
47bf4cd147 Merge branch 'PHP-7.4' 2019-02-12 18:02:34 +01:00
Nikita Popov
e1cc714445 Fix test
Missing this change in 9364153942.
2019-02-12 18:02:16 +01:00
Johannes Schlüter
d373d13d4a Merge branch 'PHP-7.4' 2019-02-12 15:02:18 +01:00
Nikita Popov
aaebf3b653 Merge branch 'PHP-7.3' into PHP-7.4 2019-02-12 11:43:53 +01:00
Nikita Popov
5297bed454 Merge branch 'PHP-7.2' into PHP-7.3 2019-02-12 11:43:34 +01:00
DanielCiochiu
07877c46e3 Fixed bug #75546
By respecting the SILENT flag when checking the visibility of a
class constant.
2019-02-12 11:42:33 +01:00
Guilliam Xavier
b3935ed2af Fix tests bareword fallback with error suppression
(cherry picked from commit aad39879f2)
(cherry picked from commit 76f8a908bb)
2019-02-11 09:36:03 +01:00
Nikita Popov
2f1f34952e Remove $errcontext argument to error handlers
I'm removing the argument entirely here, but we might want to change
this to passing null or and empty array instead, if the impact of
dropping it entirely turns out to be too large.

This was deprecated as part of https://wiki.php.net/rfc/deprecations_php_7_2
as a doc-only deprecation.
2019-02-05 14:12:10 +01:00
Nikita Popov
d750f0a192 Merge branch 'PHP-7.4' 2019-02-05 09:41:08 +01:00
Nikita Popov
8bc663f43b Remove zpp variation tests 2019-02-05 09:38:55 +01:00
Nikita Popov
aad39879f2 Remove bareword fallback for constants
Access to undefined constants will now always result in an Error
exception being thrown.

This required quite a few test changes, because there were many
buggy tests that unintentionally used bareword fallback in combination
with error suppression.
2019-01-31 13:52:06 +01:00
Nikita Popov
9c5ab992ac Merge branch 'PHP-7.4' 2019-01-31 09:40:01 +01:00
Nikita Popov
340c6d3927 Revert "Don't silence fatal errors with @"
This reverts commit abd36289e2.

This wasn't ready for merging yet, there are still some test
failures.
2019-01-31 09:39:10 +01:00
Joe Watkins
839bdf12ee
Merge branch 'PHP-7.4'
* PHP-7.4:
  Don't silence fatal errors with @
2019-01-31 07:11:18 +01:00
Nikita Popov
abd36289e2
Don't silence fatal errors with @ 2019-01-31 07:11:05 +01:00
Gabriel Caruso
4e0dd6b0ed Remove unnecessary CLI checks in tests 2019-01-31 00:21:32 -02:00
Nikita Popov
db8a4e87a7 Remove error_reporting assignments in some tests 2019-01-30 16:00:19 +01:00
Nikita Popov
6c73b50cf6 Remove static calls to non-static methods 2019-01-30 09:19:02 +01:00
Nikita Popov
682b54f687 Remove support for legacy constructors
This has been deprecated in PHP 7.0 by
https://wiki.php.net/rfc/remove_php4_constructors.
2019-01-29 13:04:20 +01:00
Nikita Popov
c97b9aa226 Always treat needles as strings
This is part of https://wiki.php.net/rfc/deprecations_php_7_3.
2019-01-29 11:10:47 +01:00
Nikita Popov
6db97f5e3e Remove each()
This has been deprecated in PHP 7.2 as part of
https://wiki.php.net/rfc/deprecations_php_7_2.
2019-01-29 09:42:59 +01:00
Nikita Popov
9bc2cacf7f Remove special treatment of strings in asserts
This was deprecated in PHP 7.2 as part of
https://wiki.php.net/rfc/deprecations_php_7_2.
2019-01-29 09:42:59 +01:00
Nikita Popov
920b4b249f Remove track_errors and $php_errormsg
This has been deprecated in PHP 7.2 as part of
https://wiki.php.net/rfc/deprecations_php_7_2.
2019-01-28 15:58:23 +01:00
Nikita Popov
ee16d99504 Remove create_function()
Deprecated in PHP 7.2 as part of
https://wiki.php.net/rfc/deprecations_php_7_2.
2019-01-28 15:58:23 +01:00
Nikita Popov
345936aeb1 Merge branch 'PHP-7.3' 2019-01-18 12:49:08 +01:00
Nikita Popov
14b5302591 Merge branch 'PHP-7.2' into PHP-7.3 2019-01-18 12:48:52 +01:00
Lauri Kenttä
dbe7f2a41a Fix seeking in php://input 2019-01-18 12:44:47 +01:00
Nikita Popov
e219ec144e Implement typed properties
RFC: https://wiki.php.net/rfc/typed_properties_v2

This is a squash of PR #3734, which is a squash of PR #3313.

Co-authored-by: Bob Weinand <bobwei9@hotmail.com>
Co-authored-by: Joe Watkins <krakjoe@php.net>
Co-authored-by: Dmitry Stogov <dmitry@zend.com>
2019-01-11 15:49:06 +01:00
Nikita Popov
2fac9d9ec1 Remove some mentions of RECOVERABLE_ERROR in tests
Mostly drop error handlers that are no longer necessary.
2018-11-15 22:13:46 +01:00
Rasmus Lerdorf
fcb2e1da09 Merge branch 'PHP-7.3'
* PHP-7.3:
  This test needs to log to stdout
2018-10-31 10:44:01 -07:00
Rasmus Lerdorf
1954c7e1c6 This test needs to log to stdout 2018-10-31 10:43:45 -07:00
Peter Kokot
d61c7ae5ed Merge branch 'PHP-7.3'
* PHP-7.3:
  Fix tests/output/bug74815.phpt generating errors.log
2018-10-18 23:40:00 +02:00
Peter Kokot
93427292f6 Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Fix tests/output/bug74815.phpt generating errors.log
2018-10-18 23:39:39 +02:00
Peter Kokot
de9f325c12 Fix tests/output/bug74815.phpt generating errors.log
Test tests/output/bug74815.phpt was creating an errors.log file
in project root directory and didn't removed it after the test.
2018-10-18 23:39:00 +02:00
Peter Kokot
d679f02295 Sync leading and final newlines in *.phpt sections
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
2018-10-15 04:33:09 +02:00
Peter Kokot
b746e69887 Sync leading and final newlines in *.phpt sections
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
2018-10-15 04:32:30 +02:00
Peter Kokot
f1d7e3ca0b Sync leading and final newlines in *.phpt sections
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
2018-10-15 04:31:31 +02:00
Peter Kokot
d7a3edd45d Trim trailing whitespace in *.phpt 2018-10-14 19:46:15 +02:00
Peter Kokot
782352c54a Trim trailing whitespace in *.phpt 2018-10-14 19:45:12 +02:00
Peter Kokot
17ccbeec32 Trim trailing whitespace in *.phpt 2018-10-14 19:44:14 +02:00
Gabriel Caruso
9c144e0d82
Trim trailing whitespace in tests 2018-10-14 12:07:20 -03:00
Peter Kokot
1ad08256f3 Sync leading and final newlines in source code files
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
2018-10-14 12:56:38 +02:00
Peter Kokot
1c850bfcca Sync leading and final newlines in source code files
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
2018-10-14 12:55:24 +02:00
Peter Kokot
60a69daec6 Sync leading and final newlines in source code files
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
2018-10-14 12:54:08 +02:00
Peter Kokot
c25b1a7e8c Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Fix failing tests/lang due to whitespace
2018-10-13 15:23:35 +02:00
Peter Kokot
ed64e1d59a Fix failing tests/lang due to whitespace 2018-10-13 15:22:49 +02:00
Peter Kokot
902d39a3a7 Trim trailing whitespace in source code files 2018-10-13 14:14:50 +02:00
Peter Kokot
7f6387b59a Trim trailing whitespace in source code files 2018-10-13 14:12:55 +02:00
Peter Kokot
3f72c77ce4 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.
2018-10-13 11:21:27 +02:00
Nikita Popov
a5fa51afbb Don't overload get_properties for ArrayObject
Instead overload get_properties_for for a few specific cases such
as array casts. This resolves the issue where ArrayObject
get_properties may violate engine invariants in some cases.
2018-10-10 10:39:10 +02:00
Nikita Popov
2ae2e820be Merge branch 'PHP-7.3' 2018-09-29 14:23:13 +02:00
Nikita Popov
8b8b625d08 Fixed bug #72635
This seems to be a simple oversight, where we did not enable
exceptions. Other constexpr conditions already throw, so there is
no particular reason to stick to a fatal error here.
2018-09-29 14:21:08 +02:00
Nikita Popov
e188d2fe0e Remove duplicate test file
This is already tested in Zend/tests/bug63463.phpt.
2018-09-22 17:46:54 +02:00
Peter Kokot
5da3ed69a6 Rename *.p5c files to *.inc
When including files in PHP tests a good practice so far has been to use
the *.inc extension. This patch renames few *.p5c files that are
included in phpt files.
2018-09-21 23:21:14 +02:00
Peter Kokot
bfa2c7158f Fix permissions
Certain files don't need to be executables.
2018-09-21 14:12:25 +02:00
Gabriel Caruso
f72b6c5e19
Use EXPECT instead of EXPECTF when possible 2018-09-16 15:39:18 -03:00
Gabriel Caruso
2f7003847d
Make more tests run on Linux 2018-08-28 21:20:00 -03:00
Gabriel Caruso
84b195d9fc Fix some misspellings 2018-08-12 16:15:45 +02:00
Gabriel Caruso
9c8b3ae43f
Make more tests run on 64bit plataforms 2018-07-30 09:43:09 -03:00
Peter Kokot
8d3f8ca12a Remove unused Git attributes ident
The $Id$ keywords were used in Subversion where they can be substituted
with filename, last revision number change, last changed date, and last
user who changed it.

In Git this functionality is different and can be done with Git attribute
ident. These need to be defined manually for each file in the
.gitattributes file and are afterwards replaced with 40-character
hexadecimal blob object name which is based only on the particular file
contents.

This patch simplifies handling of $Id$ keywords by removing them since
they are not used anymore.
2018-07-25 00:53:25 +02:00
Nikita Popov
2543e61aed Fixed bug #76509
In PHP static properties are shared between inheriting classes,
unless they are explicitly overwritten. However, because this
functionality was implemented using reference, it was possible
to break the implementation by reassigning the static property
reference.

This is fixed by switching the implementation from using references
to using INDIRECTs, which cannot be affected by userland code.
2018-06-25 15:04:09 +02:00
Dmitry Stogov
d7f2dc4ec6 Improve HashTable iterators handling:
- Avoid iterators check/update on each HashTable update opration
- Keep position equal (or above) nNumUsed instead of HT_INVALID_IDX
- Fixed iterators handling in array_unshift()
2018-03-22 02:41:49 +03:00
Gabriel Caruso
e1cc4863d9 Remove duplicated tests 2018-02-22 13:03:21 +01:00
Gabriel Caruso
b895690dfa
remove support for string|unicode in tests 2018-02-22 08:11:30 +01: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
b8bb4d77ca
Remove empty sections in tests 2018-02-14 11:10:59 +01:00
Gabriel Caruso
21e3b0c70c Remove trailing whitespace in inc files 2018-02-10 19:20:23 +01:00
Gabriel Caruso
ce1d69a1f6 Use int instead of integer in type errors
PHP requires integer typehints to be written "int" and does not
allow "integer" as an alias. This changes type error messages to
match the actual type name and avoids confusing messages like
"must be of the type integer, integer given".
2018-02-04 19:08:23 +01:00
Nikita Popov
1a3bdb4a2c Remove some references to E_STRICT in tests
run-tests.php enforces error_reporting=E_ALL (including E_STRICT),
setting this explicitly in not necessary. Conversely, after the
removal of some E_STRICT errors, explicitly excluding it is no
longer necessary in some places.
2018-02-03 18:17:12 +01:00
Gabriel Caruso
36d8bf5294 Remove superfluous SKIPIF sections in tests 2018-02-03 17:50:51 +01:00
timurib
a484b9a535 Fix #75765 Exception on extend of undefined class
As the parent class is fetched prior to binding, there are no
safety concerns in this case and we can replace the fatal error
with an Error exception.
2018-01-12 18:41:39 +01:00
Dmitry Stogov
f18638ca2d Fixed incorrect recursion detection 2017-10-06 11:47:11 +03:00
Andrea Faulds
7418f6814f Merge branch 'PHP-7.1' into PHP-7.2 2017-09-21 00:04:56 +01:00
Andrea Faulds
b71023e297 Merge branch 'PHP-7.0' into PHP-7.1 2017-09-21 00:04:08 +01:00
Andrea Faulds
418f97443a Fix bug #75236 2017-09-21 00:02:52 +01:00
Anatol Belski
97ed208cfd Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Fix issues with phpt and EXTENSION on windows (BUG 75042)
2017-08-19 02:01:03 +02:00
John Boehr
71b12940d0 Fix issues with phpt and EXTENSION on windows (BUG 75042)
* Commands are not properly escaped for windows
* Specifying "-n" to check loaded modules causes "Module already loaded"
warning
* Extensions to be loaded need the "php_" prefix on Windows

Bug: https://bugs.php.net/bug.php?id=75042

Add back -n flag to fetch loaded extensions in run-tests.php

Add test for phpt EXTENSIONS directive

Add a second test for bug 75042

Add test to test loading of nonexistent shared module

with the EXTENSIONS phpt block

Pass ini settings when checking loaded extensions

Fix skipifs
2017-08-19 01:59:48 +02:00
Anatol Belski
f1c664d379 Fix skipifs 2017-08-18 17:38:16 +02:00
John Boehr
59558ffd96 Fix issues with phpt and EXTENSION on windows (BUG 75042)
* Commands are not properly escaped for windows
* Specifying "-n" to check loaded modules causes "Module already loaded"
warning
* Extensions to be loaded need the "php_" prefix on Windows

Bug: https://bugs.php.net/bug.php?id=75042

Add back -n flag to fetch loaded extensions in run-tests.php

Add test for phpt EXTENSIONS directive

Add a second test for bug 75042

Add test to test loading of nonexistent shared module

with the EXTENSIONS phpt block

Pass ini settings when checking loaded extensions
2017-08-18 17:34:48 +02:00
Andrea Faulds
f877b86604 Merge branch 'PHP-7.1' into PHP-7.2 2017-08-12 01:38:46 +01:00
Andrea Faulds
e88ab74886 Merge branch 'PHP-7.0' into PHP-7.1 2017-08-12 01:37:47 +01:00
Andrea Faulds
b59718bdc4 Fix bug #74725 (html_errors=1 breaks unhandled exceptions) 2017-08-12 01:37:20 +01:00
Xinchen Hui
9b87b73fec Req #74963 (Improved error message on fetching property of non-object) 2017-07-31 11:51:23 +08:00
Sara Golemon
e23c132940 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Fix compile-time optimization of NAN comparisons
2017-07-22 21:23:29 -04:00
Sara Golemon
1229b0f8cb Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Fix compile-time optimization of NAN comparisons
2017-07-22 21:23:17 -04:00
Sara Golemon
c562d44321
Fix compile-time optimization of NAN comparisons 2017-07-22 21:22:51 -04:00
Anatol Belski
e08c0ed8ce Bug #74815 crash with a combination of INI entries at startup
TS related VCWD routines depend on CWD. Thus, a premature CWD
deactivation renders the VCWD layer unusable. Same issue seems to
persist in versions < 7.2, just that the code path is actually unused so
the issue didn't show up. Still might make sense to backport this into
lower branches.
2017-06-27 16:30:10 +02:00
Tom Van Looy
04fb3f28ff Remove superfluous semicolons 2017-06-26 00:23:25 +02:00
Michał Brzuchalski
8e10c9d373 Implement object type annotation
RFC: https://wiki.php.net/rfc/object-typehint
2017-06-25 21:49:41 +02:00
Rowan Collins
1b565f1393 Change 'undefined constant' from E_NOTICE to E_WARNING and mention deprecation
Implements RFC "Deprecate and Remove Bareword (Unquoted) Strings"
[https://wiki.php.net/rfc/deprecate-bareword-strings]
2017-03-23 18:52:43 +01:00
Kalle Sommer Nielsen
f9959ee7c2 Change PHP_OS_FAMILY slightly
* PHP_OS_FAMILY is now a macro, to allow extensions to take advantage of it, it is defined in php.h
* Values are not upper-case-first, not always uppercase. Windows is no longer just "Win", if we want the short version for testing then PHP_OS is always WINNT anyway
2017-02-22 12:31:06 +01:00
Niklas Keller
2edc3cf8d2 Implement Parameter Type Widening RFC 2017-02-04 23:33:24 +01:00
Nikita Popov
06a0340162 Deprecate each() 2017-02-03 21:02:52 +01:00
Nikita Popov
6ba7206620 Deprecate assert() with string argument 2017-02-03 21:02:52 +01:00
Nikita Popov
c61daf415d Deprecate track_errors / $php_errormsg 2017-02-03 21:02:52 +01:00
Nikita Popov
162aa1a5fc Deprecate __autoload() 2017-02-03 18:52:57 +01:00
Nikita Popov
eaeecc523b Deprecate create_function() 2017-02-03 18:52:57 +01:00
Joe Watkins
6400ce5017
Merge branch 'PHP-7.1'
* PHP-7.1:
  increase wait time in timeout_variation_9.phpt by 1 second
2017-02-03 06:01:10 +00:00
Joe Watkins
e9209e15a2
Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  increase wait time in timeout_variation_9.phpt by 1 second
2017-02-03 06:00:53 +00:00
Rodrigo Prado
0b56ba51d0
increase wait time in timeout_variation_9.phpt by 1 second 2017-02-03 05:57:26 +00:00
Joe Watkins
309d3daa39
Merge branch 'PHP-7.1'
* PHP-7.1:
  increase wait time in timeout_variation_10.phpt by 1 second
2017-02-03 05:55:29 +00:00
Joe Watkins
a52afd27ab
Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  increase wait time in timeout_variation_10.phpt by 1 second
2017-02-03 05:55:16 +00:00
Rodrigo Prado
8faf5f979c
increase wait time in timeout_variation_10.phpt by 1 second 2017-02-03 05:53:28 +00:00
Nikita Popov
a8d901a80c Remove zend_version() checks from tests 2017-01-30 22:50:25 +01:00
Stricted
bb059fe0a7
add PHP_OS_FAMILY constant to determine on which os we are 2017-01-25 20:50:14 +00:00
Joe Watkins
8782e847b4
Merge branch 'PHP-7.1'
* PHP-7.1:
  Fixed #73969 - Fixed segmentation fault when debug_print_backtrace called
2017-01-22 16:12:27 +00:00
Joe Watkins
8bda542064
Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Fixed #73969 - Fixed segmentation fault when debug_print_backtrace called
2017-01-22 16:11:57 +00:00
andrewnester
6f912f7c04
Fixed #73969 - Fixed segmentation fault when debug_print_backtrace called 2017-01-22 16:11:25 +00:00
Joe Watkins
d83828540e
Merge branch 'PHP-7.1'
* PHP-7.1:
  get_defined_functions additional parameter to exclude disabled functions
  news entry for PR #1312
2017-01-04 13:37:06 +00:00
Joe Watkins
6c9164047e
Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  get_defined_functions additional parameter to exclude disabled functions
  news entry for PR #1312
2017-01-04 13:36:04 +00:00
Joe Watkins
63d116e571
Merge branch 'pull-request/1312' into PHP-7.0
* pull-request/1312:
  get_defined_functions extra parameter to exclude disabled functions
  news entry for PR #1312
2017-01-04 13:34:31 +00:00
Christoph M. Becker
ced66cd6ca Merge branch 'PHP-7.1' 2016-12-07 13:50:11 +01:00
Christoph M. Becker
00ee42e385 Merge branch 'PHP-7.0' into PHP-7.1 2016-12-07 13:45:18 +01:00
Markus Staab
dd77116fb0 Fixed typo in skipif error message 2016-12-07 13:35:58 +01:00
Nikita Popov
5af586bec5 Remove more PHP 6 leftovers from tests 2016-11-24 22:39:39 +01:00
Dmitry Stogov
68ee168c75 Merge branch 'PHP-7.1'
* PHP-7.1:
  Fixed memory leak (Bob)
2016-11-22 11:23:17 +03:00
Dmitry Stogov
db5bbe94be Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Fixed memory leak (Bob)
2016-11-22 11:22:55 +03:00
Dmitry Stogov
63ea4d194b Fixed memory leak (Bob) 2016-11-22 11:22:10 +03:00
Nikita Popov
45f7b2bcc8 Fix CRLF line-endings in tests
Also fix a single instance of CRLF in ibase_query.c.
2016-11-20 22:31:24 +01:00
Anatol Belski
c482ee6020 Introduce SKIP_IO_CAPTURE_TESTS group
to workaround false positives with some CI systems
2016-11-06 00:04:53 +01:00
Michele Locati
33301d5bae Add VT100 support for Windows
Fix function names prefix

Use Unicode version of GetFinalPathNameByHandle

Use EG(windows_version_info) instead of RtlGetVersion

Use the specified handle_id instead of STD_OUTPUT_HANDLE

Switch from stream name to stream resource

Allow running tests capturing only stdout and/or stderr

Add tests for stream_vt100_support function

Export Win32 console functions

Fix x64 build

Use zend_long instead of long long, use GetConsole instead of GetFinalPathNameByHandleW to check if a handle is a valid console stream

Always use zend_long on any platform

Use _get_osfhandle to determine the standard handle

Accept stream names

Raise warnings in case of invalid stream parameter

Return true if disabling VT100 support on a not-console/redirected stream or on old Windows versions

Remove php_win32_console_os_supports_vt100

Differentiate stdin vs stdout/stderr

Simplify setting flag

Allow avoid piping STDIN

Let stream_vt100_support accept only resources

Fix run-tests

Revert console flags in case of failure

Simplify logic of stream_vt100_support when setting the flag

Return true if succeeded, false otherwise

Drop support for STDIN

More comprehensive tests for stream_vt100_support

Remove old tests

Fix name of included file and use absolute paths

Enable ENABLE_VIRTUAL_TERMINAL_PROCESSING on Windows by default

Remove tests for stream_vt100_support

Split stream_vt100_support into stream_isatty+sapi_windows_vt100_support

Add tests for stream_isatty

Add tests for sapi_windows_vt100_support

Return null from stream_isatty is neither Windows nor Posix

Fallback to S_ISCHR if neither Windows nor Posix

Avoid defining argc since it's only used once

Better comment about php_win32_console_fileno_is_console

Use events instead of cNumberOfEvents

Do not restore previous console mode

We need to restore previous console mode on failing SetConsole calls only for STDIN

Don't configure STDOUT/STDERR on Windows with PHP_CLI_WIN32_NO_CONSOLE
2016-10-28 19:23:00 +02:00
Anatol Belski
671f647739 Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Fixed bug #73329 (Float)"Nano" == NAN
2016-10-18 19:14:14 +02:00
Anatol Belski
9f2ab75b10 Fixed bug #73329 (Float)"Nano" == NAN
The special cases (float)"inf", etc. were never intended and are
caused by the updated strtod lib. While it might be nice as an
easy way to produce Inf and NaN special values, it was never
documented and cause BC breaches.
2016-10-18 19:11:18 +02:00
Anatol Belski
4e3746380a Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Fixed bug #73172 parse error: Invalid numeric literal
2016-09-26 18:49:40 +02:00
Anatol Belski
39e5991705 Fixed bug #73172 parse error: Invalid numeric literal 2016-09-26 18:47:30 +02:00
Davey Shafik
12ee17d5e0 Implement \ArgumentCountError exception 2016-08-30 19:35:56 -07:00
Xinchen Hui
26d74a0420 Fixed tests 2016-08-23 11:32:21 +08:00
Nikita Popov
37b0dcc8e0 Decouple DEBUG_FILE_UPLOAD from ZEND_DEBUG
Enabling ZEND_DEBUG should not result in intrusive program
behavior changes.
2016-08-19 00:34:13 +02:00
Andrea Faulds
1dab96c1db Show "or null" in TypeErrors for nullable arg_infos 2016-08-11 18:44:43 +02:00
Nikita Popov
32eaf7cdc1 Merge branch 'PHP-7.0' 2016-07-14 23:22:41 +02:00
Nikita Popov
0b0e7520a9 Fix test output
The error is now detected earlier, so the message ends up being
different.
2016-07-14 23:22:09 +02:00
Jakub Zelenka
71774c241e Add decimal point in double serialization 2016-06-26 13:26:43 +01:00
Yasuo Ohgaki
b509b24e35 Add better value to test 2016-06-26 13:26:43 +01:00