Commit Graph

1203 Commits

Author SHA1 Message Date
Ilija Tovilo
9a90bd7054
Deprecate ${} string interpolation
https://wiki.php.net/rfc/deprecate_dollar_brace_string_interpolation
2022-05-05 10:14:56 +02:00
George Peter Banyard
b5db594fd2
Refacto php_module_startup() (#8303)
It only ever uses at most 1 additional modules
2022-04-27 23:07:11 +01:00
Max Kellermann
d87ba95acd
sapi/*: move duplicate "--define" code to library 2022-04-18 16:52:08 +02:00
istiak101
bf2867bc72
Fix FSF address & update year to 2022
FSF mailing address was changed long time ago. This patch updates that address. Also updated year from 2021 to 2022.

Closes GH-8009.
2022-03-19 18:25:29 +01:00
Remi Collet
bc9d604430
Merge branch 'PHP-8.1'
* PHP-8.1:
  fix [-Wstrict-prototypes] buid warnings
2021-11-24 14:55:30 +01:00
Remi Collet
ef2fd0e5b5
fix [-Wstrict-prototypes] buid warnings 2021-11-24 14:55:11 +01:00
Nikita Popov
3ded2db0d2 Merge branch 'PHP-8.1'
* PHP-8.1:
  Update reflection test after stub change
2021-11-18 11:16:51 +01:00
Nikita Popov
36d2d27980 Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Update reflection test after stub change
2021-11-18 11:16:35 +01:00
Nikita Popov
e81ad637f4 Update reflection test after stub change 2021-11-18 11:16:13 +01:00
Nikita Popov
edc02d2d94 Merge branch 'PHP-8.1'
* PHP-8.1:
  Implement Stringable automatically for internal classes
2021-11-05 10:24:07 +01:00
Nikita Popov
b0ec6223e2 Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Implement Stringable automatically for internal classes
2021-11-05 10:23:23 +01:00
Nikita Popov
b302bfabe7 Implement Stringable automatically for internal classes
Requiring all internal classes (including those from 3rd-party
extensions) to implement Stringable if they provide __toString()
is too error prone. Case in point, our _ZendTestClass test class
was not doing so, resulting in preloading test failures after
recent changes.

Instead we automatically implement Stringable, the same as we do
for userland classes. We still allow explicit implementations,
but ignore them (normally they would result in an error due to
duplicate interface implementation). Finally, we need to be
careful about not trying to implement Stringable on Stringable
itself.

In some cases this changes the interface order, in particular the
automatic Stringable implementation will now come first.
2021-11-05 10:22:04 +01:00
Dmitry Stogov
90b7bde615 Use more compact representation for packed arrays.
- for packed arrays we store just an array of zvals without keys.
- the elements of packed array are accessible throuf as ht->arPacked[i]
  instead of ht->arData[i]
- in addition to general ZEND_HASH_FOREACH_* macros, we introduced similar
  familied for packed (ZEND_HASH_PACKED_FORECH_*) and real hashes
  (ZEND_HASH_MAP_FOREACH_*)
- introduced an additional family of macros to access elements of array
  (packed or real hashes) ZEND_ARRAY_ELEMET_SIZE, ZEND_ARRAY_ELEMET_EX,
  ZEND_ARRAY_ELEMET, ZEND_ARRAY_NEXT_ELEMENT, ZEND_ARRAY_PREV_ELEMENT
- zend_hash_minmax() prototype was changed to compare only values

Because of smaller data set, this patch may show performance improvement
on some apps and benchmarks that use packed arrays. (~1% on PHP-Parser)

TODO:
    - sapi/phpdbg needs special support for packed arrays (WATCH_ON_BUCKET).
    - zend_hash_sort_ex() may require converting packed arrays to hash.
2021-11-03 15:18:26 +03:00
Nikita Popov
a1285978d4 Merge branch 'PHP-8.1'
* PHP-8.1:
  Print array defaults in reflection
2021-10-20 15:17:08 +02:00
Nikita Popov
fb5cff1272 Print array defaults in reflection
As a followup to f34114b1fb print
the contents of arrays rather than just a generic "Array" marker.
Also drop the truncation on strings. As we no longer resolve
constants, there should be less concerns about printing very
large strings here. If someone thought it was a good idea to use
a 10k character strings as a default value in code, then it should
be fine for us to print it in reflection as well.
2021-10-20 15:16:29 +02:00
Joe Watkins
e829284b53
Merge branch 'PHP-8.1'
* PHP-8.1:
  Fix #81496: CLI server logs wrong request method
2021-10-05 08:43:38 +02:00
Joe Watkins
03e9bed5b5
Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Fix #81496: CLI server logs wrong request method
2021-10-05 08:43:09 +02:00
Lauri Kenttä
cdcdb33080
Fix #81496: CLI server logs wrong request method 2021-10-05 08:42:38 +02:00
Nikita Popov
28e882a162 Fix null pointer ubsan warning
Don't pass null pointer to memmove, even with zero length.
2021-09-17 10:25:52 +02:00
Nikita Popov
62503236d5 Make it easier to run CLI server tests standalone 2021-09-17 10:15:35 +02:00
Christoph M. Becker
be2df43b08
Fix #78919: CLI server: insufficient cleanup if request startup fails
We need to run the full `php_cli_server_request_shutdown()` in case of
failing `php_cli_server_request_startup()`.

Patch contributed by @cataphract.

Closes GH-7322.
2021-08-17 12:41:06 +02:00
Christoph M. Becker
4645a9d10f
Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #81305: Built-in Webserver Drops Requests With "Upgrade" Header
2021-07-29 13:28:52 +02:00
Christoph M. Becker
92b1c17417
Merge branch 'PHP-8.0'
* PHP-8.0:
  Fix #81305: Built-in Webserver Drops Requests With "Upgrade" Header
2021-07-29 13:21:05 +02:00
Christoph M. Becker
3b461d93e1
Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #81305: Built-in Webserver Drops Requests With "Upgrade" Header
2021-07-29 13:19:04 +02:00
Christoph M. Becker
d1ccb5bd0c
Fix #81305: Built-in Webserver Drops Requests With "Upgrade" Header
While our HTTP parser supports upgrade requests, the code using it does
not.  Since upgrade requests are only valid for HTTP/1.1 and we neither
support any higher version, nor HTTPS yet, we do not exit early in case
of such requests, i.e. we ignore them, what is allowed by the specs.

We keep the supporting code in case we can meaningfully support upgrade
requests in the future.

Closes GH-7316.
2021-07-29 13:16:15 +02:00
Máté Kocsis
75a678a7e3
Declare tentative return types for Zend (#7251)
Co-authored-by: Nikita Popov <nikita.ppv@gmail.com>
2021-07-19 13:44:20 +02:00
Christoph M. Becker
be5fd30d54
Fix Windows debug builds
`ZEND_ATOL` doesn't accept a size argument.
2021-07-16 00:41:38 +02:00
Christoph M. Becker
497858a043
Merge branch 'PHP-8.0'
* PHP-8.0:
  exit_status is no longer a true global
2021-07-12 23:40:16 +02:00
Christoph M. Becker
1631b96b4b
exit_status is no longer a true global 2021-07-12 23:39:10 +02:00
Christoph M. Becker
057d2f2a00
Merge branch 'PHP-8.0'
* PHP-8.0:
  Fix #73226: --r[fcez] always return zero exit code
2021-07-12 23:14:15 +02:00
Christoph M. Becker
0c0ecf0470
Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #73226: --r[fcez] always return zero exit code
2021-07-12 23:12:19 +02:00
Christoph M. Becker
9db3eda2cb
Fix #73226: --r[fcez] always return zero exit code
This makes the behavior consistent with `--ri`, and is likely useful
for scripting.

Closes GH-7221.
2021-07-12 23:09:28 +02:00
Nikita Popov
989205e95c Remove incorrect uses of zend_atoi()
zend_atoi() parses integers with size suffixes (like "128M").
These just want to use a plain number, so use ZEND_ATOL instead.
2021-07-12 16:56:00 +02:00
Nikita Popov
efbb2198d4 Return value from ZEND_ATOL
Instead of assigning it as part of the macro itself, which makes
usage quite awkward.
2021-07-12 16:51:24 +02:00
Christoph M. Becker
970a909caf
Merge branch 'PHP-8.0'
* PHP-8.0:
  Fix new test for PHP 8
2021-06-30 16:50:28 +02:00
Christoph M. Becker
9b7b4c47d6
Fix new test for PHP 8 2021-06-30 16:48:31 +02:00
Christoph M. Becker
0189c8b740
Merge branch 'PHP-8.0'
* PHP-8.0:
  Fix #73630: Built-in Weberver - overwrite $_SERVER['request_uri']
2021-06-30 16:17:02 +02:00
Christoph M. Becker
70b0330e53
Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #73630: Built-in Weberver - overwrite $_SERVER['request_uri']
2021-06-30 16:15:50 +02:00
Christoph M. Becker
d7db5701a3
Fix #73630: Built-in Weberver - overwrite $_SERVER['request_uri']
The built-in Webserver's `on_path`, `on_query_string` and `on_url`
callbacks may be called multiple times from the parser; we must not
simply replace the old values, but need to concatenate the new values
instead.

This appears to be tricky for `on_path` due to the path normalization,
so we fail if the function is called again.

The built-in Webserver logs errors during request parsing to stderr,
but this is ignored by the php_cli_server framework, and apparently the
Webserver does not send a resonse at all in such cases (instead of an
4xx).  Thus we can only check that a request with an overly long path
fails.

Closes GH-7207.
2021-06-30 16:13:08 +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
Nikita Popov
1af891306a Fix upload_2G test
Include the new full_path key. This test is skipped on CI but
fails locally.
2021-05-21 16:02:40 +02:00
Nikita Popov
959e5787bd Disable -a mode without readline
To avoid confusing, as -a without readline is not actually
interactive.

Discussion: https://externals.io/message/114426

Closes GH-6976.
2021-05-14 12:10:46 +02:00
Björn Tantau
d764f1dc12
Fix #77372: Retain full path of files for directory uploads (#6917)
To fix https://bugs.php.net/bug.php?id=77372 and improve support of `<input type="file" name="files" multiple webkitdirectory>` I introduced another item to the `$_FILES` array called `full_path`, containing the full filename, as supplied by the user-agent.

Co-authored-by: Björn Tantau <bjoern@bjoern-tantau.de>
2021-05-14 11:43:55 +02:00
George Peter Banyard
c40231afbf
Mark various functions with void arguments.
This fixes a bunch of [-Wstrict-prototypes] warning,
because in C func() and func(void) have different semantics.
2021-05-12 14:55:53 +01:00
Nikita Popov
07061482a0 Fix segfault in php -a without readline 2021-05-11 11:39:04 +02: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
Michael Voříšek
4d78598e8e Remove spaces around version built type 2021-04-27 10:12:28 +02:00
Christoph M. Becker
3bb62eee5b
Merge branch 'PHP-8.0'
* PHP-8.0:
  Fix #67792: HTTP Authorization schemes are treated as case-sensitive
2021-04-23 15:58:21 +02:00