Commit Graph

18899 Commits

Author SHA1 Message Date
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
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
Gina Peter Banyard
a479ed7cc5
Zend: Add tests for offsets and containers (#12723)
Add various tests showcasing the behavioural variations of different offset types used on various container types in all possible operations:
 - Read
 - Write
 - Read Write
 - Appending
 - Unsetting
 - Existence checks with isset()/empty/null coalesce operator
 - Behaviour of nesting dimensions (e.g. $container[$offset1][$offset2])

Add a test to ensure compile time and runtime behaviour is identical for offsets.

Add an internal class that overloads the dimension object handlers to zend_test
2024-01-25 15:06:59 +00:00
Jorg Adam Sowa
ea3c541640
GH-13142: add missing test cases (#13235)
* Added missing global cases to test

* Update gh13142
2024-01-24 12:02:32 +01:00
Ilija Tovilo
6f6289caca
Avoid new SSA var for ASSIGN_OBJ_REF without RC inference
Previously, this variable was necessary because of auto-vivification on
UNDEF/null/false. It's now only used for RC inference, as auto-vivification has
been removed.

This implicitly solves an inference problem for $obj->bar &= $obj; where we get
a new variable for both literal references to $obj, with the first one getting
the RCn flag, and the second one getting the MAY_BE_REFERENCE flag. Thus, the
first variable will be missing the reference type, causing a false-positive type
inference warning.

If we want to verify RC inference at some point we'll need a better solution.

Closes GH-13233
2024-01-24 11:30:49 +01:00
Ilija Tovilo
7040e8ee03
[skip ci] Use _exit for type inference verification
Otherwise we get useless leak warnings when building with asan.
2024-01-23 18:15:30 +01:00
tekimen
5da8335145
Fix "warning: conflicting types for ‘zend_multibyte_set_script_encoding’ due to enum/integer mismatch;" (#13227) 2024-01-23 12:31:00 +00:00
ju1ius
513224cf31 prevents using resource as a zend_type
Closes #13102
2024-01-22 21:56:36 +01:00
Remi Collet
8ce4d240f7
Merge branch 'PHP-8.3'
* PHP-8.3:
  NEWS
  NEWS
  Fix GH-13215 GCC 14 build
2024-01-22 10:59:48 +01:00
Remi Collet
17d79e1ea6
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  NEWS
  Fix GH-13215 GCC 14 build
2024-01-22 10:59:17 +01:00
Remi Collet
7252660941
Fix GH-13215 GCC 14 build 2024-01-22 10:58:04 +01:00
Ilija Tovilo
d653646841
Fix iterator position resetting
Previously, when an array was converted from packed to hashed, iterators would
not be correctly reset to 0. Similarly, removing the last element from an array
would decrease nNumUsed but not actually fix the iterator position, causing the
element to be skipped in the next iteration.

Some code was also removed that skips over IS_UNDEF elements for
nInternalPointer and iterator positions. This is unnecessary, as this already
happens during iteration.

Closes GH-13178
Closes GH-13188
2024-01-21 23:24:00 +01:00
Alex Dowad
6fa4286ba4 Merge branch 'PHP-8.3'
* PHP-8.3:
  Do not allow zend.script_encoding to be set to 'pass'
2024-01-21 15:14:29 +02:00
Alex Dowad
1e92d47f41 Do not allow zend.script_encoding to be set to 'pass'
When investigating another bug reported by GitHub user 'tstangner',
I discovered that PHP segfaults when the INI parameter
zend.script_encoding is set to "pass". This bug dates back to
December 2022 (caused by yours truly in 953864661a).

If any PHP users in the wild were actually setting zend.script_encoding
to "pass" (which would be an utterly useless thing to do), I expect that
someone would have filed a bug report by now. The absence of such bug
reports is evidence that nobody is doing this.

Hence, it seems that the best fix is simply to disallow "pass" as a
choice for zend.script_encoding. The internal function
'php_mb_zend_encoding_list_parser' which I am modifying to accomplish
this has no other in-tree callers, aside from the 'exif' extension.
Further, exif only calls the function with a few hard-coded values, and
none of them are the string "pass", so this change will not have any
impact on exif.
2024-01-21 14:51:54 +02:00
Niels Dossche
fe064d7f12 Fix GH-13142: Undefined variable name is shortened when contains \0
Uses the new %S formatter and introduces the necessary changes and
helpers.
2024-01-20 23:49:13 +01:00
Niels Dossche
31092c235d Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix GH-13177: PHP 8.3.2: final private constructor not allowed when used in trait
  Fix GH-12107: When running a stored procedure (that returns a result set) twice, PHP crashes
2024-01-19 23:41:01 +01:00
Niels Dossche
c2c1710ed7 Fix GH-13177: PHP 8.3.2: final private constructor not allowed when used in trait
zend_compile has an exception to this rule for constructors using
`zend_is_constructor`, which compares the function name to
`__construct`. Sadly, `zend_is_constructor` is not a public API, but we
can just do the string compare ourselves.

Closes GH-13179.
2024-01-19 23:36:36 +01:00
Ilija Tovilo
ffc250d245
Add runtime type inference verification
Co-authored-by: Dmitry Stogov <dmitry@zend.com>

Closes GH-12930
2024-01-19 09:29:14 +01:00
Ilija Tovilo
bf4ec8bd9d
Use __attribute__((assume())) in ZEND_ASSUME when available
Closes GH-13171
2024-01-19 09:25:55 +01:00
Niels Dossche
dcd2a0dde6
Make return type of trigger_error() and user_error() true (#13169) 2024-01-17 17:15:55 +01:00
Ilija Tovilo
07d2fcc9fc
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix range inference since "proper-range-semantics" RFC
2024-01-17 15:42:40 +01:00
Ilija Tovilo
42cbace1ad
Fix range inference since "proper-range-semantics" RFC
* Arrays returned from range are never empty
* When step is a double value representable by a long, it is coerced implicitly.
  As such, passing a double step no longer guarantees that the result is a
  non-int array.

Closes GH-13166
2024-01-17 15:42:17 +01:00
Niels Dossche
8d5c3e6781
Introduce %S modifier and use it (#13168) 2024-01-16 22:51:02 +01:00
Dmitry Stogov
055c8861cc Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix zend_may_throw() for FETCH_DIM_IS and ISSET_ISEMPTY_DIM_OBJ
2024-01-17 00:32:31 +03:00
Dmitry Stogov
b046143529 Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix zend_may_throw() for FETCH_DIM_IS and ISSET_ISEMPTY_DIM_OBJ
2024-01-17 00:32:14 +03:00
Dmitry Stogov
b33e3eb8c2 Fix zend_may_throw() for FETCH_DIM_IS and ISSET_ISEMPTY_DIM_OBJ
Recentlty this insructions were updated to emit warning on inability to
convert double index to long. This may lead to exception.

This fixes memory leak on wordpress test suite (nightly workflow)
2024-01-17 00:19:43 +03:00
Niels Dossche
4091d2407b Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix GH-13097: Anonymous class reference in trigger_error / thrown Exception
2024-01-16 21:06:29 +01:00
Niels Dossche
764360b1b0 Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix GH-13097: Anonymous class reference in trigger_error / thrown Exception
2024-01-16 21:06:03 +01:00
Niels Dossche
2cde4b2ea4 Fix GH-13097: Anonymous class reference in trigger_error / thrown Exception
Closes GH-13153.
2024-01-16 21:05:04 +01:00
Ilija Tovilo
cbd201192d
Merge branch 'PHP-8.3'
* PHP-8.3:
  strtok is not comptime()
2024-01-14 19:13:25 +01:00