History log of /PHP-8.4/main/main.c (Results 1 – 25 of 1271)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 5a47f270 04-Oct-2024 Jakub Zelenka

Fix GH-15395: php-fpm: zend_mm_heap corrupted with cgi-fcgi request

Closes GH-16227

Co-authored-by: David Carlier <devnexen@gmail.com>


# d313ad60 30-Dec-2023 Michael Voříšek

Deprecate E_STRICT constant and remove error level

RFC: https://wiki.php.net/rfc/deprecations_php_8_4#remove_e_strict_error_level_and_deprecate_e_strict_constant

Closes GH-13053


# 25d76162 06-Sep-2024 Bob Weinand

Make internal run_time_cache a persistent allocation (#15040)

We also add zend_map_ptr_static, so that we do not incur the overhead of constantly recreating the internal run_time_cache point

Make internal run_time_cache a persistent allocation (#15040)

We also add zend_map_ptr_static, so that we do not incur the overhead of constantly recreating the internal run_time_cache pointers on each request.
This mechanism might be extended for mutable_data of internal classes too.

show more ...


# 0d616d1b 01-Sep-2024 Niels Dossche <7771979+nielsdos@users.noreply.github.com>

Fix GH-15693: Unnecessary include in main.c bloats binary

Closes GH-15700.


# afc57381 13-Aug-2024 Calvin Buckley

Show build provider and unify version information printing (#14657)

* Show build provider information in "php -v"

Vendors such as distributions can set the `PHP_BUILD_PROVIDER`

Show build provider and unify version information printing (#14657)

* Show build provider information in "php -v"

Vendors such as distributions can set the `PHP_BUILD_PROVIDER`
variable, that gets printed in phpinfo. However, I find that users check
`php -v` more often than phpinfo to see what PHP they're running. The
problem with this is that it does not show that build provider
information.

This change makes the build provider information printed on an
additional line of the version information.

* Put on same line so it works with or without env var

Unbreaks build without PHP_BUILD_PROVIDER set.

* change wording in provider version text

better grammatically; many different possibilities here though

* Unify SAPI version printing

This makes it so that all of the SAPIs share the same code for printing
version information. This is useful in case of any future changes to the
version information, such as i.e. adding build provider to the output.

* Make include for php_print_version explicit

* Preserve phpdbg version and output channel

php_printf doesn't have same semantics, as phpdbg_out could be on a
different output than stdout/err. Also add the phpdbg version (in case
it differs from PHP's, to keep similar output before this PR)

* remove size variables

we don't use them and CI doesn't like unused variables

* Fix format string insecurity

show more ...


# 2aeff2c9 17-Jul-2024 David CARLIER

main: update Winsock api version to 2.2 (#14909)

not been updated since php 4 whereas 2.2 is available even in Win2000.


# 3fbca7fb 24-Jun-2024 Arnaud Le Blanc

Support sysconf(_SC_GETPW_R_SIZE_MAX) == -1 (#13922)


# 6a2c5318 15-Jun-2024 Bob Weinand

Optimize observers (#13649)

Inline the lookup whether a function is observed at all.
This strategy is also used for FRAMELESS calls. If the frameless call is observed, we instead allocat

Optimize observers (#13649)

Inline the lookup whether a function is observed at all.
This strategy is also used for FRAMELESS calls. If the frameless call is observed, we instead allocate a call frame and push the arguments, to call the the function afterwards.
Doing so is still a performance benefit as opposed to executing individual INIT_FCALL+SEND_VAL ops. Thus, even if the frameless call turns out to be observed, the call overhead is slightly lower than before.
If the internal function is not observed at all, the unavoidable overhead is fetching the FLF zend_function pointer and the run-time cache needs to be inspected.

As part of this work, it turned out to be most viable to put the result operand on the ZEND_OP_DATA instead of ZEND_FRAMELESS_ICALL_3, allowing seamless interoperability with the DO_ICALL opcode.
This is a bit unusual in comparison to all other ZEND_OP_DATA usages, but seems to not pose problems overall.

There is also a small issue resolved: trampolines would always use the ZEND_CALL_TRAMPOLINE_SPEC_OBSERVER function due to zend_observer_fcall_op_array_extension being set to -1 too late.

show more ...


# d1048a08 12-Jun-2024 Arnaud Le Blanc

Add zend_random_bytes(), zend_random_bytes_insecure() functions (#14054)

Co-authored-by: Tim Düsterhus <tim@bastelstu.be>


# 84a0da15 09-Jun-2024 Peter Kokot

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_DIRE

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).

show more ...


# 48d5ae98 29-May-2024 Gina Peter Banyard

ext/standard: Refactor exec.c public APIs to use zend_string pointers (#14353)

* Pull zend_string* from INI directive

* Ensure that mail.force_extra_parameters INI directive does no

ext/standard: Refactor exec.c public APIs to use zend_string pointers (#14353)

* Pull zend_string* from INI directive

* Ensure that mail.force_extra_parameters INI directive does not have any nul bytes

* ext/standard: Make php_escape_shell_cmd() take a zend_string* instead of char*

This saves on an expensive strlen() computation

* Convert E_ERROR to ValueError in php_escape_shell_cmd()

* ext/standard: Make php_escape_shell_arg() take a zend_string* instead of char*

This saves on an expensive strlen() computation

* Convert E_ERROR to ValueError in php_escape_shell_arg()

show more ...


# c3acfb1b 10-Apr-2024 Niels Dossche <7771979+nielsdos@users.noreply.github.com>

Fix GH-13931: Applying zero offset to null pointer in Zend/zend_opcode.c

In the test cases, the compiler bails out due to a fatal error.
The data structures used by the compiler will con

Fix GH-13931: Applying zero offset to null pointer in Zend/zend_opcode.c

In the test cases, the compiler bails out due to a fatal error.
The data structures used by the compiler will contain stale values.
In particular, for the test case CG(loop_var_stack) will contain data.
The next compilation will incorrectly use elements from the previous
stack.
To solve this, we reset part of the compiler data structures.
We don't do a full re-initialization via init_compiler() because that will
also reset streams and resources.

Closes GH-13938.

show more ...


# 5bb03158 19-Mar-2024 Máté Kocsis

Add the last few remaining constants to stubs (#13751)

Basically all constants are now declared via stubs. The rest of the constants are either deprecated (`SID` or `MHASH_*`) or out of inte

Add the last few remaining constants to stubs (#13751)

Basically all constants are now declared via stubs. The rest of the constants are either deprecated (`SID` or `MHASH_*`) or out of interest (`__COMPILER_HALT_OFFSET__` and `PHP_CLI_PROCESS_TITLE`).

show more ...


# c149b4f5 30-Jan-2024 Ilija Tovilo

Fix missing syntax error message in cli-server router script

Fixes GH-13113
Closes GH-13275


# fe064d7f 19-Jan-2024 Niels Dossche <7771979+nielsdos@users.noreply.github.com>

Fix GH-13142: Undefined variable name is shortened when contains \0

Uses the new %S formatter and introduces the necessary changes and
helpers.


# 8d5c3e67 16-Jan-2024 Niels Dossche <7771979+nielsdos@users.noreply.github.com>

Introduce %S modifier and use it (#13168)


# 2cde4b2e 15-Jan-2024 Niels Dossche <7771979+nielsdos@users.noreply.github.com>

Fix GH-13097: Anonymous class reference in trigger_error / thrown Exception

Closes GH-13153.


# daa38dd6 20-Nov-2023 Ilija Tovilo

Fix in-place modification of filename in php_message_handler_for_zend

php_strip_url_passwd modifies url in-place. We cannot assume from
php_message_handler_for_zend that data is a tempor

Fix in-place modification of filename in php_message_handler_for_zend

php_strip_url_passwd modifies url in-place. We cannot assume from
php_message_handler_for_zend that data is a temporary, modifiable string.

Fixes oss-fuzz #64209
Closes GH-12733

show more ...


# d8e866da 20-Nov-2023 Ilija Tovilo

Fix in-place modification of filename in php_message_handler_for_zend

php_strip_url_passwd modifies url in-place. We cannot assume from
php_message_handler_for_zend that data is a tempor

Fix in-place modification of filename in php_message_handler_for_zend

php_strip_url_passwd modifies url in-place. We cannot assume from
php_message_handler_for_zend that data is a temporary, modifiable string.

Fixes oss-fuzz #64209
Closes GH-12733

show more ...


# 0311e60e 04-Aug-2023 Levi Morrison

Add php_version and php_version_id PHPAPI funcs (#11875)

Mostly, extensions will use `PHP_VERSION` and `PHP_VERSION_ID`
respectfully but sometimes they want to grab the version at run-ti

Add php_version and php_version_id PHPAPI funcs (#11875)

Mostly, extensions will use `PHP_VERSION` and `PHP_VERSION_ID`
respectfully but sometimes they want to grab the version at run-time
rather than at compile-time. For example, extensions which distribute
pre-built binaries may want this.

show more ...


# d5ad7510 08-Jun-2023 George Peter Banyard

More usage of known zend_str instead of C string (#11381)


# ac5920f9 29-Apr-2023 Niels Dossche <7771979+nielsdos@users.noreply.github.com>

Fix GH-11141: Could not open input file: should be sent to stderr

I grepped for php_printf cases in main/ and sapi/ and converted the
cases which clearly indicate errors to fprintf(stder

Fix GH-11141: Could not open input file: should be sent to stderr

I grepped for php_printf cases in main/ and sapi/ and converted the
cases which clearly indicate errors to fprintf(stderr, ...), like
suggested in the linked issue.

Closes GH-11163.

show more ...


# 732d92c0 28-Apr-2023 Javier Eguiluz

[skip ci] Fix various typos and grammar issues (#11143)


# 51faf04d 15-Mar-2023 Niels Dossche <7771979+nielsdos@users.noreply.github.com>

Fix GH-10737: PHP 8.1.16 segfaults on line 597 of sapi/apache2handler/sapi_apache2.c

The TSRM keeps a hashtable mapping the thread IDs to the thread resource pointers.
It's possible that

Fix GH-10737: PHP 8.1.16 segfaults on line 597 of sapi/apache2handler/sapi_apache2.c

The TSRM keeps a hashtable mapping the thread IDs to the thread resource pointers.
It's possible that the thread disappears without us knowing, and then another thread
gets spawned some time later with the same ID as the disappeared thread.
Note that since it's a new thread the TSRM key pointer and cached pointer will be NULL.

The Apache request handler `php_handler()` will try to fetch some fields from the SAPI globals.
It uses a lazy thread resource allocation by calling `ts_resource(0);`.
This allocates a thread resource and sets up the TSRM pointers if they haven't been set up yet.

At least, that's what's supposed to happen. But since we are in a situation where the thread ID
still has the resources of the *old* thread associated in the hashtable,
the loop in `ts_resource_ex` will find that thread resource and assume the thread has been setup
already. But this is not the case since this thread is actually a new thread, just reusing the ID
of the old one, without any relation whatsoever to the old thread.
Because of this assumption, the TSRM pointers will not be setup, leading to a
NULL pointer dereference when trying to access the SAPI globals.

We can easily detect this scenario: if we're in the fallback path, and the pointer is NULL,
and we're looking for our own thread resource, we know we're actually reusing a thread ID.
In that case, we'll free up the old thread resources gracefully (gracefully because
there might still be resources open like database connection which need to be
shut down cleanly). After freeing the resources, we'll create the new resources for
this thread as if the stale resources never existed in the first place.
From that point forward, it is as if that situation never occurred.
The fact that this situation happens isn't that bad because a child process containing
threads will eventually be respawned anyway by the SAPI, so the stale thread resources
won't remain forever.

Note that we can't simply assign our own TSRM pointers to the existing
thread resource for our ID, since it was actually from a different thread
(just with the same ID!). Furthermore, the dynamically loaded extensions
have their own pointer, which is only set when their constructor is
called, so we'd have to call their constructor anyway...
I also tried to call the dtor and then the ctor again for those resources
on the pre-existing thread resource to reuse storage, but that didn't work properly
because other code doesn't expect something like that to happen, which breaks assumptions,
and this in turn caused Valgrind to (rightfully) complain about memory bugs.

Note 2: I also had to fix a bug in the core globals destruction because it
always assumed that the thread destroying them was the owning thread,
which on TSRM shutdown isn't always the case. A similar bug was fixed
recently with the JIT globals.

Closes GH-10863.

show more ...


# c9d728cb 04-Apr-2023 Dmitry Stogov

Revert "Zend/zend_types.h: move `zend_rc_debug` to `zend_rc_debug.h`"

This reverts commit d6e95041e291f1f41e1da43e616c6354705464d3.


12345678910>>...51