Commit graph

363 commits

Author SHA1 Message Date
Jakub Zelenka
4b211a7769
Merge branch 'PHP-8.4' 2024-11-20 11:14:32 +01:00
Jakub Zelenka
7c96af42b7
Merge branch 'PHP-8.3' into PHP-8.4 2024-11-20 11:14:04 +01:00
Jakub Zelenka
ffff27f734
Merge branch 'PHP-8.2' into PHP-8.3 2024-11-20 11:12:19 +01:00
Niels Dossche
f18d429b20
Fix GHSA-4w77-75f9-2c8w 2024-11-20 11:07:28 +01:00
Gina Peter Banyard
6ddab74d55
sapi: Fix some variable shadowing (#16485)
sapi_module, mime_type_map, zend_extensions, php_cgi_globals, and phpdbg_globals are true globals which are being shadowed
2024-10-17 22:46:23 +01:00
Ilija Tovilo
3074cbf5b6
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Skip shebang in cli-server router script
2024-10-14 13:35:41 +02:00
Ilija Tovilo
77f770871b
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Skip shebang in cli-server router script
2024-10-14 13:34:21 +02:00
Ilija Tovilo
06efe44c2e
Skip shebang in cli-server router script
Fixes GH-16373
Closes GH-16403
2024-10-14 13:33:16 +02:00
David Carlier
139accecb4
Merge branch 'PHP-8.3' into PHP-8.4 2024-10-03 22:46:02 +01:00
David Carlier
4b7a906d57
Merge branch 'PHP-8.2' into PHP-8.3 2024-10-03 22:45:51 +01:00
David Carlier
3d80d98a10
Fix GH-16137: "Deduplicate" http headers values but Set-Cookie.
Those are meant to have 1 or plus values separated by a comma even
 if the client set them separately.

close GH-16154
2024-10-03 22:45:31 +01:00
Gina Peter Banyard
02177848e4
Replace uses of php_dirname() with zend_dirname() (#15393)
This removes some needs to include the php_string.h header
2024-08-14 12:35:47 +01:00
Christoph M. Becker
9c537de8a5
Fix some -Wimplicit-function-declaration errors on Windows (GH-15325)
While clang is picky about these, MSVC doesn't seem to care and would
only report the calls to undeclared functions as errors during link
time.  Still, obviously, MSVC is fine with having the declarations
during compile time.
2024-08-10 16:25:28 +02:00
Arnaud Le Blanc
11accb5cdf
Preferably include from build dir (#13516)
* Include from build dir first

This fixes out of tree builds by ensuring that configure artifacts are included
from the build dir.

Before, out of tree builds would preferably include files from the src dir, as
the include path was defined as follows (ignoring includes from ext/ and sapi/) :

    -I$(top_builddir)/main
    -I$(top_srcdir)
    -I$(top_builddir)/TSRM
    -I$(top_builddir)/Zend
    -I$(top_srcdir)/main
    -I$(top_srcdir)/Zend
    -I$(top_srcdir)/TSRM
    -I$(top_builddir)/

As a result, an out of tree build would include configure artifacts such as
`main/php_config.h` from the src dir.

After this change, the include path is defined as follows:

    -I$(top_builddir)/main
    -I$(top_builddir)
    -I$(top_srcdir)/main
    -I$(top_srcdir)
    -I$(top_builddir)/TSRM
    -I$(top_builddir)/Zend
    -I$(top_srcdir)/Zend
    -I$(top_srcdir)/TSRM

* Fix extension include path for out of tree builds

* Include config.h with the brackets form

`#include "config.h"` searches in the directory containing the including-file
before any other include path. This can include the wrong config.h when building
out of tree and a config.h exists in the source tree.

Using `#include <config.h>` uses exclusively the include path, and gives
priority to the build dir.
2024-06-26 00:26:43 +02:00
Peter Kokot
cf3b9fca8f
Sync #if/ifdef/defined (-Wundef) (#14623)
These are either define (to value 1) or undefined:
- __GNUC__
- DBA_CDB_BUILTIN
- DBA_GDBM
- HAVE_FORK
- HAVE_PUTENV
- HAVE_SETENV
- HAVE_SYS_SELECT_H
- HAVE_SYS_SOCKET_H
- HAVE_SYS_WAIT_H
- HAVE_UNSETENV
- RFC3678_API
- ZEND_ENABLE_ZVAL_LONG64
- ZTS

Follow-up of GH-5526
2024-06-24 19:37:07 +02:00
Peter Kokot
5d3fab9334
Sync #if/ifdef/defined (#14520)
These are either undefined or defined (to value 1):
- __DragonFly__
- __FreeBSD__
- HAS_MCAST_EXT
- HAVE_GETCWD
- HAVE_GETWD
- HAVE_GLIBC_ICONV
- HAVE_JIT
- HAVE_LCHOWN
- HAVE_NL_LANGINFO
- HAVE_RL_CALLBACK_READ_CHAR
- HAVE_RL_ON_NEW_LINE
- HAVE_SQL_EXTENDED_FETCH
- HAVE_UTIME

Follow up of GH-5526 (-Wundef)
2024-06-11 22:47:05 +02:00
Peter Kokot
84a0da1574
Sync #if/ifdef/defined (#14508)
This syncs CPP macro conditions:
- _WIN32
- _WIN64
- HAVE_ALLOCA_H
- HAVE_ALPHASORT
- HAVE_ARPA_INET_H
- HAVE_CONFIG_H
- HAVE_DIRENT_H
- HAVE_DLFCN_H
- HAVE_GETTIMEOFDAY
- HAVE_LIBDL
- HAVE_POLL_H
- HAVE_PWD_H
- HAVE_SCANDIR
- HAVE_SYS_FILE_H
- HAVE_SYS_PARAM_H
- HAVE_SYS_SOCKET_H
- HAVE_SYS_TIME_H
- HAVE_SYS_TYPES_H
- HAVE_SYS_WAIT_H
- HAVE_UNISTD_H
- PHP_WIN32
- ZEND_WIN32

These are either undefined or defined to 1 in Autotools and Windows.

Follow up of GH-5526 (-Wundef).
2024-06-09 14:23:41 +02:00
Peter Kokot
2d66562e4b
Sync HAVE_IPV6 and HAVE_GETADDRINFO in #if/ifdef/defined (#14341)
Follow up of GH-5526 (-Wundef)
2024-05-28 11:52:25 +02:00
Cristian Rodríguez
8e62e2b829
Mark multple functions as static (#13864)
* Mark many functions as static

Multiple functions are missing the static qualifier.

* remove unused struct sigactions

struct sigaction act, old_term, old_quit, old_int;
all unused.

* optimizer: minXOR and maxXOR are unused
2024-05-22 13:11:46 +02:00
Ilija Tovilo
cd66fcc68b
Add request_parse_body() function
RFC: https://wiki.php.net/rfc/rfc1867-non-post

This function allows populating the $_POST and $_FILES globals for non-post
requests. This avoids manual parsing of RFC1867 requests.

Fixes #55815
Closes GH-11472
2024-02-08 12:08:07 +01:00
Ilija Tovilo
c149b4f56f
Fix missing syntax error message in cli-server router script
Fixes GH-13113
Closes GH-13275
2024-02-07 16:13:08 +01:00
Ilija Tovilo
d7d0d19d32
Support index.php fallback for files in built-in server
If no router script is used, the built-in webserver will now look for a fallback
index file recursively in all cases, including URLs with a period.

Fixes GH-12604
Closes GH-12992
2024-01-09 16:13:39 +01:00
Ilija Tovilo
8876639d11
Add X-Powered-By header to builtin 404 page (#13092)
As requested by 30929c9a88 (r1434156785).
2024-01-09 16:10:39 +01:00
Ilija Tovilo
a559a5e530
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix max_execution_time with cli-server router script
2023-12-07 16:13:21 +01:00
Ilija Tovilo
299c3ba89e
Fix max_execution_time with cli-server router script
When the cli-server specifies a router script, we run it using
zend_execute_scripts instead of php_execute_script, because the former preserves
the return value of the script. However, php_execute_script also starts resets
the execution timer with the value from max_execution_time. If the timer has
previously been initialized with max_input_time, it will never be reset, and
thus trigger at the incorrect time.

Closes GH-12886
2023-12-07 16:11:48 +01:00
Niels Dossche
7c41509e26 Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  php_cli_server: ensure single date header is present
2023-10-06 17:51:38 +02:00
Niels Dossche
a1845944ce Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  php_cli_server: ensure single date header is present
2023-10-06 17:50:13 +02:00
coppolafab
f6ac08c6a3 php_cli_server: ensure single date header is present
Currently the PHP Development Server appends a Date header in the
response, despite already set from user code.

Added a check condition before append the header, and a test file.

Closes GH-12363.
2023-10-06 17:49:30 +02:00
Niels Dossche
d58e3c05c9 Merge branch 'PHP-8.2'
* PHP-8.2:
  Fix GH-11716: cli server crashes on SIGINT when compiled with ZEND_RC_DEBUG=1
2023-07-21 15:31:33 +02:00
Niels Dossche
272dc9a09c Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix GH-11716: cli server crashes on SIGINT when compiled with ZEND_RC_DEBUG=1
2023-07-21 15:31:20 +02:00
Niels Dossche
af77d3b8da Fix GH-11716: cli server crashes on SIGINT when compiled with ZEND_RC_DEBUG=1
Closes GH-11757.
2023-07-21 15:23:56 +02:00
George Peter Banyard
d5ad75108e
More usage of known zend_str instead of C string (#11381) 2023-06-08 13:03:29 +01:00
Cédric Anne
c02348cf9d
Make SERVER_SOFTWARE compliant with RFC3875 (#11093) 2023-05-05 12:43:34 +01:00
George Peter Banyard
382148d7bb
Fix UBSAN warning about applying zero offset to null pointer (#10700)
vpath may be NULL here so check for it before trying to add 0 (the length of the vpath) to it.
2023-02-26 14:06:30 +00:00
Max Kellermann
d46dea169c
Make globals const (part 2) (#10610)
* Zend/zend_enum: make `forbidden_methods` static+const

* main/php_syslog: make `xdigits` static

* sapi/fpm: make several globals `const`

* sapi/phpdbg: make `OPTIONS` static

* sapi/phpdbg/help: make help texts const

* sapi/cli: make `template_map` const

* ext/ffi: make `zend_ffi_types` static

* ext/bcmath: make `ref_str` const

* ext/phar: make several globals static+const
2023-02-18 19:52:53 +00:00
Christoph M. Becker
c8955c078a
Revert GH-10220
Cf. <https://github.com/php/php-src/pull/10220#issuecomment-1383739816>.

This reverts commit ecc880f491.
This reverts commit 588a07f737.
This reverts commit f377e15751.
This reverts commit b4ba16fe18.
This reverts commit 694ec1deea.
This reverts commit 6b34de8eba.
This reverts commit aa1cd02a43.
This reverts commit 308fd311ea.
This reverts commit 16203b53e1.
This reverts commit 738fb5ca54.
This reverts commit 9fdbefacd3.
This reverts commit cd4a7c1d90.
This reverts commit 928685eba2.
This reverts commit 01e5ffc85c.
2023-01-16 12:27:33 +01:00
Max Kellermann
6b34de8eba sapi/*: add missing includes 2023-01-10 14:19:03 +00:00
David Carlier
84988d2093 cli server addressing few todos.
Closes GH-10124.
2022-12-22 14:03:35 +00:00
Ilija Tovilo
ec55d341bf
Merge branch 'PHP-8.2'
* PHP-8.2:
  Fix cli server blocking on accept when using multiple workers
2022-10-20 13:04:32 +02:00
Ilija Tovilo
ce527ed599
Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix cli server blocking on accept when using multiple workers
2022-10-20 13:04:25 +02:00
Ilija Tovilo
6be8efdf78
Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Fix cli server blocking on accept when using multiple workers
2022-10-20 13:04:14 +02:00
Ilija Tovilo
d52f0451ad
Fix cli server blocking on accept when using multiple workers
Fixes GH-9400
Closes GH-9693
2022-10-20 13:03:35 +02:00
George Peter Banyard
f8b53e7028
Merge branch 'PHP-8.2'
* PHP-8.2:
  Fix memory-leak in CLI web server
2022-10-06 11:36:50 +01:00
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
Ilija Tovilo
ecc3fc180f
Use PDEATHSIG to kill cli-server workers if parent exists
Closes GH-9476
2022-09-08 10:48:20 +02: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
David Carlier
37e214bdc2 Merge branch 'PHP-8.1' 2022-07-14 12:20:59 +01:00