Commit Graph

481 Commits

Author SHA1 Message Date
Nikita Popov
4565a7f269 Fix assertion when (real) is used
And bring back a test for it...
2020-03-16 18:37:01 +01:00
George Peter Banyard
c9db32271a Remove deprecated (real) cast
Closes GH-5220
2020-03-12 15:40:21 +01:00
Nikita Popov
30c2388738 Merge branch 'PHP-7.4'
* PHP-7.4:
  Fixed bug #79062
2020-02-28 17:08:27 +01:00
Nikita Popov
375191aae7 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fixed bug #79062
2020-02-28 17:07:36 +01:00
Nikita Popov
6c48da9a50 Fixed bug #79062
Back up the doc comment when performing heredoc scanahead.
2020-02-28 17:06:05 +01:00
Nikita Popov
d5c886ab7d Merge branch 'PHP-7.4'
* PHP-7.4:
  Properly propagate url_stat exceptions during include
2019-12-30 22:57:07 +01:00
Nikita Popov
f77747b06c Properly propagate url_stat exceptions during include
Make sure we abort operations early, and that we don't emit
additional warnings or errors if an exception has been thrown.
2019-12-30 22:56:42 +01:00
Nikita Popov
e0a401335d Make "unterminated comment" into a parse error 2019-10-30 11:00:27 +01:00
Nikita Popov
4e563e6c95 Merge branch 'PHP-7.4'
* PHP-7.4:
  Fix handling of overflowing invalid octal in tokenizer
2019-10-14 16:37:27 +02:00
Nikita Popov
641f9615cc Fix handling of overflowing invalid octal in tokenizer
If token_get_all() is used, we still need to correctly distinguish
LNUMBER vs DNUMBER here for backwards compatibility.
2019-10-14 16:36:27 +02:00
Nikita Popov
595e8c6773 Merge branch 'PHP-7.4' 2019-10-10 11:17:55 +02:00
Nikita Popov
6878c583b0 Report error if stream_read is not implemented
We need to return -1 in this case. Slightly restructure the code
to avoid unnecessary conditions.
2019-10-10 11:13:10 +02:00
Nikita Popov
e9f4676b3f Merge branch 'PHP-7.4' 2019-10-07 17:31:12 +02:00
Nikita Popov
2f64844495 Fix leak when include fails in a read operation
Usually it will already fail when opening, but reads can also
fail since PHP 7.4, in which case we still need to place the
file handle in open_files to make sure the destructor will run
on it.
2019-10-07 17:29:33 +02:00
Nikita Popov
5050507282 Merge branch 'PHP-7.4' 2019-10-04 22:47:10 +02:00
Nikita Popov
b078ae6c01 Merge branch 'PHP-7.3' into PHP-7.4 2019-10-04 22:46:53 +02:00
Nikita Popov
239e2dda64 Make sure T_ERROR is returned for all lexer exceptions
This originally manifested as a leak in oss-fuzz #18000. The following
is a reduced test case:

    <?php
    [
        5 => 1,
        "foo" > 1,
        "      " => "" == 0
    ];
    <<<BAR
    $x
     BAR;

Because this particular error condition did not return T_ERROR,
EG(exception) was set while performing binary operation constant
evaluation, which checks exceptions for cast failures.

Instead of adding this indirect test case, I'm adding an assertion
that the lexer has to return T_ERROR if EG(exception) is set.
2019-10-04 22:42:14 +02:00
Nikita Popov
d44cf9b539 Replace "unexpected character" warning with ParseError
Closes GH-4767.
2019-10-04 11:28:58 +02:00
Nikita Popov
7e77617533 Merge branch 'PHP-7.4' 2019-09-30 10:42:47 +02:00
Nikita Popov
19e7e4b197 Fixed bug #78604
<?php followed by EOF is valid since PHP 7.4.
2019-09-30 10:41:14 +02:00
Nikita Popov
38387d7cfc Merge branch 'PHP-7.4' 2019-09-28 17:17:36 +02:00
Nikita Popov
1b08ab26f7 Merge branch 'PHP-7.3' into PHP-7.4 2019-09-28 17:17:18 +02:00
Nikita Popov
7df50ef147 Don't throw warnings during heredoc scan-ahead
Otherwise these warnings will turn up twice (or more...)
2019-09-28 17:15:36 +02:00
Nikita Popov
3372a24b99 Merge branch 'PHP-7.4' 2019-09-14 12:10:15 +02:00
Nikita Popov
3f76f9416f Fix double-free on invalid large octal with separators
To clean up the mess here a bit, check for invalid octal digits
with an explicit loop instead of mixing this into the string to
number conversion.

Also clean up some type usage.
2019-09-14 12:10:06 +02:00
Christoph M. Becker
c8ec166cda Merge branch 'PHP-7.4'
* PHP-7.4:
  Fix #78454: Consecutive numeric separators cause OOM error
2019-08-25 22:46:55 +02:00
Theodore Brown
1a78bdab27 Fix #78454: Consecutive numeric separators cause OOM error
Resolves out of memory error when consecutive numeric separators follow a binary/hex literal.
2019-08-25 22:46:18 +02:00
Christoph M. Becker
c53064fbff Merge branch 'PHP-7.4'
* PHP-7.4:
  Fix #78441: Parse error due to heredoc identifier followed by digit
2019-08-21 22:55:25 +02:00
Christoph M. Becker
1eb75f2937 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #78441: Parse error due to heredoc identifier followed by digit
2019-08-21 22:54:52 +02:00
Christoph M. Becker
310708845f Fix #78441: Parse error due to heredoc identifier followed by digit
Since digits are allowed for identifiers, we have to cater to them as
well.
2019-08-21 22:51:51 +02:00
Nikita Popov
173ebe4c44 Merge branch 'PHP-7.4' 2019-07-24 10:44:40 +02:00
Nikita Popov
d9680272c7 Revert "Drop free_filename field from zend_file_handle"
This reverts commit e0eca26285.

free_filename is used by the wincache extension, restore this
field for PHP 7.4.
2019-07-24 10:43:37 +02:00
Nikita Popov
36db71df47 Merge branch 'PHP-7.4' 2019-07-22 12:28:40 +02:00
Nikita Popov
e41b7f6db4 Deprecate (real) cast 2019-07-22 11:39:52 +02:00
Nikita Popov
c4a6998c62 Merge branch 'PHP-7.4' 2019-07-16 17:45:03 +02:00
Nikita Popov
e0eca26285 Drop free_filename field from zend_file_handle
free_filename was always zero.
2019-07-16 17:07:26 +02:00
Nikita Popov
3faa903d47 Merge branch 'PHP-7.4' 2019-07-16 16:44:46 +02:00
Nikita Popov
49bac9b77b Introduce zend_stream_init_filename()
Avoid more ad-hoc initialization of zend_file_handle structures.
2019-07-16 16:44:37 +02:00
Nikita Popov
ce972ba349 Merge branch 'PHP-7.4' 2019-07-16 11:54:40 +02:00
Nikita Popov
c9acc90186 Support <?php followed by EOF
This is an annoying edge-case for canonicalization.
2019-07-16 11:53:48 +02:00
Nikita Popov
90d5276e1b Merge branch 'PHP-7.4' 2019-07-15 17:29:45 +02:00
Nikita Popov
fcdb12ed4d Combine SKIP_TOKEN+RETURN_TOKEN into one macro 2019-07-15 17:29:27 +02:00
Nikita Popov
9207aef60c Merge branch 'PHP-7.4' 2019-07-15 16:26:25 +02:00
Nikita Popov
c5f1b384b5 Move shebang handling into the lexer
Instead of handling shebang lines by adjusting the file pointer in
individual SAPIs, move the handling into the lexer, where this is
both a lot simpler and more robust. Whether the shebang should be
skipped is controlled by CG(skip_shebang) -- we might want to do
that in more cases.

This fixed bugs #60677 and #78066.
2019-07-15 16:25:49 +02:00
Nikita Popov
193bcf9650 Merge branch 'PHP-7.4' 2019-07-15 12:52:18 +02:00
Nikita Popov
9ad094e371 Emit T_BAD_CHARACTER for unexpected characters
Avoid having holes in the token stream which are annoying and
inefficient to reconstruct on the consumer side.
2019-07-15 12:51:01 +02:00
Peter Kokot
930e38ec5c Merge branch 'PHP-7.4'
* PHP-7.4:
  Remove tsrm_config_common.h
2019-07-13 01:58:38 +02:00
Peter Kokot
33994ebd95 Remove tsrm_config_common.h
- Checks and defines are not relevant for files that include it anymore
- Some code is not used anymore
- Defines are a bit duplicated in zend_portability.h and TSRM.h file
- MAXPATHLEN defs moved to zend_virtual_cwd.h
2019-07-13 01:58:01 +02:00
Nikita Popov
a89b959320 Merge branch 'PHP-7.4' 2019-07-12 17:22:58 +02:00
Nikita Popov
0d568b9fd5 Don't split T_INLINE_HTML at partial PHP tag
If <?php occurs without required trailing whitespace, we should keep
it as part of a single T_INLINE_HTML region.
2019-07-12 17:22:11 +02:00