Commit Graph

18927 Commits

Author SHA1 Message Date
Florian Engelhardt
14873dd286
Drop zend_mm_set_custom_debug_handlers() (#13457)
Simplifies zend_mm_set_custom_debug_handlers to just use zend_mm_set_custom_handlers(), saving some conditionals when the Zend allocator is not used.
2024-02-26 14:04:33 +01:00
Gina Peter Banyard
295a177760
Zend/tests/offsets: Add tests where the offset is a reference (#13506) 2024-02-26 03:36:35 +00:00
Gina Peter Banyard
1256d745c6
Zend/tests/offsets: add tests for taking references (#13496) 2024-02-25 15:22:59 +00: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
Peter Kokot
ec778c0dd7 Use default HAVE_SIGSETJMP symbol description
When AC_DEFINE is called after some macro that has already defined the
symbol with description (help text), it can be called with two arguments
to make things easier.

[ci skip]
2024-02-24 20:46:34 +01:00
Appla
ef61ed10c2
Remove redundant getpid function call (#13454) 2024-02-21 15:33:15 +01:00
Jorg Adam Sowa
e630aacf79
Remove HAVE_INET_PTON (#13410) 2024-02-21 00:43:56 +00:00
Niels Dossche
6c735739f1 Merge branch 'PHP-8.3'
* PHP-8.3:
  Workaround ZTS persistent resource crashes (PHP 8.3 and lower)
2024-02-20 21:26:39 +01:00
Niels Dossche
3ab7aa001f Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Workaround ZTS persistent resource crashes (PHP 8.3 and lower)
2024-02-20 21:25:06 +01:00
Niels Dossche
2f605820a4 Workaround ZTS persistent resource crashes (PHP 8.3 and lower)
For master (8.4-dev) I merged GH-13381. But that PR changes public API
of TSRM, so cannot be used on lower branches.

This patch is a safe workaround for the issue, in combination with a
pre-existing fix using `ifdef ZTS + if (module_started)` inside pgsql
and odbc. The idea is to delay unloading modules until the persistent
resources are destroyed. This will keep the destructor code accessible
in memory.

This is not a proper fix on its own, because we still need the
workaround of not accessing globals after module destruction.
The proper fix is in master.

Closes GH-13388.
2024-02-20 21:24:43 +01:00
Arnaud Le Blanc
3baa606f58 Specify what is expected in zend_call_stack.base 2024-02-20 15:34:44 +01:00
Gina Peter Banyard
a45048b983
Zend/tests/offsets: Add test for fetching reference of an object container 2024-02-19 12:26:44 +00:00
Peter Kokot
51050427f4
Remove obsolescent AC_C_INLINE Autoconf macro (#13429)
This macro defines the inline keyword to be `__inline__`, `__inline`,
or empty, based on the compiler inline support. Since PHP requires C99,
which has the inline keyword definition and all current compilers
support it, this check is redundant and not needed anymore.
2024-02-18 23:55:50 +00: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
Jorg Adam Sowa
e7b1f2a95b
Change long2ip return type (#13395) 2024-02-16 17:11:18 +01:00
David CARLIER
eaaffae555
zend_call_stack sort of GH-13358 follow-up. (#13368)
for threaded context, it solely uses a new api only available on
illumos.
Here using a common older api to get the stack info for the current
thread.
while at it, completing stack_limit_010 test for these platforms.
2024-02-16 14:01:03 +00:00
Kévin Dunglas
f84d0468ed
add support for Zend Max Exeuction Timers on FreeBSD (#13393) 2024-02-16 12:45:15 +01:00
David CARLIER
aa1eaacc41
zend_ssa minor struct changes. (#13387)
_zend_ssa_pid::has_range_constraint being the only bool, the bitfield would not bring
any benefit.
2024-02-14 07:41:52 +00:00
Niels Dossche
5941cdaaad
Fix ZTS crashes with persistent resources in modules (#13381)
On shutdown in ZTS the following happens:
- https://github.com/php/php-src/blob/master/Zend/zend.c#L1124-L1125
  gets executed. This destroys global persistent resources and destroys
  the modules. Furthermore, the modules are unloaded too.
- Further down, `ts_free_id(executor_globals_id)` gets executed, which
  calls `executor_globals_dtor`. This function destroys persistent
  resources for each thread.

Notice that in the last step, the modules that the persistent resource
belong to may already have been destroyed. This means that accessing
globals will cause a crash (I previously fixed this with ifdef magic),
or when the module is dynamically loaded we'll try jumping to a
destructor that is no longer loaded in memory. These scenarios cause
crashes.

It's not possible to move the `ts_free_id` call upwards, because that
may break assumptions of callers, and furthermore this would deallocate
the executor globals structure, which means that any access to those
will cause a segfault.

This patch adds a new API to the TSRM that allows running a callback on
a certain resource type. We use this API to destroy the persistent
resources in all threads prior to the module destruction, and keep the
rest of the resource dtor intact.

I verified this fix on Apache with postgres, both dynamically and
statically.

Fixes GH-12974.
2024-02-13 21:43:03 +01:00
Michael Voříšek
87edeed3b9
Remove UNEXPECTED from typed prop checks
Closes GH-13143
2024-02-12 11:35:43 +01:00
Ayesh Karunaratne
f6f1f7c109
ext/standard: Minor improvements to phpinfo() output (#13371)
- Change `http://` links to `https://` for php.net and zend.com
 - Remove `<img border=0` attributes as they are no longer in the HTML standard
 - Replace `<font>` tags with `<span>` tags (used for highlight.* INI color value display previews)
2024-02-11 11:05:07 +01:00
Ilija Tovilo
59211a51b7
[skip ci] Move RFC1867 tests as requested by Jakub 2024-02-09 16:01:14 +01:00
Peter Kokot
968f048b4c
Fix undefined symbol pthread_attr_get_np on Solaris (#13358)
Solaris doesn't have pthread_attr_get_np().

Checked on Oracle Solaris 11.4.
2024-02-09 00:46:07 +01: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
2f894389b6
Revert "Use __attribute__((assume())) in ZEND_ASSUME when available"
This reverts commit bf4ec8bd9d.

Partial revert, keep the phpdbg changes.
2024-02-08 11:59:36 +01:00
Peter Kokot
e76f9e2b50
Remove DARWIN symbol (#13346)
When targeting Darwin systems (macOS, etc.), the compiler defines the
__APPLE__ symbol, which should be sufficient and a more established
detection method practice in these cases.
2024-02-07 21:07:48 +01:00
Derick Rethans
a4d64b2605
Removed ext/oci8 and ext/pdo_oci (#13327)
* Removed ext/oci8 and ext/pdo_oci

They now live in their own repositories:

https://github.com/php/pecl-database-oci8
https://github.com/php/pecl-database-pdo_oci

As per: https://wiki.php.net/rfc/unbundle_imap_pspell_oci8
2024-02-07 15:34:39 +00: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
18cdfd3f51
Skip frameless functions with zend_execute_internal
zend_execute_internal is used to intercept function calls. We must use the
DO_FCALL opcode in this instance.
2024-02-07 16:05:15 +01:00
Ilija Tovilo
97e6c54336
Fix RC inference narrowing for ASSIGN_OBJ
Fixes oss-fuzz #66519
Closes GH-13345
2024-02-07 13:03:14 +01:00
Ilija Tovilo
0b1ab42ab8
Fix refactoring mistake
Odd, I rebuilt the project but somehow missed this.
2024-02-06 17:50:53 +01:00
Ilija Tovilo
631bc81607
Implement stackless internal function calls
Co-authored-by: Dmitry Stogov <dmitry@zend.com>

Closes GH-12461
2024-02-06 17:42:28 +01:00
David Carlier
b320aabc5e zend call stack fixing stack limit for macOs arm64.
8MB sounded a prudent size for older 10.9 macOs release, however
with newer mac with arm64, it triggers a stack overflow.

close GH-13319
2024-02-05 19:32:29 +00:00
Ilija Tovilo
f91833d297
Fix RC inference for DECLARE_LAMBDA_FUNCTION
It doesn't seem like the VM can return RCn. However, the JIT fails without it.
I'll need to look into this more closely.
2024-02-05 12:19:18 +01:00
Ilija Tovilo
79e8f20e56
Add type inference for various missing opcodes
Closes GH-13304
2024-02-05 11:48:48 +01:00
Niels Dossche
3b5986db69 Implement GH-12908: Show attribute name/class in ReflectionAttribute dump
This is consistent with how many other Reflection classes have a name
field, and it makes debugging easier.

Closes GH-12908.
Closes GH-12917.
2024-02-04 23:02:02 +01:00
David CARLIER
b8f10decb3
ZEND_ELEMENT_COUNT usage reduction. (#13324)
clang 18 is going to be released and in the meantime the counted_by
attribute usage had been constrained to true flexible arrays,
typical cases such as type name[1] ZEND_ELEMENT_COUNT(size) no longer
build.
2024-02-04 19:09:15 +00:00
David Carlier
f9a83a4bd4 fiber fix wrong asm directives on (default) solaris build mode.
Illumos/Solaris while being 64 bits produces by default 32 bits build.
In this case building the i386 assembly.

Close GH-13320
2024-02-04 17:39:24 +00:00
Ilija Tovilo
77bc863e50
Improve ZEND_FETCH_CLASS_STATIC static inference for final classes
Same as 95f7335.
2024-02-01 15:56:39 +01:00
Ilija Tovilo
95f7335251
Improve static inference in final class (#13298)
static may be treated like self if the class is final.
2024-02-01 11:49:08 +01:00
Ilija Tovilo
668edf2cae
Improve ASSIGN_OBJ RC inference
ASSIGN_OBJ may only modify RC if it implements __set.

Closes GH-13237
2024-01-31 23:24:12 +01:00
Eric Mann
5094a636ae
PHP-8.3 is now for PHP-8.3.4-dev 2024-01-30 12:42:45 -08:00
Pierrick Charron
0454f4ade4
PHP-8.2 is now for PHP 8.2.17-dev 2024-01-30 12:43:37 -05:00
Ilija Tovilo
b06311cb3d
Improve ZEND_NEW RC inference
ZEND_NEW returns RC1 if the instanciated class has no constructor.

Closes GH-13239
2024-01-30 16:31:29 +01:00
Ilija Tovilo
8d082958fe
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix create_object checks
2024-01-30 16:14:08 +01:00
Ilija Tovilo
3a5edcca47
Fix create_object checks
Since PHP 8.3, object handlers may be changed by setting
ce->default_object_handlers, rather than in ce->create_object. Some checks need
to be extended to check for the default handlers.

Closes GH-13272
2024-01-30 16:13:51 +01:00
Dmitry Stogov
373237edb2 Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix GH-13193: Significant performance degradation in 'foreach' starting from PHP 8.2.13 (caused by garbage collection) (#13265)
2024-01-30 06:40:56 +03:00
Dmitry Stogov
49f85c24da Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix GH-13193: Significant performance degradation in 'foreach' starting from PHP 8.2.13 (caused by garbage collection) (#13265)
2024-01-30 06:40:44 +03:00
Dmitry Stogov
397d4c244d
Fix GH-13193: Significant performance degradation in 'foreach' starting from PHP 8.2.13 (caused by garbage collection) (#13265)
* Fix GH-13193: Significant performance degradation in 'foreach' starting from PHP 8.2.13 (caused by garbage collection)

* Don't run zend_gc_remove_root_tmpvars() if GC is not active or GC buffer is empty
2024-01-30 06:38:30 +03:00
Ilija Tovilo
34e2dc5697
Improve is_instanceof inference (#13238)
When a class is final, it may be treated as !is_instanceof.
2024-01-29 12:48:55 +01:00