39 Commits
Author SHA1 Message Date
Ilia Alshanetsky f0798b5164 Merge branch 'PHP-8.5' into PHP-8.6
* PHP-8.5:
  ext/opcache: Mark dl()-created persistent strings as thread-local
2026-10-19 13:31:39 -04:00
Ilia Alshanetsky 7aa5a01cc0 Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  ext/opcache: Mark dl()-created persistent strings as thread-local
2026-10-19 13:30:42 -04:00
Ilia Alshanetsky 77dbc2ca54 ext/opcache: Mark dl()-created persistent strings as thread-local
During a request, opcache's interned-string handlers return a plain
persistent string when the name is not already in shared memory. dl()
registers a temporary module's function, class and property names this
way, so under ZEND_RC_DEBUG the first refcount change on one of them
(building an argument TypeError, ReflectionFunction::getName(),
get_object_vars()) trips the persistent-string assertion. The strings
belong to the request's temporary module; mark them GC_PERSISTENT_LOCAL,
but only while zend_rc_debug is off, as dl() turns it off, so the check
keeps covering strings that may later be shared.

Closes GH-24421
2026-10-19 13:25:36 -04:00
Ilia Alshanetsky 1a95cbee88 Merge branch 'PHP-8.5' into PHP-8.6
* PHP-8.5:
  Zend: Skip frameless registration for temporary modules
2026-09-30 11:00:00 -04:00
Ilia Alshanetsky 3093b9daca Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  Zend: Skip frameless registration for temporary modules
2026-09-30 10:59:57 -04:00
Ilia Alshanetsky 75d77cb4fe Zend: Skip frameless registration for temporary modules
dl() modules are MODULE_TEMPORARY. Their function records are freed at
request shutdown, but zend_flf_functions keeps those pointers for the
process lifetime. A later request can match the stale handler address
and use the freed record. Temporary modules leave the frameless info
unset, so the call uses the ordinary internal path.

Closes GH-24008
2026-09-30 10:59:46 -04:00
Dmytro Kulyk 67135cb97b gen_stub: Conditionally include zend_attributes.h to arginfo based on usage (#21570)
Headers required by the generated code (zend_attributes.h, zend_constants.h, zend_enum.h) are collected during generation and emitted as includes at the top of the arginfo file, with the same preprocessor conditions and PHP version guards as the code that needs them.

Removes the manual zend_attributes.h and zend_enum.h includes from sources that only needed them for the arginfo file they include.
2026-09-06 21:25:20 +02:00
Ben Ramsey 2f76185b36 license-update: ext/dl_test source headers
RFC: https://wiki.php.net/rfc/php_license_update
2026-04-11 21:20:54 -05:00
Peter Kokot 06dac62747 Remove unused PHP_DL_TEST_EXPORTS and PHP_ZEND_TEST_EXPORTS (#21109)
In current code these aren't used on Windows build. The
PHP_ZEND_TEST_EXPORTS was intended to fix MSVC level 1 (severe) warnings
via 5a04796f76 but __declspec(dllexport)
is now implemented unconditionally.
2026-02-05 00:25:13 +01:00
Arnaud Le Blanc 65b4073922 Include the actual stub name in generated arginfo headers (#20993) 2026-01-21 20:57:00 +01:00
Niels Dossche 57ce245e1e Reduce code bloat in arginfo by using specialised string releases (#20016)
* Reduce code bloat in arginfo by using specialised string releases

Comparing this patch to master (c7da728574),
with a plain configure command without any options:

```
   text	   data	    bss	    dec	    hex	filename
20683738	1592400	 137712	22413850	156021a	sapi/cli/php
20688522	1592400	 137712	22418634	15614ca	sapi/cli/php_old
```

We see a minor reduction of 0.023% in code size.

* Also use true for the other initialization line

* Also use specialized code for consts
2025-10-02 22:00:20 +02:00
Daniel Scherzer 3f3a266a2b gen_stub: Infer constants' types from values (#19568)
Don't require `@var` with a type when the type can be inferred from a literal
value in the stub file.
2025-09-03 18:26:43 -07:00
Arnaud Le Blanc f75dd82866 Merge branch 'PHP-8.4'
* PHP-8.4:
  Destroy temporary module classes in reverse order
2025-03-14 10:51:50 +01:00
Arnaud Le Blanc 4b9c72f329 Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Destroy temporary module classes in reverse order
2025-03-14 10:49:10 +01:00
Arnaud Le Blanc 1c182674b0 Destroy temporary module classes in reverse order
We destroy classes of dl()'ed modules in clean_module_classes(), during
shutdown. Child classes of a module use structures of the parent class (such as
inherited properties), which are destroyed earlier, so we have a use-after-free
when destroying a child class.

Here I destroy classes in reverse order, as it is done in zend_shutdown() for
persistent classes.

Fixes GH-17961
Fixes GH-15367
2025-03-14 10:45:17 +01:00
Arnaud Le Blanc 420365d922 Merge branch 'PHP-8.4'
* PHP-8.4:
  Add observer temporary to dl'ed functions
2024-12-20 18:52:43 +01:00
Arnaud Le Blanc 32148e9b10 Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Add observer temporary to dl'ed functions
2024-12-20 18:50:16 +01:00
Arnaud Le Blanc 9e7932b292 Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Add observer temporary to dl'ed functions
2024-12-20 18:46:55 +01:00
Arnaud Le Blanc 6f579934f0 Add observer temporary to dl'ed functions
When observer is enabled, we normally add an extra temporary to all
functions, to store the previously observed frame. However, this is done in
zend_observer_post_startup() so it doesn't happen to dl'ed() functions.

One possible fix would be to move that from zend_observer_post_startup()
to zend_register_functions(), but this would be too early: Observer may
not be enabled when zend_register_functions() is called, and may still be
enabled later.

However, when zend_register_functions() is called at run-time (during dl()),
we know definitively whether observer is enabled.

Here I update zend_register_functions() to add a temporary to dl'ed()
functions when observer is enabled.

Fixes: GH-17211
Closes: GH-17220
2024-12-20 18:45:34 +01:00
Ilija Tovilo 452c5ac989 Fix incorrect filename of dl()'d internal consts (#16721)
We should only attempt to fetch the current filename for user constants. dl()
may attempt to register internal constants after execution has already started,
thus incorrectly linking the user file invoking dl().

See GH-16663
2024-11-07 14:53:12 +01:00
Peter Kokot 816aea797b Autotools: Mark always-shared extensions with ext_shared variable (#15739)
This makes future config.m4 files changes simpler in case of adding
additional checks, macro calls etc. Or if these extensions configuration
would change at some point.
2024-09-04 23:28:29 +02:00
Peter Kokot 1ceadaed52 Autotools: Normalize and quote all PHP_NEW_EXTENSION arguments (#15144)
This adds Autoconf quote characters to all PHP_NEW_EXTENSION arguments
and syncs the CS across the php-src Autotools build system.
2024-07-29 00:14:59 +02:00
Máté Kocsis f2e199e878 Implement "support doc comments for internal classes and functions" (#13266)
Fixes #13130
2024-02-25 08:41:31 +01:00
Máté Kocsis 10957e498c Do not generate frameless info items when func info generation is disabled
While here, I fixed newlines around arginfo and function entry generation. Previously, newlines were repeated.
2024-02-18 11:39:00 +01:00
Jakub Zelenka 52b13f6ddb Merge branch 'PHP-8.2' into PHP-8.3 2023-11-03 17:17:52 +00:00
Jakub Zelenka 882cc4f804 Merge branch 'PHP-8.1' into PHP-8.2 2023-11-03 17:17:23 +00:00
Jakub Zelenka a8c6c6165b Fix GH-9921: Loading ext in FPM config does not register module handlers
Closes GH-12377
2023-11-03 16:53:09 +00:00
Ilija Tovilo aff86d68f6 Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  [skip ci] Fix borked xleak skip on <PHP-8.3
2023-09-01 12:40:07 +02:00
Ilija Tovilo b21df69848 [skip ci] Fix borked xleak skip on <PHP-8.3
xleak in skipif was only added in PHP 8.3.
2023-09-01 12:39:03 +02:00
Ilija Tovilo 64ef06d276 Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Skip dl() tests on ASAN
2023-08-30 22:25:32 +02:00
Ilija Tovilo 10c81039da Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Skip dl() tests on ASAN
2023-08-30 22:25:11 +02:00
Ilija Tovilo fb0f4215de Skip dl() tests on ASAN 2023-08-30 22:20:51 +02:00
Máté Kocsis e9c0aa10d0 Merge branch 'PHP-8.2'
* PHP-8.2:
  Add support for validation of missing method synopses (#9491)
2022-09-07 17:41:10 +02:00
Máté Kocsis ce058273ba Add support for validation of missing method synopses (#9491) 2022-09-07 17:40:36 +02:00
George Peter Banyard 163c0b5f4c Merge branch 'PHP-8.2' 2022-09-06 10:42:34 +01:00
George Peter Banyard 1ad59b32c2 Update INI validator and displayers depending on INI type
Closes GH-9451
2022-09-06 10:33:34 +01:00
Tim Düsterhus 03fd405423 Use php_info_print_table_header for actual column headers only (#9485)
Using php_info_print_table_header() for "Foo: bar" looks odd and out of place,
because the whole line is colored. It is also questionable from a HTML
semantics point of view, because it does not described the columns that follow.

The use of this across extensions is inconsistent. It was part of the skeleton,
but ext/date or ext/json already use a regular row.
2022-09-06 08:48:22 +02:00
twosee 4a9c001140 Add clean_module_functions() (#8763)
Add clean_module_functions() to clean functions which are registered by zend_register_functions().
The general logic of clean_module_functions() is consistent with clean_module_classes().
2022-06-17 16:33:20 +02:00
Arnaud Le Blanc f07a08df5c Fix unregistering ini entries of dynamically loaded extension (#8435)
Fixes GH-8185
2022-05-06 15:25:44 +02:00