Commit Graph

29 Commits

Author SHA1 Message Date
Nikita Popov
357fbc9902 Treat magic constants like normal constants 2020-02-11 12:33:23 +01:00
Nikita Popov
ab154b7a64 Make class constants fully dereferencable 2020-02-11 12:33:23 +01:00
Nikita Popov
de7c7efee9 Unify array and object dereferencability 2020-02-11 12:33:23 +01:00
Nikita Popov
24e365f9e2 Make encapsed strings fully dereferencable
This allows operations that were previously allowed on constant
strings on interpolated strings as well.
2020-02-11 12:33:23 +01: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
Christoph M. Becker
bcf9d1e995 new_variable '{' expr '}' is deprecated as well
Curly brace syntax for accessing array elements and string offsets is
deprecated [1]; this should also be the case for respective `new`
expressions.

This issue has been reported by brzuchal@php.net.

[1] <https://wiki.php.net/rfc/deprecate_curly_braces_array_access>
2019-09-09 19:05:23 +02:00
Nikita Popov
2a04efe0e4 Remove unnecessary precedence/associativity annotations
Some of these are entirely unnecessary. Some specify an associativity
for operators where the concept doesn't make sense and has no effect:
Explicit associativity is only meaningful for binary operators. For
unary operators and constrained operations like instanceof or assignment
the associativity specification has no effect and only serves to confuse.

For example assignments were specified as %left, even though they will
actually behave as right-associative due to the variable requirement on
the LHS. Similarly instanceof was specified as %nonassoc, but it will
behave as left-associative, due to the restrictions places on the RHS.
2019-03-15 12:01:58 +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
Xinchen Hui
dbd729e86b Req #74963 (Improved error message on fetching property of non-object) 2017-07-31 11:43:14 +08:00
Nikita Popov
99d818f1e9 Don't propagate into ops that error on non-string
To properly support this make update_opN_const fallible -- they
are not always called through replace_with_const.
2015-11-07 12:04:51 +01:00
Nikita Popov
00b37e718d Strip leading backslash in update_opN_const 2015-11-07 12:04:51 +01:00
Nikita Popov
632bee4abb Fix update_opX_const lowercasing
It was lowering in-place.
2015-11-07 12:04:51 +01: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
62aabf5d9f Fix "invalid opcode" error
Method call can happen on CONST, it'll just throw an error.

Not forbidding this at compile-time, so this can be overridden in
an extension.
2015-04-22 17:46:25 +02:00
Márcio Almada
1849546ada add missing test for class member access with deference
relates to https://wiki.php.net/rfc/uniform_variable_syntax
2015-02-11 15:23:20 +01:00
Rasmus Lerdorf
388624d359 These tests all have intentional circular references
and they will leak and cause failures unless gc is enabled
2015-01-24 16:06:18 -08:00
Veres Lajos
4b9535341a typo fixes - https://github.com/vlajos/misspell_fixer 2014-11-19 20:23:00 +00:00
Nikita Popov
231dcc94e8 Test use of string names with \ prefix
And drop piece of dead code
2014-09-23 20:36:00 +02:00
Nikita Popov
c8aa51f825 Accept static member fetch in new variable (BC) 2014-06-06 17:05:14 +02:00
Nikita Popov
8515b96e53 Handle FUNC_ARG fetches on temporaries 2014-05-31 20:15:55 +02:00
Nikita Popov
96b32ec532 Support isset() on temporaries 2014-05-31 20:05:03 +02:00
Nikita Popov
5c2120b6cf Forbid writing to temporary expressions 2014-05-31 19:41:39 +02:00
Nikita Popov
72b5e0cac0 Add another static member access test 2014-05-31 18:18:20 +02:00
Nikita Popov
f0ac7f7d7b Properly handle property read on const/tmp 2014-05-31 17:51:22 +02:00
Nikita Popov
c53a7ea4e5 Property handle calls on [] and '' consts/tmps 2014-05-31 17:37:30 +02:00
Nikita Popov
64e4c9eff1 Support directly calling closure 2014-05-31 17:18:37 +02:00
Nikita Popov
4ec505f9b5 Add two initial tests 2014-05-31 16:33:52 +02:00