Nikita Popov
1397f754c8
Fix handling of qualified nullable parameter types
...
compile_typename() can't deal with TYPE_NULLABLE flags, drop it
beforehand.
2016-08-16 12:43:17 +02:00
Andrea Faulds
1dab96c1db
Show "or null" in TypeErrors for nullable arg_infos
2016-08-11 18:44:43 +02:00
Levi Morrison
2a7eeff33e
Remove mentions of "type hint" and "typehint"
2015-12-24 15:19:31 +01:00
Nikita Popov
99dd7ee80b
Forbid namespace\int type hint as well
2015-11-26 16:56:08 +01:00
Xinchen Hui
05738eb71a
Revert "Improved fix for Fully qualified (leading backslash) type names must fail"
...
This reverts commit 00865ae22f
.
2015-11-25 19:06:42 +08:00
Xinchen Hui
00865ae22f
Improved fix for Fully qualified (leading backslash) type names must fail
...
it now all fails with COMPILE_ERROR instead of syntax error for T_ARRAY
but COMPILE_ERROR for int
2015-11-25 11:27:32 +08:00
Bob Weinand
569763cb1a
Fix scalar type names with leading backslash
2015-11-24 21:39:06 +01:00
Dmitry Stogov
a6509a6fdd
Fixed test
2015-09-23 13:18:30 +03:00
Xinchen Hui
504cd492e1
Fixed bug #70548 (Redundant information printed in case of uncaught engine exception)
2015-09-23 13:04:33 +08:00
Aaron Piotrowski
68baa539dc
Allow integer default for float type
2015-07-02 18:07:24 -05:00
Bob Weinand
115e9288bb
Fix segfault with scalar passed to typehint with not loaded class
2015-06-21 01:35:22 +02:00
Aaron Piotrowski
110e0a5a2c
Merge branch 'master' into throwable-interface
...
# Conflicts:
# Zend/zend_language_scanner.c
# Zend/zend_language_scanner.l
# ext/simplexml/tests/SimpleXMLElement_xpath.phpt
2015-06-14 18:53:11 -05:00
Nikita Popov
4ea1d8a9c7
Show argument causing TypeException in trace
...
Not sure why that check was there, did I miss something?
2015-05-20 18:28:09 +02:00
Aaron Piotrowski
e97d5fab35
Update exception names in tests after formatting changes.
2015-05-17 17:31:43 -05:00
Aaron Piotrowski
fb7206e452
Merge branch 'master' into throwable-interface
2015-05-17 16:15:35 -05:00
Nikita Popov
440481fb3e
Display TypeExceptions like normal exceptions
...
We currently don't show the argument at which the error actually
occured in the trace - should probably either add it or don't
display args on incomplete frames altogether, otherwise this'll
probably be confusing.
2015-05-17 19:54:12 +02:00
Aaron Piotrowski
64b167d201
Updated tests to reflect exception class changes.
2015-05-16 16:49:14 -05:00
Nikita Popov
16a9bc1ec2
Disallow self etc outside classes at compile-time
...
Also fix a bug with return types where "self" was rejected inside
a class, but not on a method.
Fallout: A couple of tests changed to more generic error messages.
2015-04-29 20:51:08 +02:00
Nikita Popov
53a40386bc
Implement additional type reservations
...
* The class names false, true and null are now reserved.
* The code dealing with reserved class names is now decoupled
from scalar type hint handling. It also includes self, parent,
and static, which are class names which were already reserved
previously.
* Reuse existing messages for reserved class names.
Fallout: class_alias() can no longer alias self, parent and static.
However this never really worked in the first place, as the test
which was testing this shows.
2015-03-30 22:59:06 +02:00
Nikita Popov
d659ee24ab
Fix VERIFY_RETURN separation
...
a) The SAME_FAKE_TYPE check should always occur on the dereferenced
value, otherwise we'll end up separating large referenced arrays.
b) For by-val return with an rc=1 reference, the SEPARATE_ZVAL
wouldn't do anything. Add a ZVAL_UNREF for this case.
I don't like this fix - there must be some better way to express
this.
2015-03-24 10:51:28 +01:00
Nikita Popov
a34f81deee
Allow adding return type during inheritance
...
This is allowed as per the return types RFC. The test for this
behavior happened to use an internal class without arginfo, which
is why this was not properly implemented.
2015-03-22 18:56:14 +01:00
Dmitry Stogov
3a886a0c90
Changed SKIPIF messages
2015-03-20 23:19:51 +03:00
Dmitry Stogov
139c6c644c
Fixed tests
2015-03-20 17:56:32 +03:00
Dmitry Stogov
44669e8f41
Fixed white spaces
2015-03-20 11:10:29 +03:00
Anthony Ferrara
c11cab3255
Add test to ensure namespaced code can't use scalar types as class names
2015-03-19 14:11:48 -04:00
Anthony Ferrara
aaf0c8b594
Disallow relative namespace type declarations
2015-03-19 14:07:03 -04:00
Anthony Ferrara
62fc556764
Add support and tests for null constant default values. Refactor complex conditionals into an extracted function for clarity and code-reuse
2015-03-19 13:51:24 -04:00
Anthony Ferrara
0ef80ac351
Fix severity issues with callbacks, start work porting ZEND_STRLEN opcode to work with strict mode, more refactoring to come
2015-03-19 12:26:34 -04:00
Anthony Ferrara
f040538448
Add error case with invalid type declaration default value
2015-03-18 16:53:45 -04:00
Anthony Ferrara
94fe6c42fa
Add tests for using constants as defaults with scalar type declarations
2015-03-18 16:50:51 -04:00
Anthony Ferrara
724f7118f1
Refactor error messages to only append defined in the event of rendering as a fatal error. Fix relative typehints to not work
2015-03-18 16:38:51 -04:00
Anthony Ferrara
0529eeb4a6
Fix executor issue with ignoring strict types, which cleans up a bunch of errors. Additionally fix the expected error of 2 unrelated tests that was caused by a change to the core error messages
2015-03-18 15:22:21 -04:00
Anthony Ferrara
dd9f4f9585
Fix more tests, improve error messages in failure output for thrown exception
2015-03-18 12:42:09 -04:00
Anthony Ferrara
7feebead1b
Refactor error implementation significantly to centralize error mode behavior. Add zend_internal_type_error() function
2015-03-18 12:23:09 -04:00
Anthony Ferrara
7c8d1e0bd7
Refactor declare placement detection, allow encoding declares before type declares
2015-02-20 15:56:58 -05:00
Anthony Ferrara
c859079962
Remove the aliases of scalar types
2015-02-18 16:43:39 -05:00
Anthony Ferrara
c6996a2988
Fix default values for booleans, thanks to virtual types
2015-02-18 16:34:43 -05:00
Anthony Ferrara
37604b45ba
Skip the tests if multibyte isn't loaded to prevent them from being fragile based on encoding availability
2015-02-18 12:00:18 -05:00
Anthony Ferrara
ac2ece885f
Improve detection of strict_types declaration being first in the file
2015-02-18 11:40:52 -05:00
Anthony Ferrara
00b3e77ead
Move declare() to the top of the file only, and allow int->float generalization
2015-02-18 10:26:29 -05:00
Andrea Faulds
b5513cdb69
Add scalar return types test
2015-02-10 15:48:10 +00:00
Andrea Faulds
0af3b7c017
Test behaviour of weak type hints with references
2015-02-10 15:48:08 +00:00
Andrea Faulds
187a95f8d3
Test nested strict/weak function calls
2015-02-10 15:48:08 +00:00
Andrea Faulds
17b3707bad
Test strict code including weak code and vice-versa
2015-02-10 15:48:07 +00:00
Andrea Faulds
b112c13a41
Test strict code calling weak code and vice-versa
2015-02-10 15:48:07 +00:00
Andrea Faulds
e1a238670c
Shorten syntax to strict_types=1
2015-02-10 15:48:07 +00:00
Andrea Faulds
ca4901254b
Add strict scalar types test
2015-02-10 15:48:06 +00:00
Andrea Faulds
1a28ad036e
Forbid scalar type hint names for use, class_alias
2015-02-10 15:48:05 +00:00
Andrea Faulds
75a225d0d5
Do not make scalar type hints reserved words, merely reserve class name
2015-02-10 15:48:05 +00:00
Andrea Faulds
c3c0f531a2
Scalar type hints with ZPP casting rules
2015-02-10 15:48:04 +00:00