Commit graph

299 commits

Author SHA1 Message Date
Joe Watkins
1143155fcb
fix bug #72998
the function fn_complete in libedit null checks matches[2]
2021-06-03 10:33:10 +02:00
Christoph M. Becker
8ae02c8a95 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Avoid modifying the return value of readline_completion_function()
2021-01-07 13:48:17 +01:00
Christoph M. Becker
9450893dc6 Avoid modifying the return value of readline_completion_function()
The internal function `_readline_command_generator()` modifies the
internal array pointer of `readline_completion_function()`'s return
value.  We therefore separate the array, what also avoids failing
assertions regarding the array refcount.

Closes GH-6582.
2021-01-07 13:46:09 +01:00
Máté Kocsis
26af806828
Review parameter names in ext/readline
Closes GH-6240
2020-09-30 10:10:28 +02:00
Nikita Popov
c5401854fc Run tidy
This should fix most of the remaining issues with tabs and spaces
being mixed in tests.
2020-09-18 14:28:32 +02:00
Tyson Andre
1fc961e2de Improve handling of #[ attributes in php -a
`php -a` treats lines starting with `#` as comments when deciding if
the provided statement is valid.

So it passed `#[MyAttr]` to the parser after the user hits enter,
causing a syntax error for multi-line statements..

With this patch, the following snippet is parsed correctly

```
php > #[Attr]
php > function x() { }
php > var_export((new ReflectionFunction('x'))->getAttributes()[0]->getName());
'Attr'
```

Followup to GH-6085

Closes GH-6086
2020-09-06 10:40:26 -04:00
Tyson Andre
9439ca5322 Improve handling of #[ in php -a
PHP treats `#ini_setting=value` as a call to
`ini_set('ini_setting', 'value')`,
and silently skips undeclared settings.

This is a problem due to `#[` becoming supported attribute syntax:

- `#[Attr] const X = 123;` (this is not a valid place to put an attribute)
  This does not create a constant.
- `#[Attr] function test($x=false){}` also contains `=`.
  This does not create a function.

Instead, only treat lines starting with `#` as a special case
when the next character isn't `[`

Closes GH-6085
2020-09-05 17:33:20 -04:00
Tyson Andre
97f10fc341 Allow overriding completion in auto_prepend_file
Currently, it's possible to override `php -a`s completion
functionality to provide an alternative to the C implementation,
with `readline_completion_function()`.

However, that surprisingly gets overridden when called from
`auto_prepend_file`, because those scripts get run before the interactive shell
is started. I believe that not overriding it would be more consistent
with what happens when you override the completion function **after** the
interactive shell.

CLI is the only built-in API that uses this (See discussion in GH-5872).
I believe MINIT and RINIT will only run once when invoked with `php -a`.

Add documentation about the architecture of how php uses readline/libedit

Closes GH-5872
2020-08-01 11:39:08 -04:00
Nikita Popov
da4262df6f Fix readline test after callback changes
This one requires libedit and was probably missed for that reason.
2020-07-21 10:40:08 +02:00
George Peter Banyard
d9330fc67e Use ZPP callable check in readline extension 2020-07-21 00:52:50 +01:00
Máté Kocsis
d30cd7d7e7
Review the usage of apostrophes in error messages
Closes GH-5590
2020-07-10 21:05:28 +02:00
Max Semenik
2b5de6f839
Remove proto comments from C files
Closes GH-5758
2020-07-06 21:13:34 +02:00
Fabien Villepinte
0c6d06ecfa Replace EXPECTF when possible
Closes GH-5779
2020-06-29 21:31:44 +02:00
Nikita Popov
c9b9f525a9 Include stub hash in generated arginfo files
The hash is used to check whether the arginfo file needs to be
regenerated. PHP-Parser will only be downloaded if this is actually
necessary.

This ensures that release artifacts will never try to regenerate
stubs and thus fetch PHP-Parser, as long as you do not modify any
files.

Closes GH-5739.
2020-06-24 09:55:19 +02:00
Máté Kocsis
8d93ae1a23
Fix UNKNOWN default values in ext/readline
Closes GH-5755
2020-06-23 12:52:12 +02:00
Nikita Popov
f7a3cb4c39 Avoid convert_to_long_ex usage in readline 2020-06-23 12:35:51 +02:00
Nikita Popov
4f260411d1 Merge branch 'PHP-7.4' 2020-06-17 17:14:05 +02:00
Nikita Popov
9b3e57921f Suppress zend signals check in two readline tests
Installing a callback handler may cause libedit to register new
signals during the request.
2020-06-17 17:13:01 +02:00
Alex Dowad
8ddaf13ed3 Code tweaks: Remove unneeded semicolons 2020-04-29 23:17:40 +02:00
Máté Kocsis
3709e74b5e
Store default parameter values of internal functions in arg info
Closes GH-5353. From now on, PHP will have reflection information
about default values of parameters of internal functions.

Co-authored-by: Nikita Popov <nikita.ppv@gmail.com>
2020-04-08 18:37:51 +02:00
Máté Kocsis
21cfa03f17
Generate function entries for another batch of extensions
Closes GH-5352
2020-04-05 21:15:30 +02:00
Christoph M. Becker
b31f73b1c8 Merge branch 'PHP-7.4'
* PHP-7.4:
  Enclose INI values containing {TMP} in quotes
2020-03-09 22:53:23 +01:00
Christoph M. Becker
fea2994ff8 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Enclose INI values containing {TMP} in quotes
2020-03-09 22:51:11 +01:00
Christoph M. Becker
d5e206620b Enclose INI values containing {TMP} in quotes
At least on Windows, the temporary directory may contain tilde signs,
which would result in an INI parse error.
2020-03-09 22:49:08 +01:00
Nikita Popov
f8d795820e Reindent phpt files 2020-02-03 22:52:20 +01:00
Máté Kocsis
7b4a4d2ace
Use RETURN_THROWS() after try_convert_to_string() 2020-01-03 17:04:06 +01:00
Máté Kocsis
345703724c
Use RETURN_THROWS() during ZPP in most of the extensions
Except for some bigger ones: reflection, sodium, spl
2019-12-31 11:46:11 +01:00
Máté Kocsis
27e83d0fb8
Add union return types for function stubs 2019-11-11 14:54:55 +01:00
Máté Kocsis
9493893412 Cleanup return values when parameter parsing is unsuccessful 2019-10-30 16:05:20 +01:00
Nikita Popov
235983dfde Merge branch 'PHP-7.4' 2019-09-30 17:52:39 +02:00
Fabien Villepinte
0aa3acc6c4 Fix borked SKIPIFs 2019-09-30 17:51:41 +02:00
Gabriel Caruso
5d6e923d46
Remove mention of PHP major version in Copyright headers
Closes GH-4732.
2019-09-25 14:51:43 +02:00
Nikita Popov
9ca21b9d0a Merge branch 'PHP-7.4' 2019-09-11 11:13:33 +02:00
Nikita Popov
f945c82ec6 Free history_get_history_state() result
It's not documented, but per https://bugs.python.org/issue8065
the result is freshly malloc'd and needs to be freed.
2019-09-11 10:59:04 +02:00
Nikita Popov
0c2d4d698c Make sure that params with null default are marked nullable 2019-08-26 14:34:28 +02:00
Christoph M. Becker
9f14eb114b Fix bug77812-*.phpt
Undefined constants error as of PHP 8.0.0.
2019-08-23 14:49:50 +02:00
Christoph M. Becker
aa3f9c5f1c Merge branch 'PHP-7.4'
* PHP-7.4:
  Fix #77812: Interactive mode does not support PHP 7.3-style heredoc
2019-08-23 14:04:52 +02:00
Christoph M. Becker
514be3ff87 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #77812: Interactive mode does not support PHP 7.3-style heredoc
2019-08-23 14:04:31 +02:00
Christoph M. Becker
03c7749dc8 Fix #77812: Interactive mode does not support PHP 7.3-style heredoc
As of PHP 7.3.0, the rules regarding the heredoc and nowdoc closing
identifier have been relaxed.  While formerly, the closing identifier
was required to be placed at the beginning of a line and to be
immediately followed by (a semicolon and) a line break, it may now be
preceeded by whitespace, and may be followed by any non-word character.
We adjust the recognition logic respectively.
2019-08-23 13:59:10 +02:00
Stephen Reay
0b3a10aecc Add readline arginfo stubs 2019-08-12 16:03:26 +02:00
Christoph M. Becker
cd57fb5140 Merge branch 'PHP-7.4'
* PHP-7.4:
  Add missing argument checks
2019-08-12 15:42:26 +02:00
Christoph M. Becker
b1189b18d2 Add missing argument checks
These functions don't expect any arguments, so we should check that
none are given.
2019-08-12 15:36:35 +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
7686b0b889 Merge branch 'PHP-7.4' 2019-06-05 14:53:50 +02:00
Nikita Popov
a31f46421d Allow exceptions in __toString()
RFC: https://wiki.php.net/rfc/tostring_exceptions

And convert some object to string conversion related recoverable
fatal errors into Error exceptions.

Improve exception safety of internal code performing string
conversions.
2019-06-05 14:25:07 +02:00
Christoph M. Becker
77f02cda53 Merge branch 'PHP-7.4'
* PHP-7.4:
  use {TMP} placeholder in phpt tests
2019-05-21 09:03:51 +02:00
Christoph M. Becker
c982a4c3f9 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  use {TMP} placeholder in phpt tests
2019-05-21 09:03:20 +02:00
Christoph M. Becker
11740abd6b Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  use {TMP} placeholder in phpt tests
2019-05-21 09:03:01 +02:00
Holly Li (WIPRO LIMITED)
202e6936d6 use {TMP} placeholder in phpt tests 2019-05-21 09:02:37 +02:00