Commit graph

2287 commits

Author SHA1 Message Date
Xinchen Hui
c58c5e779a Fixed bug #69868 (Invalid read of size 1 in zend_compile_short_circuiting) 2015-06-18 19:53:26 +08:00
Dmitry Stogov
a524a375d9 Improved class type hints checks, by caching resolved class entries in run-time cache. 2015-06-17 12:07:43 +03:00
Nikita Popov
4448843b7c Move check for CT div by zero into common function 2015-06-16 18:09:59 +02:00
Bob Weinand
52e9a772a3 Fully fixing all the affected const expr cases (see bug #69832) 2015-06-16 16:53:30 +02:00
Bob Weinand
9db81340ba Fix bug #69832 (Assertion failure) 2015-06-15 17:43:09 +02:00
Bob Weinand
37c91b8d03 Fix off by one in short_circuiting optimization 2015-06-14 17:47:35 +02:00
Xinchen Hui
f1ae57f155 Simplify the condition 2015-06-14 22:56:06 +08:00
Bob Weinand
7221bd682f Revert "Revert "Expand optimizations regarding short-circuting a bit""
This reverts commit 3770a5ac66.
Fixes the bug which probably made make install fail on travis
(It never happened to me that all tests passed, but make install failed...)
2015-06-14 15:46:11 +02:00
Xinchen Hui
3770a5ac66 Revert "Expand optimizations regarding short-circuting a bit"
This break the CI  (build error)

This reverts commit 3cfa58367b.
2015-06-14 14:27:48 +08:00
Bob Weinand
3cfa58367b Expand optimizations regarding short-circuting a bit 2015-06-14 06:01:01 +02:00
Bob Weinand
f263932f38 Fix short-circuting (bug #69825) 2015-06-14 02:00:55 +02:00
Xinchen Hui
20d85e4f02 typo 2015-06-13 10:56:30 +08:00
Xinchen Hui
829c7a1bb0 Merge branch 'master' of git.php.net:php-src 2015-06-13 10:51:15 +08:00
Xinchen Hui
d96dda8d49 Fixed Bug #69761 (Serialization of anonymous classes should be prevented)
And also cleanup anonymous class compiling, it make no sense prefix a
namespace to anonymous class name. and it is always lowcased and
interned string.
2015-06-13 10:49:20 +08:00
Bob Weinand
7c2a0157c7 Cache the class_name typehint key in arg_info
This leads to up to 2% improvement on one tested real world application by not having to always recalculate the lowercased string and its hash
2015-06-12 17:26:53 +02:00
Xinchen Hui
49a8f801c7 Fixed bug #69805 (null ptr deref and seg fault in zend_resolve_class_name) 2015-06-12 21:07:23 +08:00
Dmitry Stogov
be988aba36 Compile-time constant folding 2015-06-11 01:57:37 +03:00
Xinchen Hui
cea801cce2 Fixed bug #69767 (Default parameter value with wrong type segfaults) 2015-06-08 11:47:22 +08:00
Dmitry Stogov
adb5f93f85 Fixed bug #69755 (segfault in ZEND_CONCAT_SPEC_TMPVAR_CONST_HANDLER) 2015-06-04 09:38:22 +03:00
Bob Weinand
1d3f77d13d Fix Bug #69754 (Compile failure with ::class in array) 2015-06-03 23:59:59 +02:00
Nikita Popov
402f697068 Remove zend_init_list
No longer used - zend_add_to_list already covers this.

Also marked zend_add_to_list as static and dropped it from the header.
2015-05-29 11:07:51 +02:00
Nikita Popov
21a29b4be3 Drop unnecessary checks for op_array->filename
We always require a filename.
2015-05-29 11:07:51 +02:00
Xinchen Hui
770a462943 implicit declaration of function ‘zend_multibyte_yyinput_again’ 2015-05-26 10:36:52 +08:00
Bob Weinand
69b54ba926 Also unreserve T_CLASS 2015-05-25 22:58:30 +02:00
Bob Weinand
306a0f28d0 Merge branch 'master' of https://github.com/php/php-src 2015-05-25 19:00:53 +02:00
Dmitry Stogov
03f41f9b4d Prevent op_array->this_var setting when method uses auto globals 2015-05-25 19:59:25 +03:00
Bob Weinand
886cbea94f Merge context sensitive lexer RFC 2015-05-25 18:38:40 +02:00
Levi Morrison
e13803d15b Inline zend_find_builtin_type
This function was used only inside of zend_find_builtin_type_by_name,
which is also used only one time.
2015-05-23 11:12:13 +02:00
Levi Morrison
e22ceb6e82 Remove duplication 2015-05-23 11:12:13 +02:00
Levi Morrison
339283c523 Rename some variables and functions
The way these are used have little to do with them being scalars;
they are just tuples with names, lengths and IS_* constants. We
will probably reuse these in the future with other types.
2015-05-23 11:12:12 +02:00
Nikita Popov
7a88d16cf3 Use ZEND_JMP instead of ZEND_BRK/ZEND_CONT
Emit necessary FREEs during compilation, convert to JMP during
pass_two (we may not know target opline beforehand).
2015-05-23 10:51:33 +02:00
Nikita Popov
9325ada725 Embed break/continue depth into opline
Previously a separate lval literal was used - this is probably a
leftover from the time where the break level could still be
specified dynamically.
2015-05-23 10:51:33 +02:00
Nikita Popov
3cbe3903fa Move loop var stack management into begin/end loop
Also set start to -1 in begin_loop already, so the info that a
loop variable is not used is already available at compile-time.
2015-05-23 10:51:33 +02:00
Nikita Popov
d0e265392f Drop FREE_ON_RETURN flag, check brk_cont->start instead
Start >= 0 already tells us whether or not the loop has a loop
variable, no need to add extra flags to opcodes.

Also added a test for a case where FREE_ON_RETURN is relevant,
we didn't seem to have any coverage for this.
2015-05-23 10:51:33 +02:00
Nikita Popov
3dba00bc31 Fix scope_is_known() for class constants
Here the active_op_array is still the surrounding file, but we
do know the scope.
2015-05-21 21:07:05 +02:00
Dmitry Stogov
d72a94468e Merged FE_FETCH_R[W] with the following ASSIGN[_REF] when assigne to CV. 2015-05-13 12:55:42 +03:00
Nikita Popov
6ef8ae65a2 Allow self etc in eval / file scope
This fixes a regression from 16a9bc1ec2.
Together with the recent closure related changes this should allow
all usages of self etc, while previously (in PHP 5) some things like
self::class did not work.
2015-05-07 15:38:16 +02:00
Nikita Popov
ab97606b8a Fix compiler assumptions about self/etc wrt closures
* Don't throw an error if self/parent/static are used in a closure
  (outside a class).
* Don't propagate self:: constants into closures
* Use runtime fetch for self::class in closures

Fixes bug #66811.
2015-05-06 18:13:19 +02:00
Nikita Popov
dd1fdfb17c Use ZEND_FETCH_CLASS_NAME for dynamic self::class etc
Extend the opcode to support getting the parent and static name and
then use it for dynamic ::class resolution.
2015-05-05 21:14:03 +02:00
John Boehr
56fdae9018 Fix uninitialized value with extension traits 2015-05-04 10:33:26 +08:00
Márcio Almada
110759386e ext tokenizer port + cleanup unused lexer states
we basically added a mechanism to store the token stream during parsing
and exposed the entire parser stack on the tokenizer extension through
an opt in flag: token_get_all($src, TOKEN_PARSE).

this change allows easy future language enhancements regarding context
aware parsing & scanning without further maintance on the tokenizer
extension while solves known inconsistencies "parseless" tokenizer
extension has when it handles `__halt_compiler()` presence.
2015-04-30 03:03:29 -03: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
Xinchen Hui
33e32cbe5b Make it inline 2015-04-28 11:30:25 +08:00
Nikita Popov
422de8a7a7 Drop compile_class_decl return value
Was introduced for anon classes, but no longer needed.
2015-04-27 22:54:02 +02:00
Dmitry Stogov
8acd7f49da Pass class_entry through IS_VAR to avoid hash lookup in ZEND_NEW. 2015-04-27 14:16:29 +03:00
Dmitry Stogov
2a1b0b1121 Use "safe" anonymous class names. Don't show the mangled names through var_dump(). 2015-04-27 13:08:22 +03:00
Dmitry Stogov
94245bc14c Refactored using specialized opcodes 2015-04-27 12:24:39 +03:00
Nikita Popov
8361893444 Fix implementing_class handling 2015-04-26 16:03:58 +02:00
Nikita Popov
f2f890a256 More cleanup (mainly retab) 2015-04-26 15:54:30 +02:00
Nikita Popov
03d7042d5c Don't issue FETCH_CLASS for anon classes 2015-04-26 15:44:48 +02:00