1
0
mirror of https://github.com/php/php-src.git synced 2026-04-21 15:08:16 +02:00
Commit Graph

94 Commits

Author SHA1 Message Date
Máté Kocsis 7aacc705d0 Add many missing closing PHP tags to tests
Closes GH-5958
2020-08-09 22:03:36 +02:00
Rowan Tommins 55a15f32ce Improve output of tokens in Parse Errors
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 \\
2020-07-13 11:07:40 +02:00
Máté Kocsis d30cd7d7e7 Review the usage of apostrophes in error messages
Closes GH-5590
2020-07-10 21:05:28 +02:00
Nikita Popov cf7c68283d Fix treatment of "self" when validating against trait method
If we're validating a class method against a trait method, we need
to treat "self" in the trait method as the class where the method
is used. To achieve this, we need to thread the proto scope through
all methods, so it can be provided separately from proto.common->scope.
2020-04-23 11:41:34 +02:00
Nikita Popov f74e30c07c Check abstract method signatures coming from traits
RFC: https://wiki.php.net/rfc/abstract_trait_method_validation

Closes GH-5068.
2020-03-26 10:07:22 +01:00
Nikita Popov d9219f997d Enable better trait conflict error message
I don't think there is any reason to disable this anymore,
at least all the messages generated in tests look correct and
more useful.
2020-03-10 16:19:11 +01:00
Nikita Popov fff5771ccc Require non-absolute trait method refs to be unambiguous
Currently, when writing something like

class X {
    use T1, T2 {
       func as otherFunc;
    }
    function func() {}
}

where both T1::func() and T2::func() exist, we will simply assume
that func refers to T1::func(). This is surprising, and it doesn't
really make sense that this particular method gets picked.

This commit validates that non-absolute method references are
unambiguous, i.e. refer to exactly one method. If there is
ambiguity, it is required to write T1::func as otherFunc or
similar.

Closes GH-5232.
2020-03-10 16:01:13 +01:00
Nikita Popov 2c5fcd57c0 Resolve trait alias refers to earlier
Make sure all trait method references are converted to absolute
method references in advance. This regresses one error message
that I don't think is particularly valuable.
2020-03-03 14:23:31 +01:00
Nikita Popov 3b08f53c97 Deprecate required param after optional
As an exception, we allow "Type $foo = null" to occur before a
required parameter, because this pattern was used as a replacement
for nullable types in PHP versions older than 7.1.

Closes GH-5067.
2020-02-18 14:35:58 +01:00
Nikita Popov f8d795820e Reindent phpt files 2020-02-03 22:52:20 +01:00
Máté Kocsis 0b4778c377 Fix #78880: Another bunch of spelling errors 2020-01-16 09:46:47 +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 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 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
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 d7a3edd45d Trim trailing whitespace in *.phpt 2018-10-14 19:46:15 +02:00
Gabriel Caruso 9c144e0d82 Trim trailing whitespace in tests 2018-10-14 12:07:20 -03:00
Chris Wright 9ace33b9c5 Fix #76773 - Methods with a concrete scope need to be added again 2018-08-22 14:08:15 +02:00
Pedro Magalhães 887235773d Fix #76700 - Methods with altered visibility need to be added again 2018-08-07 14:22:37 +08:00
Gabriel Caruso 4a1336de7c Give a reason why the test was skipped 2018-07-30 09:03:21 -03:00
Kalle Sommer Nielsen 6337af09dc Added test case for bug #76539 for master only as the behavior has been restored 2018-07-04 19:50:34 +02: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 2d48d734a2 Fix some misspellings 2018-02-06 16:59:00 +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
Nikita Popov 3fde27d87d Merge branch 'PHP-7.2' 2017-12-16 17:10:09 +01:00
Pedro Magalhães 83964e0468 Fix #75607 - Check if existing static trait property is a ref before comparing 2017-12-16 17:07:12 +01:00
Pedro Magalhães 179ed6e43d 63911: Compare opcodes of the op_array to determine different functions 2017-11-22 05:35:24 +00:00
Pedro Magalhães 897bdb42f0 Fix #74922 - Try to resolve constants when importing trait properties 2017-11-02 21:06:27 +01:00
Pedro Magalhães c6c1e75e6b Fix bug #74607: Don't check for bi-directional compatibility in traits 2017-06-03 00:24:43 +02:00
Nikita Popov 16ae9f82e8 Fix SKIPIF conditions 2017-03-14 12:06:58 +01: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
Nikita Popov 7cd2494bb8 Merge branch 'PHP-7.0' into PHP-7.1 2016-09-22 12:34:55 +02:00
John Boehr 8e313becf4 Fix bug #69579 2016-09-22 12:32:37 +02:00
Nikita Popov 3ad0e1d6ca Fix static method arg binding in traits 2016-04-08 01:48:21 +02:00
Joe Watkins 4327370d13 fix #71414 (Interface method override inherited method and implemented in a trait causes fatal error) 2016-03-26 23:47:31 +00: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
Nikita Popov 8d00385871 Reclassify E_STRICT notices
Per RFC https://wiki.php.net/rfc/reclassify_e_strict

While reviewing this, found that there are still three E_STRICTs
left in libraries - need to discuss those.
2015-04-01 11:17:55 +02:00
Nikita Popov 6ef9216269 Finish PHP 4 constructor deprecation 2015-03-31 17:55:27 +02:00
Guilherme Blanco d51fb69c01 Removed parsing support traits to have extends and implements. 2015-01-09 15:45:02 +01:00
Julien Pauli ebe755f149 Merge branch 'PHP-5.6'
* PHP-5.6:
  Updated NEWS
  Updated NEWS
  Fixed Bug #65576 (Constructor from trait conflicts with inherited constructor)

Conflicts:
	Zend/zend_compile.c
2014-12-12 16:14:24 +01:00
Kévin Dunglas ee226b961c Fixed Bug #65576 (Constructor from trait conflicts with inherited constructor) 2014-12-12 14:58:23 +01:00
Veres Lajos 4b9535341a typo fixes - https://github.com/vlajos/misspell_fixer 2014-11-19 20:23:00 +00:00
Veres Lajos 8d86597d73 non living code related typo fixes 2013-08-04 16:05:36 -07:00
Xinchen Hui 9a44a9806c Fixed bug #64235 (Insteadof not work for class method in 5.4.11)
As we discussed with stefan, we think previous of allowing use with
classes is a bug, should be forbided, anyway, the error message should
be improved.
2013-02-21 18:18:41 +08:00
Dmitry Stogov 42437dd870 Fixed bug #64070 (Inheritance with Traits failed with error) 2013-02-18 16:07:51 +04:00
Dmitry Stogov 7e2629635b spelling 2012-12-25 16:21:25 +04:00