Commit Graph

1239 Commits

Author SHA1 Message Date
Benoit Viguier
58fc34ffb7
Fix memory-leak in CLI web server
Closes GH-9680

Signed-off-by: George Peter Banyard <girgias@php.net>
2022-10-06 11:36:08 +01:00
Vedran Miletić
7065a222b7 Respond with HTTP status 405 to DELETE/PUT/PATCH request on a static resource
Co-authored-by: Marin Martuslović <marin.martuslovic@student.uniri.hr>
2022-08-28 13:26:30 +01:00
Vedran Miletić
4f509058a9 Respond without body to HEAD request on a static resource
Co-authored-by: Marin Martuslović <marin.martuslovic@student.uniri.hr>
2022-08-28 13:26:30 +01:00
Ilija Tovilo
98bdb7f99b
Make pestr[n]dup infallible (#9295)
Fixes GH-9128
Closes GH-9295
2022-08-12 12:21:14 +02:00
George Peter Banyard
c8f4801382
Convert client->request.request_uri to zend_string (#9086) 2022-07-22 10:39:13 +01:00
Jakub Zelenka
0a4a55fd44
Allow to not close stream on rscr dtor in php cli sapi 2022-07-18 10:58:50 +01:00
David Carlier
37e214bdc2 Merge branch 'PHP-8.1' 2022-07-14 12:20:59 +01:00
David Carlier
b44a17c02a Merge branch 'PHP-8.0' into PHP-8.1 2022-07-14 12:13:21 +01:00
guoyiyuan
789a37f144 Prevent potential buffer overflow for large value of php_cli_server_workers_max
Fixes #8989.
Closes #9000.
2022-07-14 12:12:25 +01:00
Arnaud Le Blanc
61ad0d9136 Fix build 2022-07-09 23:30:15 +02:00
Arnaud Le Blanc
da1cbd20c3 Merge branch 'PHP-8.1'
* PHP-8.1:
  [ci skip] NEWS
  Fix GH-8952: std streams can not be deliberately closed (#8953)
  intl extension, build fix for icu >= 69.x release. ubrk/ucnv_safeClone had been deprecated in favor of ubrk/ucnv_clone which does not use user provided stacks but remain thread safe.
2022-07-09 23:01:07 +02:00
Arnaud Le Blanc
2dbde18b29
Fix GH-8952: std streams can not be deliberately closed (#8953) 2022-07-09 22:58:02 +02:00
Ayesh Karunaratne
d3c86527a5 Update mime-db from 1.45.0 to 1.52.0
Updates the the mime types supported by the built-in PHP server to match the mime types available from upstream `mime-db` database.
This updates the `mime-db` version from `v1.45.0` (released in 2020 Sep) to `v1.52.0` (latest, released in 2022 Feb), and syncs the mime types by running the mime type ingestion script.
2022-07-08 07:39:38 +01:00
George Peter Banyard
1c753a958b Pre-compute remote address length in CLI SAPI 2022-07-01 21:18:26 +01:00
George Peter Banyard
b37245b8da Refactor registration of variables for the CLI SAPI 2022-07-01 21:18:26 +01:00
George Peter Banyard
9a7d37ac66
Use size_t for get_ps_title() length parameter 2022-06-30 13:23:13 +01:00
George Peter Banyard
b468d6fb54
Use bool and rename variable for ease of comprehension in ps_title.c 2022-06-30 13:23:13 +01:00
Christoph M. Becker
b8dee9b3fc
Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Fix GH-8827: Intentionally closing std handles no longer possible
2022-06-20 18:04:34 +02:00
Christoph M. Becker
a8437d08a8
Fix GH-8827: Intentionally closing std handles no longer possible
We revert the commits which caused this regression from the PHP-8.0 and
PHP-8.1 branches for now.  We keep it in "master" because of PR #8833
which may offer a proper fix without BC break.
2022-06-20 18:01:02 +02:00
Máté Kocsis
49d3dde211
Declare true return types (#8759) 2022-06-18 22:06:50 +02:00
Derick Rethans
6770158d47 Only warn when an incorrect timezone is set through 'date.timezone' 2022-06-02 09:24:13 +01:00
George Peter Banyard
3bf4098eee
Refactor (again) CLI SAPI server_client struct to use zend_string* (#8605)
This time in a way which works under a RC Debug build.
2022-05-30 13:03:23 +01:00
George Peter Banyard
d08451b2ca
Replace php_stdint.h header with standard headers (#8613) 2022-05-29 11:20:56 +01:00
Christoph M. Becker
cf971a1401
Fix potential parallel test conflict
Cf. <https://ci.appveyor.com/project/php/php-src/builds/43644961/job/xibhmsbs8panajy2?fullLog=true#L15770>.
2022-05-24 16:49:19 +02:00
George Peter Banyard
5ba6ecd523
Minor refactoring of main/main.c and TSRM (#8608) 2022-05-24 08:34:55 +01:00
Nikita Popov
82d407b7e0 Revert "Refactor CLI SAPI php_cli_server_client struct to use zend_string (#8522)"
This reverts commit 9b19d90432.

This has broken the ZEND_RC_DEBUG build.
2022-05-21 16:52:21 +02:00
Levi Morrison
c53c3e200b Stop closing stderr and stdout streams (#8571)
Extensions may (and do) write to stderr in mshutdown and similar. In
the best case, with the stderr stream closed, it's just swallowed.

However, some libraries will do things like try to detect color, and
these will outright fail and cause an error path to be taken.
2022-05-20 13:41:02 +02:00
Arnaud Le Blanc
980385d12d Merge branch 'PHP-8.1'
* PHP-8.1:
  Stop closing stderr and stdout streams (#8570)
  Revert "XFAIL tests (GH-8588)"
  XFAIL tests (GH-8588)
  Stop closing stderr and stdout streams (#8569)
2022-05-20 13:40:27 +02:00
Levi Morrison
ffd27bdec4 Stop closing stderr and stdout streams (#8570)
Extensions may (and do) write to stderr in mshutdown and similar. In
the best case, with the stderr stream closed, it's just swallowed.

However, some libraries will do things like try to detect color, and
these will outright fail and cause an error path to be taken.
2022-05-20 13:40:09 +02:00
Arnaud Le Blanc
6465f3ed13 Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  XFAIL tests (GH-8588)
  Stop closing stderr and stdout streams (#8569)
2022-05-20 13:36:22 +02:00
Levi Morrison
fa78e17724 Stop closing stderr and stdout streams (#8569)
Extensions may (and do) write to stderr in mshutdown and similar. In
the best case, with the stderr stream closed, it's just swallowed.

However, some libraries will do things like try to detect color, and
these will outright fail and cause an error path to be taken.
2022-05-20 13:27:23 +02:00
George Peter Banyard
9b19d90432
Refactor CLI SAPI php_cli_server_client struct to use zend_string (#8522)
This is a stepping stone in converting more pairs of ``char*`` and ``size_t`` to ``zend_string*`` across the CLI SAPI.

Also amend the CLI SAPI test setup to output it's content when it crashes/errors so that one can debug ASAN/UBSAN/MSAN violations.

Drive-by MSAN fix.

Co-authored-by: Arnaud Le Blanc <arnaud.lb@gmail.com>
2022-05-15 21:11:13 +01:00
Christoph M. Becker
81d1a1b47b
Update bug tracker links
The new php-src bugtracker is on Github.

Closes GH-8277.
2022-05-12 14:55:11 +02:00
George Peter Banyard
d4e24e72af Fix Windows build
sapi\cli\php_cli_server.c(2637): warning C4133: 'function': incompatible types - from 'zend_result (__cdecl *)(void *,php_socket_t,int)' to 'int (__cdecl *)(void *,php_socket_t,int)'

Probably a good idea to make GCC complain about these sort of issues too
2022-05-10 12:26:54 +01:00
George Peter Banyard
0fad4d1d96 Fix ASAN build 2022-05-10 12:04:42 +01:00
George Peter Banyard
9601475ebb
Minimal refactoring of CLI SAPI (#8519)
More specific types, some cleanup and voidifying functions which always return ``SUCCESS``
2022-05-09 22:29:16 +01:00
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