Commit Graph

393 Commits

Author SHA1 Message Date
Xinchen Hui
463413db53 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Update NEWS
  Fixed bug #74947 (Segfault in scanner on INF number)

Conflicts:
	Zend/zend_language_scanner.c
2017-07-21 12:02:54 +08:00
Xinchen Hui
84926a0d71 Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Fixed bug #74947 (Segfault in scanner on INF number)

Conflicts:
	Zend/zend_language_scanner.c
2017-07-21 11:58:07 +08:00
Xinchen Hui
95d2908814 Fixed bug #74947 (Segfault in scanner on INF number) 2017-07-21 11:56:49 +08:00
Nikita Popov
16861838a5 Merge branch 'PHP-7.1' 2017-03-23 22:50:21 +01:00
Nikita Popov
e3e3547627 Merge branch 'PHP-7.0' into PHP-7.1 2017-03-23 22:49:51 +01:00
Nikita Popov
d719b46222 Fix sequencing UB 2017-03-23 22:48:45 +01:00
Sara Golemon
819e66599a Merge branch 'PHP-7.1'
* PHP-7.1:
  Fix bug where `yield from` is captured too greedily
2017-03-23 13:40:09 -07:00
Sara Golemon
7835e2ebc5 Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Fix bug where `yield from` is captured too greedily
2017-03-23 13:38:58 -07:00
Sara Golemon
0fb640c717 Fix bug where yield from is captured too greedily
In the following piece of code:

```php
function from1234($x) {
  return $x;
}
function foo($x) {
  yield from1234($x);
}
```

The statement inside foo is taken as `yield from` `1234($x)`
which is neither the intent, nor even legal syntax for an fcall.

Do a lookahead for breaking non-label characters after the
`yield from` and only accept it if they occur.
2017-03-23 13:31:06 -07:00
Nikita Popov
fec708f518 Simplify increment_lineno handling 2017-03-22 22:33:05 +01:00
Sammy Kaye Powers
dac6c639bb Update copyright headers to 2017 2017-01-04 11:23:42 -06:00
Sammy Kaye Powers
478f119ab9 Update copyright headers to 2017 2017-01-04 11:14:55 -06:00
Sammy Kaye Powers
9e29f841ce Update copyright headers to 2017 2017-01-02 09:30:12 -06:00
Christoph M. Becker
2cc3aeb4b9 Implement #72918: negative offset inside a quoted string leads to parse error
We allow negative numeric offsets for the simple syntax inside
double-quoted and heredoc strings.
2016-10-14 14:14:08 +02:00
Nikita Popov
0e4c173349 Merge branch 'PHP-7.0' into PHP-7.1
(cherry picked from commit 26964ccea0)
2016-10-14 01:52:17 +02:00
Nikita Popov
5b429fef42 Fix line number of implicit return in pseudo-main scope 2016-10-12 22:25:41 +02:00
Nikita Popov
07af6ba898 Make sure TOKEN_PARSE mode is thread safe
Introduce an on_event_context passed to the on_event hook. Use this
context to pass along the token array. Previously this was stored
in a non-tls global :/
2016-07-23 00:00:13 +02:00
Dmitry Stogov
ebb99a1a3a Fixed compilation warnings 2016-06-21 16:55:17 +03:00
Sara Golemon
95af467d8d Raise compiler warning on octal overflow
Addresses https://bugs.php.net/bug.php?id=71994
2016-05-14 00:20:32 +00:00
Dmitry Stogov
ccf18da450 Eliminated checks for (func->op_array.fn_flags & ZEND_ACC_GENERATOR) in fast path of DO_FCALL* handlers.
This slightly improves calls to regular function and method calls in cost of a bit slower generator initialization.
Separate call frame for generators, allocated on heap, now created by ZEND_GENERATOR_CREATE instruction.
2016-05-13 01:40:15 +03:00
Dmitry Stogov
c19cb70dac Revert "Refactor zval cleanup into single function"
This reverts commit bac6fdb0c5.
2016-05-06 10:47:58 +03:00
Bob Weinand
bac6fdb0c5 Refactor zval cleanup into single function
Also use zval_ptr_dtor_nogc() everywhere in Zend in favor of zval_dtor()
2016-05-05 23:31:57 +02:00
Andrea Faulds
660e88c19d Fix bug #71897 2016-05-04 19:26:24 +01:00
Nikita Popov
35b34d7235 Merge branch 'PHP-7.0'
Conflicts:
	Zend/zend_language_scanner.c
2016-03-06 21:39:20 +01:00
Nikita Popov
860dc17ab7 Fixed bug #71724 2016-03-06 21:38:21 +01:00
Xinchen Hui
563659822d Merge branch 'PHP-7.0' 2016-01-02 17:56:54 +08:00
Xinchen Hui
97a9470d97 bump year which is missed in rev 49493a2 2016-01-02 17:56:11 +08:00
Dmitry Stogov
998204ef2d Separate common part of compile_file() and compile_string() into zend_compile() 2015-11-12 16:59:44 +03:00
Nikita Popov
a49ce7bb91 Don't return T_ERROR from token_get_all()
This turned out to be rather inconvenient after all. Instead just
return the same output we did on PHP 5. If people want to have an
error, use TOKEN_PARSE.
2015-07-09 23:02:21 +02:00
Nikita Popov
d91aad5966 Fix bug #69430
Don't throw from token_get_all() unless TOKEN_PARSE is used. Errors
are reported as T_ERROR tokens.
2015-07-09 19:11:48 +02:00
Aaron Piotrowski
a1a83bf5f0 Switch code on thrown TypeError and ParseError to 0, update related tests 2015-07-07 16:54:39 -05:00
Kalle Sommer Nielsen
ce2cd89258 Replace references to PHP_WIN32 and TSRM_WIN32 with ZEND_WIN32 in Zend/, this also fixes 1 instance of where fflush(stderr) was misplaced (zend_extensions.c) 2015-07-04 18:55:22 +02:00
Aaron Piotrowski
ed1b64877d Switch position of ce in exception ce variable names 2015-07-03 09:45:03 -05:00
Aaron Piotrowski
f9e9d3a437 Cleanup exception ce API
Removed recently added functions to get Error ce's and marked the old functions
fetching default_exception_ce and error_exception_ce as deprecated.
2015-07-03 09:44:30 -05: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
Aaron Piotrowski
d042d08807 Remodel exceptions based on Throwable interface
Added Throwable interface that exceptions must
implement in order to be thrown. BaseException
was removed, EngineException renamed to
Error, and TypeException and ParseException
renamed to TypeError and ParseError. Exception
and Error no longer extend a common base
class, rather they both implement the Throwable
interface.
2015-05-16 15:30:59 -05: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
Márcio Almada
a75decd452 implement context sensitive language with lexical feedback
The implementation has no regression risks, has an even smaller footprint
compared to the previous attempt involving a pure lexical approach, is higly
predictable and higly configurable.

To turn a word semi-reserved you only need to edit the "SEMI_RESERVED" parser rule,
it's an inclusive list of all the words that should be matched as T_STRING on specific contexts.
Example:

```
method_modifiers function returns_ref indentifier '(' parameter_list ')' ...
```

instead of:

```
method_modifiers function returns_ref T_STRING '(' parameter_list ')' ...
```

TODO: port ext tokenizer
2015-04-30 03:03:29 -03:00
Bob Weinand
a9a6799964 Add line_start/end info to main op_array 2015-04-25 19:10:58 +02:00
Nikita Popov
d2607a0110 Move more stuff to file_context
Introduce helper macro FC(x) for CG(file_context).x.

end_compilation() now handled by file_context_end().

While at it, dropped zval wrapper for ticcks.
2015-04-21 17:39:07 +02:00
Nikita Popov
0381c1b79e Fixed bug #69388
Renamed compiler_context to oparray_context. Introduced per-file
file_context. Moved import tables into the file_context.

context_stack no longer exists, instead keeping backups of contexts
on C stack. Same for file contexts.

TODO: Move more things out of CG into file_context. There should be
a number of other things that we should not try to reuse in nested
compilations.
2015-04-20 18:18:52 +02:00
Bob Weinand
f3e124d58d Merge branch 'coroutineDelegation' of https://github.com/bwoebi/php-src 2015-04-14 17:58:58 +02:00
Nikita Popov
a8bf1c5d8f Throw ParseException from lexer
Primarily to avoid getting fatal errors from token_get_all().

Implemented using a magic E_ERROR token, which the lexer emits to
force a parser failure.
2015-04-02 16:31:17 +02:00
Dmitry Stogov
acfc31c0f8 Use zend_error_noreturn() for fatal errors 2015-04-01 13:32:23 +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
Nikita Popov
f1a6c06f14 Support ParseException for require etc 2015-03-17 21:35:42 +01:00
Bob Weinand
b4a142ab97 Added yield from operator 2015-03-07 00:28:12 +01:00
Dmitry Stogov
2fa8d67a5c Use zend_string* instead of char* for opened_patch handling. Avoid reallocations and improve string reuse. 2015-03-04 02:05:28 +03:00
Andrea Faulds
797dee59cd Blast off to space. 2015-01-29 17:56:09 +00:00
Dmitry Stogov
b494aa0ba0 Fixed compiler reenterability 2015-01-22 20:39:34 +03:00