Commit Graph

408 Commits

Author SHA1 Message Date
Dmitry Stogov
4a475a4976 Replace legacy zval_dtor() by zval_ptr_dtor_nogc() or even more specialized destructors.
zval_dtor() doesn't make a lot of sense in PHP-7.* and it's used incorrectly in some places.
Its occurances should be replaced by zval_ptr_dtor() or zval_ptr_dtor_nogc(), or even more specialized destructors.
2018-07-04 19:22:24 +03:00
Nikita Popov
17afe6430f Fixed bug #76439 2018-06-27 14:15:56 +02:00
Xinchen Hui
7f196c45ef use defined macro 2018-06-18 12:14:00 +08:00
Dmitry Stogov
5eb1f92f31 Use zend_string_release_ex() instread of zend_string_release() in places, where we sure about string persistence. 2018-05-28 16:27:12 +03:00
Dmitry Stogov
524f5245c5 Avoid useless checks, using zend_string_efree(), in cases where the string is known to be a temporary allocated zend_string. 2018-05-08 17:30:15 +03:00
Thomas Punt
4887357269 Implement flexible heredoc/nowdoc syntax
RFC: https://wiki.php.net/rfc/flexible_heredoc_nowdoc_syntaxes

* The ending label no longer has to be followed by a semicolon or
  newline. Any non-label character is fine.
* The ending label may be indented. The indentation will be stripped
  from all lines in the heredoc/nowdoc string.

Lexing of heredoc strings performs a scan-ahead to determine the
indentation of the ending label, so that the correct amount of
indentation can be removed when calculting the semantic values for
use by the parser. This makes the implementation quite a bit more
complicated than we would like :/
2018-04-13 21:35:37 +02:00
Dmitry Stogov
4bbf200b4e Optmized AST creation 2018-03-15 15:40:04 +03:00
Dmitry Stogov
bcacb7545c PHP scanner optimization 2018-03-15 01:33:17 +03:00
Dmitry Stogov
53b474504d PHP scanner optimization 2018-03-14 21:27:57 +03:00
Dmitry Stogov
8afb91cdad PHP scanner optimization 2018-03-14 01:48:17 +03:00
Dmitry Stogov
d1585a9e3f Revert "Handle scanner error in first place (don't hide them from ext/tokenizer) and cheaper whitespace handlig."
This reverts commit 0d6da03f5c.
2018-03-14 01:08:03 +03:00
Dmitry Stogov
0d6da03f5c Handle scanner error in first place (don't hide them from ext/tokenizer) and cheaper whitespace handlig. 2018-03-13 18:42:09 +03:00
Dmitry Stogov
20866891bd Eliminate duplication 2018-01-17 15:52:52 +03:00
Xinchen Hui
a6519d0514 year++ 2018-01-02 12:57:58 +08:00
Dmitry Stogov
6a9d2b2190 Cleanup type conversion 2017-12-07 19:24:55 +03:00
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