Commit Graph

10187 Commits

Author SHA1 Message Date
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
Nikita Popov
a50e9d87f2 Partially revert "Fix uninitialized value condition"
This reverts commit e874f76096,
which broke zpp quite mode.

Only the initialization of the "severity" variable is retained.
2015-03-22 09:25:32 +01:00
Nikita Popov
ccfd53886f Revert "Use E_ERROR | E_EXCEPTION in FAST_ZPP mode too"
This reverts commit d4da7c20d2.

The argument passed to this function refers to the weak mode
severity, strict mode will get an exception in any case.
2015-03-22 09:17:42 +01:00
Bob Weinand
d4da7c20d2 Use E_ERROR | E_EXCEPTION in FAST_ZPP mode too 2015-03-22 00:17:33 +01:00
Bob Weinand
e874f76096 Fix uninitialized value condition 2015-03-22 00:14:47 +01:00
Dmitry Stogov
1f408af03c Fixed in-place modification of IS_CONST operand 2015-03-21 00:22:25 +03:00
Dmitry Stogov
3a886a0c90 Changed SKIPIF messages 2015-03-20 23:19:51 +03:00
Dmitry Stogov
35f9b90bb8 ZPP changed to lazely check for "strict/weak" only if it's really necessary.
Cleanup.
2015-03-20 23:18:52 +03:00
Dmitry Stogov
4e5767b5d7 cleanup 2015-03-20 20:43:23 +03:00
Dmitry Stogov
1cfa4db338 Fixed return type hint handling for constants 2015-03-20 18:36:43 +03:00
Dmitry Stogov
139c6c644c Fixed tests 2015-03-20 17:56:32 +03:00
Dmitry Stogov
054591ab9a Imroved ZPP rules (condititins reoredered to prevent duplicate checks) 2015-03-20 17:27:03 +03:00
Dmitry Stogov
66f16c6cfb Fixed comments 2015-03-20 17:26:38 +03:00
Dmitry Stogov
7cf05ce8da Fixed error messages 2015-03-20 17:26:12 +03:00
Dmitry Stogov
5935612666 Improved type hinting:
EX_PREV_USES_STRICT_TYPES() and family changed/renamed to fit with other macros
Optimized zend_verify_internal_arg_type() and family (they don't need "strict" argument anymore)
Standerd ZPP is called from VM only for weak type check or strict exception (int -> double)
Fixed ZEND_RECV_VARIADIC
Fixed ZEND_STRLEN

TODO: should we accept IS_NULL for non-nullable arguments?
2015-03-20 16:04:04 +03:00
Dmitry Stogov
44669e8f41 Fixed white spaces 2015-03-20 11:10:29 +03:00
Dmitry Stogov
aee2985f35 Merge branch 'scalar_type_hints_v5' of github.com:ircmaxell/php-src into scalar_type_hints_v5
* 'scalar_type_hints_v5' of github.com:ircmaxell/php-src: (54 commits)
  Add check for maintaining reference all the way through both type and return values
  Reduce the number of times that the zval needs to be separated in return type checking to those that are necessary
  Add test to ensure namespaced code can't use scalar types as class names
  Disallow relative namespace type declarations
  Add support and tests for null constant default values. Refactor complex conditionals into an extracted function for clarity and code-reuse
  Refactor as to not use call info, but add the flag to the op_array.
  Fix severity issues with callbacks, start work porting ZEND_STRLEN opcode to work with strict mode, more refactoring to come
  Fix C89 compatibility by moving a misplaced if statement
  Refactor gotos into more elaborate ifs to eliminate goto failure
  Fix return type separation with references. It now includes a check in the opcode handler and properly separates the value in both cases
  Add error case with invalid type declaration default value
  Add tests for using constants as defaults with scalar type declarations
  Refactor error messages to only append defined in the event of rendering as a fatal error. Fix relative typehints to not work
  Revert gd and mysqli to former calls for arg count errors. Fix first identified issues with zend_compile.c from nikic. Add tests for generator returns prior to first yield
  Style cleanup, as well as fixing bug with missing argument for WRONG_PARAM_COUNT_WITH_RETVAL
  Clean up API renames for zend_wrong_param_count to maintain BC, introducing a zend_wrong_param_count_ex() function when you know strict value
  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
  Fix more tests, improve error messages in failure output for thrown exception
  Refactor error implementation significantly to centralize error mode behavior. Add zend_internal_type_error() function
  Refactor declare placement detection, allow encoding declares before type declares
  ...
2015-03-20 10:51:41 +03:00
Dmitry Stogov
d146d15003 Optimize zend_string_realloc() add more specialized versions zend_string_extend() and zend_string_truncate() 2015-03-20 02:02:42 +03:00
Anthony Ferrara
8c76c331a5 Add check for maintaining reference all the way through both type and return values 2015-03-19 17:51:19 -04:00
Anthony Ferrara
2e4401512f Reduce the number of times that the zval needs to be separated in return type checking to those that are necessary 2015-03-19 17:47:43 -04:00
Anatol Belski
743541b311 fix datatype mismatch warnings 2015-03-19 22:33:12 +01: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
7044f9c6df Refactor as to not use call info, but add the flag to the op_array. 2015-03-19 13:30:11 -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
Xinchen Hui
61e31b6e29 Fixed global register checking 2015-03-19 16:54:13 +08:00
Anthony Ferrara
78d2399493 Fix C89 compatibility by moving a misplaced if statement 2015-03-18 18:38:16 -04:00
Anthony Ferrara
d8ef608f3d Refactor gotos into more elaborate ifs to eliminate goto failure 2015-03-18 18:24:00 -04:00
Anthony Ferrara
427ecdc5eb Fix return type separation with references. It now includes a check in the opcode handler and properly separates the value in both cases 2015-03-18 18:10:08 -04:00
Bob Weinand
dac2b060e4 Remove bogus ZEND_ASSERT(hash != 0)
There's always a possibility that the has will end up as equal to zero due to overflowing.
See the tests for strings whose hash overflow.
Yes, there's a check for whether the hash already was calculated... and strings with a hash equal to zero always need the hash recalculated, in one of 2^32 respectively 2^64 cases - which should not be a major issue.
2015-03-18 22:25:55 +01: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
1df033c5cd Revert gd and mysqli to former calls for arg count errors. Fix first identified issues with zend_compile.c from nikic. Add tests for generator returns prior to first yield 2015-03-18 16:14:02 -04:00
Anthony Ferrara
579e7fa457 Style cleanup, as well as fixing bug with missing argument for WRONG_PARAM_COUNT_WITH_RETVAL 2015-03-18 15:45:16 -04:00
Anthony Ferrara
8be4266f6a Clean up API renames for zend_wrong_param_count to maintain BC, introducing a zend_wrong_param_count_ex() function when you know strict value 2015-03-18 15:42:49 -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
d22bfb8aa6 Merge in master, fix merge conflicts and update patch to support exceptions everywhere 2015-03-18 10:50:11 -04:00
Xinchen Hui
5c6db3b0f2 Better make this be consistent with DO_ICALL/DO_CALL
Revert "Use more specific op type"
This reverts commit 9b07ed6dcc.
2015-03-18 22:09:57 +08:00
Anatol Belski
e839ed8c99 strtod shouldn't recognize hex strings 2015-03-18 14:26:15 +01:00
Dmitry Stogov
a01b5f2953 Enabled global register variables for PPC 2015-03-18 16:15:00 +03:00
Xinchen Hui
9b07ed6dcc Use more specific op type 2015-03-18 20:56:28 +08:00
Dmitry Stogov
4e11095438 Reimplemented special constant handling. Now __HALT_COMPILER_OFFSET__ is resolved at compile-time. __CLASS__ retrived using separate ZEND_FETCH_CLASS_NAME opcode. 2015-03-18 15:33:56 +03:00
Dmitry Stogov
65b7f4860e Revert "Improved zend_get_special_constant"
This reverts commit 624eb49e78.
2015-03-18 15:25:27 +03:00
Xinchen Hui
624eb49e78 Improved zend_get_special_constant 2015-03-18 12:22:07 +08:00
Anatol Belski
8a8264a29a comb that header 2015-03-18 00:45:37 +01:00
Anatol Belski
956bab0566 fix endianness check plus better visual origin compat 2015-03-18 00:39:06 +01:00