Commit Graph

324 Commits

Author SHA1 Message Date
Gina Peter Banyard
0accfd1fe1
ext/readline: Fix [-Wcalloc-transposed-args] compiler warning
Closes GH-14280
2024-05-21 12:17:25 +01:00
Niels Dossche
217b753a3d
Fix GH-14189: PHP Interactive shell input state incorrectly handles quoted heredoc literals.
Only `'` was handled, no handling case for `"` existed. Simply add it so
the heredoc tag is set up correctly.

Closes GH-14195.
2024-05-10 16:48:26 +02:00
Ilija Tovilo
b47a7d466b
Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  [skip ci] Fix race condition in readline test
2023-05-26 11:39:47 +02:00
Ilija Tovilo
b5a07a7501
[skip ci] Fix race condition in readline test
The var_dump can be preceded by the "Interactive shell" log. The var_dump does
not add much to the test anyway, so just remove it.
2023-05-26 11:39:22 +02:00
Máté Kocsis
b4ec3e9bc0
Do not generate CONST_CS when registering constants (#9439) 2022-08-28 08:27:19 +02:00
Máté Kocsis
c854816b65
Declare ext/readline constants in stubs (#9110) 2022-07-23 12:33:44 +02:00
Máté Kocsis
c8f858ef49
Add more specific array return type hints for various extensions - part 4 (#7469) 2021-09-06 17:14:52 +02:00
Máté Kocsis
d379044066
Generate a few missing optimizer function entries from stubs 2021-08-25 10:37:43 +02:00
Joe Watkins
a2e051921a
Fix bug #81280 refuse to allow unicode chars in prompts 2021-08-11 10:35:00 +02:00
Patrick Allaert
aff365871a Fixed some spaces used instead of tabs 2021-06-29 11:30:26 +02:00
Nikita Popov
39131219e8
Migrate more SKIPIF -> EXTENSIONS (#7139)
This is a mix of more automated and manual migration. It should remove all applicable extension_loaded() checks outside of skipif.inc files.
2021-06-11 12:58:44 +02:00
Nikita Popov
7485978339
Migrate SKIPIF -> EXTENSIONS (#7138)
This is an automated migration of most SKIPIF extension_loaded checks.
2021-06-11 11:57:42 +02:00
Joe Watkins
5c3cb3583b
Merge branch 'PHP-8.0'
* PHP-8.0:
  fix bug #72998
2021-06-03 10:34:00 +02:00
Joe Watkins
1143155fcb
fix bug #72998
the function fn_complete in libedit null checks matches[2]
2021-06-03 10:33:10 +02:00
George Peter Banyard
96adc806e0
Add -Wstrict-prototypes compiler warning
Disable it for the following extensions:
 - GD
 - pspell
 - readline

Closes GH-5888
2021-05-12 19:02:48 +01:00
George Peter Banyard
ff988a6f4f
Fix remaining [-Wstrict-prototypes] warnings
Two missing void qualifiers for parameter list.
2021-05-12 19:02:48 +01:00
KsaR
01b3fc03c3
Update http->https in license (#6945)
1. Update: http://www.php.net/license/3_01.txt to https, as there is anyway server header "Location:" to https.
2. Update few license 3.0 to 3.01 as 3.0 states "php 5.1.1, 4.1.1, and earlier".
3. In some license comments is "at through the world-wide-web" while most is without "at", so deleted.
4. fixed indentation in some files before |
2021-05-06 12:16:35 +02:00
George Peter Banyard
09efad615b
Use zend_string_equals_(literal_)ci() API more often
Also drive-by usage of zend_ini_parse_bool()

Closes GH-6844
2021-04-09 02:34:50 +01:00
George Peter Banyard
5caaf40b43
Introduce pseudo-keyword ZEND_FALLTHROUGH
And use it instead of comments
2021-04-07 00:46:29 +01:00
Dmitry Stogov
c732ab400a Change Zend Stream API to use zend_string* instead of char*.
This allows to eliminate re-calculation of string lenght and hash value.
See the detailed list of changes in UPGRADING.INTERNALS.
2021-03-16 20:31:36 +03:00
Máté Kocsis
bf0f6aaf18
Improve class entry generation
Related to GH-6701
2021-02-16 13:09:56 +01:00
Máté Kocsis
5b5bfd6be4
Generate class entries from stubs for phar, posix, pspell, readline, reflection, session, shmop
Closes GH-6692
2021-02-15 00:11:22 +01:00
Nikita Popov
b10416a652 Deprecate passing null to non-nullable arg of internal function
This deprecates passing null to non-nullable scale arguments of
internal functions, with the eventual goal of making the behavior
consistent with userland functions, where null is never accepted
for non-nullable arguments.

This change is expected to cause quite a lot of fallout. In most
cases, calling code should be adjusted to avoid passing null. In
some cases, PHP should be adjusted to make some function arguments
nullable. I have already fixed a number of functions before landing
this, but feel free to file a bug if you encounter a function that
doesn't accept null, but probably should. (The rule of thumb for
this to be applicable is that the function must have special behavior
for 0 or "", which is distinct from the natural behavior of the
parameter.)

RFC: https://wiki.php.net/rfc/deprecate_null_to_scalar_internal_arg

Closes GH-6475.
2021-02-11 21:46:13 +01:00
Nikita Popov
422d1665a2 Make convert_to_*_ex simple aliases of convert_to_*
Historically, the _ex variants separated the zval first, if a
conversion was necessary. This distinction no longer makes sense
since PHP 7.

The only difference that was still left is that _ex checked whether
the type is the same first, but the usage of these macros did not
actually distinguish on whether such an inlined check is valuable
or not in a given context.

Also drop the unused convert_to_explicit_type macros.
2021-01-14 12:11:11 +01:00
Christoph M. Becker
c5812389b8 Merge branch 'PHP-8.0'
* PHP-8.0:
  Avoid modifying the return value of readline_completion_function()
2021-01-07 13:49:02 +01: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
Nikita Popov
1b3b430f47 Add --repeat testing mode
This testing mode executes the test multiple times in the same
process (but in different requests). It is primarily intended to
catch tracing JIT bugs, but also catches state leaks across
requests.

Closes GH-6365.
2020-10-30 17:29:33 +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