Commit Graph

118174 Commits

Author SHA1 Message Date
Máté Kocsis
c5fb4f0794
Generate function entries from stubs for a couple of extensions
Migrates ext/standard, ext/tidy, ext/tokenizer,
ext/xml, ext/xml_reader, and ext/xml_writer. Closes GH-5381.
2020-04-14 11:49:02 +02:00
Alex Dowad
80598f1250 Syntax errors caused by unclosed {, [, ( mention specific location
Aside from a few very specific syntax errors for which detailed exceptions are
thrown, generally PHP just emits the default error messages generated by bison on syntax
error. These messages are very uninformative; they just say "Unexpected ... at line ...".

This is most problematic with constructs which can span an arbitrary number of lines, such
as blocks of code delimited by { }, 'if' conditions delimited by ( ), and so on. If a closing
delimiter is missed, the block will run for the entire remainder of the source file (which
could be thousands of lines), and then at the end, a parse error will be thrown with the
dreaded words: "Unexpected end of file".

Therefore, track the positions of opening and closing delimiters and ensure that they match
up correctly. If any mismatch or missing delimiter is detected, immediately throw a parse
error which points the user to the offending line. This is best done in the *lexer* and not
in the parser.

Thanks to Nikita Popov and George Peter Banyard for suggesting improvements.

Fixes bug #79368.
Closes GH-5364.
2020-04-14 11:22:23 +02:00
Nikita Popov
d4471c6aae Remove int6store()
The implementation is broken (syntactically). As it's not used
anyway, I'm just dropping it instead.
2020-04-14 10:37:37 +02:00
Christoph M. Becker
5951ff7ee5 Merge branch 'PHP-7.4'
* PHP-7.4:
  Add NEWS entries [ci skip]
2020-04-14 08:57:29 +02:00
Christoph M. Becker
a76b3358e4 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Add NEWS entries [ci skip]
2020-04-14 08:56:09 +02:00
Christoph M. Becker
8967588702 Add NEWS entries [ci skip] 2020-04-14 08:54:00 +02:00
Stanislav Malyshev
d3fbdf0048 Merge branch 'PHP-7.4'
* PHP-7.4:
  Fix bug #79465 - use unsigneds as indexes.
  Fix bug #79330 - make all execution modes consistent in rejecting \0
2020-04-13 21:09:23 -07:00
Stanislav Malyshev
864d69bef7 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix bug #79465 - use unsigneds as indexes.
  Fix bug #79330 - make all execution modes consistent in rejecting \0
2020-04-13 21:09:15 -07:00
Stanislav Malyshev
d539e61c30 Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Fix bug #79465 - use unsigneds as indexes.
  Fix bug #79330 - make all execution modes consistent in rejecting \0
2020-04-13 21:09:08 -07:00
Stanislav Malyshev
9d6bf8221b Fix bug #79465 - use unsigneds as indexes. 2020-04-13 21:08:37 -07:00
Stanislav Malyshev
14fcc81394 Fix bug #79330 - make all execution modes consistent in rejecting \0 2020-04-13 21:08:30 -07:00
George Peter Banyard
8300458814 Fix [-Wchar-subscripts] in Hash extension
Use size_t type instead of char for string index.
Char may be unsigned on some platforms.

partial fix to bug 79431
2020-04-13 23:03:31 +02:00
George Peter Banyard
446724bcd9 Fix [-Werror=missing-braces] compiler warning
Partial fix to bug 79431
2020-04-13 23:03:31 +02:00
Máté Kocsis
1bba691ecc
Generate method entries for ext/session and ext/reflection
Closes GH-5376
2020-04-13 13:04:06 +02:00
Máté Kocsis
dfd0acf0d7
Generate method entries for ext/dom
Closes GH-5374
2020-04-13 00:13:11 +02:00
George Peter Banyard
422c8390a0 Fix [-Wempty-body] compiler warning in Phar extension 2020-04-12 21:10:03 +02:00
George Peter Banyard
01762e56ed Adapt assertion as mbfl_strwidth returns a size_t 2020-04-12 19:34:05 +02:00
Máté Kocsis
68a56483ea
Generate method entries for ext/xsl
Closes GH-5372
2020-04-12 10:18:21 +02:00
Máté Kocsis
e088836bbc
Fix nullable types in PHPDoc 2020-04-12 00:25:33 +02:00
Tyson Andre
047d814704 Fix an undefined class error running gen_stub in php8
For whatever reason, php 8 would not have loaded the subsequent classes when
running `php build/gen_stub.php path/to/filename.php`.
I assume it didn't load the classes immediately because there's a possibility
the code before it would throw.
(Probably because __toString was added recently and prevents early binding)

Also, fix a typo

Closes GH-5369
2020-04-11 17:17:28 -04:00
Máté Kocsis
7b2a8a6dda
Lowercase NULL to null in stubs 2020-04-11 14:13:11 +02:00
Máté Kocsis
3fe49d81f8
Generate method entries from stubs for a couple of extensions
Closes GH-5368
2020-04-11 13:28:53 +02:00
Máté Kocsis
ca006e54e3
Add missing visibility modifiers in stubs 2020-04-11 10:23:51 +02:00
Máté Kocsis
1d05771a70
Add support for generating method entries from stubs
Closes GH-5363
2020-04-11 09:15:14 +02:00
Máté Kocsis
fe9860c2b0
Improve the default value format in incompatible signature error messages
Closes GH-5361
2020-04-10 22:50:33 +02:00
Máté Kocsis
4aa137c6a6
Fix the default value of the $length parameter of grapheme_substr() 2020-04-10 18:17:18 +02:00
Máté Kocsis
ce3b49a8e8
Fix default value of the $class_name parameter of mysqli_fetch_object() 2020-04-10 18:17:18 +02:00
Máté Kocsis
7a72e1cc7a
Fix the default value of the $flags parameter of mysqli_begin_transaction() 2020-04-10 18:17:18 +02:00
Máté Kocsis
481c8c2958
Add missing parameter to the stub of mysqli_real_connect 2020-04-10 18:17:18 +02:00
George Peter Banyard
3eba187b15 Refactor and remove dead code in mb_ereg(i)_replace
We do not support the 'e' option anymore.
Merged together code which would emit an error if this option is present.
This also makes it clearer that the whole branch in the replacement section supporting this option is never hit, thus removed.
2020-04-10 17:56:05 +02:00
Máté Kocsis
beff93f60d
Fix the default parameter values of stream_socket_client()
$timeout and $flags were mixed up
2020-04-10 17:17:12 +02:00
Máté Kocsis
5868aced2e
Fix the default parameter values of session_set_save_handler()
Co-Authored-By: Christoph M. Becker <cmbecker69@gmx.de>
2020-04-10 17:07:26 +02:00
Dmitry Stogov
0a408be0d2 Separate zend_jit_dump_lifetime_interval() function 2020-04-10 16:10:19 +03:00
Dmitry Stogov
d3dda1e0f1 Fixed overflow handling 2020-04-10 14:42:26 +03:00
Dmitry Stogov
66f2ebe448 Register allocator refactoring 2020-04-09 19:31:18 +03:00
Nikita Popov
fcc6da3e42 Mark $time argument of touch() as UNKNOWN as well
For some reason I thought that passing 0 is same as current time,
but that's not the case.
2020-04-09 16:54:42 +02:00
Nikita Popov
c10f30fdf9 Mark spl_autoload_register function arg as UNKNOWN
Not passing any parameters to this function has magic behavior.
2020-04-09 16:54:40 +02:00
Nikita Popov
8a5b9cbc9f Fix mysqli_get_client_info() stub
The dummy link argument is not nullable.
2020-04-09 16:54:39 +02:00
Nikita Popov
636c827aa2 Mark fgets() argument as UNKNOWN
If no value is passed, this reads as much as necessary, not 1024
bytes.
2020-04-09 16:22:34 +02:00
Christoph M. Becker
62e8dcbc48 Change parameter default to always available value
`SIGTERM` is only defined in ext/pcntl, and as such never available on
Windows.  Moving the constant to ext/standard does not make much sense,
because that parameter is actually unused on Windows.  Therefore, we
use the magic number `15` instead, what is also done in the PHP manual.
2020-04-09 16:15:47 +02:00
Nikita Popov
87ba975e31 Make touch() $atime parameter UNKNOWN
The actual default here is $time, not 0.
2020-04-09 16:11:17 +02:00
Nikita Popov
258c4dfdb2 Mark rand/mt_rand args as UNKNOWN
The second argument should be mt_getrandmax(), not PHP_INT_MAX.
Additionally this function only accepts either zero or two arguments,
so err on the side of being conservative and mark both UNKNOWN.
2020-04-09 16:10:56 +02:00
Nikita Popov
1dcb559664 Mark array_walk $userdata arg as UNKNOWN
It makes a difference whether this arg is not passed or is null.
2020-04-09 16:10:39 +02:00
Nikita Popov
b3f3a80f9c Make stream_socket_enable_crypto() session stream nullable 2020-04-09 16:10:33 +02:00
Nikita Popov
217dfc0832 Accept null context in stream_socket_(client|server) 2020-04-09 16:10:27 +02:00
Nikita Popov
2d1bf6970d Add Z_PARAM_RESOURCE_OR_NULL()
As a more explicit alternative to Z_PARAM_RESOURCE_EX(, 1, 0).
2020-04-09 15:39:11 +02:00
Nikita Popov
d030ddb2cd Export the zend_string_concat3() API 2020-04-09 15:06:53 +02:00
Nikita Popov
696ae335e3 Export API for fetching internal func default
Make this functionality available outside reflection.
2020-04-09 14:55:55 +02:00
Christoph M. Becker
175e5ed4bf Fix typo (UNKOWN -> UNKNOWN) 2020-04-09 14:06:11 +02:00
George Peter Banyard
12ec7a2730 Convert if blocks to assertions and adapt stubs accordingly 2020-04-09 13:50:37 +02:00