1
0
mirror of https://github.com/php/php-src.git synced 2026-03-26 01:02:25 +01:00
Commit Graph

365 Commits

Author SHA1 Message Date
Peter Kokot
e3f118e351 Fix typo in FFI 77706 test title
This test is for the bug 77706 (Improve error messages in FFI for
incompatible arguments).

[skip ci]
2024-01-17 08:11:23 +01:00
David CARLIER
9726721560 general signatures discrepencies fixes (#13122) 2024-01-10 22:19:23 +00:00
Cristian Rodríguez
927adfb1a6 Use a single version of mempcpy(3) (#12257)
While __php_mempcpy is only used by ext/standard/crypt_sha*, the
mempcpy "pattern" is used everywhere.

This commit removes __php_mempcpy, adds zend_mempcpy and transforms
open-coded parts into function calls.
2023-12-20 15:16:32 +00:00
Niels Dossche
1fc85a30b3 Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix GH-12905: FFI::new interacts badly with observers
2023-12-19 15:59:43 +01:00
Niels Dossche
87c906c33a Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix GH-12905: FFI::new interacts badly with observers
2023-12-19 15:59:35 +01:00
Niels Dossche
c727f29942 Fix GH-12905: FFI::new interacts badly with observers
Because these functions are copied and not properly registered (which we
can't), the observer code doesn't add the temporaries on startup.
Add them via a callback during startup.

Closes GH-12906.
2023-12-19 15:59:01 +01:00
Jakub Zelenka
d6299206dd Merge branch 'PHP-8.3' 2023-12-15 14:14:15 +00:00
Jakub Zelenka
1b8be9acf0 Merge branch 'PHP-8.2' into PHP-8.3 2023-12-15 14:13:41 +00:00
Jakub Zelenka
40ccc8ea7e Fix GH-9698: stream_wrapper_register crashes with FFI\CData provided as class
Closes GH-12926
2023-12-15 14:11:56 +00:00
Dmitry Stogov
889dadd636 Merge branch 'PHP-8.3'
* PHP-8.3:
  Fixed regression introduced by https://github.com/php/php-src/pull/9601
2023-11-22 21:25:45 +03:00
Dmitry Stogov
adaf726373 Fixed regression introduced by https://github.com/php/php-src/pull/9601 2023-11-22 21:25:15 +03:00
David CARLIER
cc2bf11951 zend: introducing ZEND_ELEMENT_COUNT for struct's dynamic arrays. (#12650)
zend: introducing ZEND_ELEMENT_COUNT for struct's dynamic and flexible arrays.

It is mostly for ubsan and helping array bound checking.
2023-11-13 12:42:45 +00:00
Niels Dossche
d36f1bae86 Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix FFI tests on 8.3+
2023-10-28 16:28:52 +02:00
Niels Dossche
43064cae94 Fix FFI tests on 8.3+ 2023-10-28 16:28:43 +02:00
Arnaud Le Blanc
d30c78d7f9 Merge branch 'PHP-8.3'
* PHP-8.3:
  [ci skip] NEWS
  [ci skip] NEWS
  [ci skip] NEWS
  Fix segfault caused by weak references to FFI objects (#12488)
2023-10-28 15:06:36 +02:00
Arnaud Le Blanc
198f613401 Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  [ci skip] NEWS
  [ci skip] NEWS
  Fix segfault caused by weak references to FFI objects (#12488)
2023-10-28 15:05:55 +02:00
Arnaud Le Blanc
7a617ee223 Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  [ci skip] NEWS
  Fix segfault caused by weak references to FFI objects (#12488)
2023-10-28 15:03:17 +02:00
sji
04b35a44ce Fix segfault caused by weak references to FFI objects (#12488)
Thank you!
2023-10-28 14:59:06 +02:00
Ilija Tovilo
f39b5c4c25 Close PHP tags in tests
Closes GH-12422
2023-10-18 17:34:10 +02:00
Ilija Tovilo
692cea5cbc Use zend_error_noreturn for E_ERROR consistently
To be clear, these already don't return. zend_error_noreturn just hints at this
fact through the ZEND_NORETURN attribute.

Closes GH-12204
2023-09-14 11:44:55 +02:00
Niels Dossche
0b9702c9ed Implement GH-11934: Allow to pass CData into struct and/or union fields
Co-authored-by: KapitanOczywisty <44417092+KapitanOczywisty@users.noreply.github.com>

Closes GH-11935.
2023-08-29 17:01:10 +02:00
Ilija Tovilo
ac99f7306c Fix merge conflict
Sorry...
2023-07-21 11:17:01 +02:00
Ilija Tovilo
84cb42e0f1 Merge branch 'PHP-8.2'
* PHP-8.2:
  Fix leaking definitions on FFI::cdef()->new()
2023-07-21 10:43:13 +02:00
Ilija Tovilo
88fab26365 Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix leaking definitions on FFI::cdef()->new()
2023-07-21 10:42:42 +02:00
Ilija Tovilo
11d6bea98a Fix leaking definitions on FFI::cdef()->new()
Previously, FFI_G(symbols) and FFI_G(tags) were never cleaned up when calling
new on an existing object. However, if cdef() is called without parameters these
globals are NULL and might be created when new() creates new definitions. These
would then be discarded without freeing them.

Closes GH-11751
2023-07-21 10:42:19 +02:00
Máté Kocsis
4acf0084dc Deprecate calling FFI::cast(), FFI::new(), and FFI::type() statically 2023-07-18 12:59:21 +02:00
Máté Kocsis
6988973bc6 Declare type for ext/ffi internal class constants
Since the relevant classes are final, it's straightforward to declare the type of these class constants
2023-07-18 10:09:26 +02:00
Ilija Tovilo
7b355e8d34 Revert "Merge branch 'PHP-8.2'"
This reverts commit 45a3f178dc, reversing
changes made to b2a54bc6af.
2023-07-04 09:18:49 +02:00
Máté Kocsis
45a3f178dc Merge branch 'PHP-8.2'
* PHP-8.2:
  Fix GH-9967 Add support for generating custom function, class const, and property attributes in stubs

Closes GH-10170
2023-07-03 11:17:08 +02:00
George Peter Banyard
82e761eaac Fix [-Wenum-int-mismatch] compiler warnings (#11352) 2023-06-01 13:27:46 +01:00
Ilija Tovilo
50f58c8923 Add ASAN XLEAK support
Only disable LSAN instead of skipping the test. This way we can still detect
memory issues which is arguably more important anyway.

Closes GH-10996
2023-04-03 08:02:19 +02:00
Ilija Tovilo
f1333bc9fe Merge branch 'PHP-8.2'
* PHP-8.2:
  Reset EG(trampoline).op_array.last_var that FFI may modify
2023-03-27 23:00:12 +02:00
Ilija Tovilo
69c57bea3d Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Reset EG(trampoline).op_array.last_var that FFI may modify
2023-03-27 22:59:58 +02:00
Ilija Tovilo
4e0bd03681 Reset EG(trampoline).op_array.last_var that FFI may modify
Closes GH-10916
2023-03-27 22:59:00 +02:00
Max Kellermann
d5c649b36b zend_compiler, ...: use uint8_t instead of zend_uchar (#10621)
`zend_uchar` suggests that the value is an ASCII character, but here,
it's about very small integers.  This is misleading, so let's use a
C99 integer instead.

On all architectures currently supported by PHP, `zend_uchar` and
`uint8_t` are identical.  This change is only about code readability.
2023-02-23 14:56:54 +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
Dmitry Stogov
851e4623f5 Make C functions returning "void" to return PHP "null"
In PHP-2.0 and below we by mistake returned "obcect(FFI\CData:void)#2 (0) {}".
We decided not to fix this in PHP-2.0 and below to aboid BC breaks.
2023-02-13 22:42:39 +03:00
Dmitry Stogov
2abb5850ba Merge branch 'PHP-8.2'
* PHP-8.2:
  Fix assertion failure when var_dump'ing void FFI result (#10568)
2023-02-13 22:38:52 +03:00
Dmitry Stogov
cec528d06b Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix assertion failure when var_dump'ing void FFI result (#10568)
2023-02-13 22:38:43 +03:00
Niels Dossche
1a5fc6e1a3 Fix assertion failure when var_dump'ing void FFI result (#10568) 2023-02-13 22:38:28 +03:00
rj1
d2cdfdbe44 fixed some misspellings (#10503) 2023-02-04 07:03:10 +00:00
Tyson Andre
ab87283118 Merge branch 'PHP-8.2' 2023-02-03 09:23:48 -05:00
Tyson Andre
e3f04ddb0b Merge branch 'PHP-8.1' into PHP-8.2 2023-02-03 09:18:03 -05:00
Tyson Andre
fe2dc2b481 Avoid crash for reset/end/next/prev() on ffi classes (#9711)
(And any PECLs returning `zend_empty_array` in the handler->get_properties
overrides)

Closes GH-9697

This is similar to the fix used in d9651a9419
for array_walk.

This should make it safer for php-src (and PECLs, long-term) to return
the empty immutable array in `handler->get_properties` to avoid wasting memory.
See https://github.com/php/php-src/issues/9697#issuecomment-1273613175

The only possible internal iterator position for the empty array is at the end
of the empty array (nInternalPointer=0).
The `zend_hash*del*` helpers will always set nInternalPointer to 0 when an
array becomes empty,
regardless of previous insertions/deletions/updates to the array.
2023-02-03 09:17:33 -05:00
Dmitry Stogov
4cd929877e Merge branch 'PHP-8.2'
* PHP-8.2:
  Fix incorrect bitshifting and masking in ffi bitfield (#10403)
2023-01-24 09:15:44 +03:00
Dmitry Stogov
d5b307c434 Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix incorrect bitshifting and masking in ffi bitfield (#10403)
2023-01-24 09:15:27 +03:00
Niels Dossche
560ca9c7ae Fix incorrect bitshifting and masking in ffi bitfield (#10403)
When a uint8_t is bitshifted to the left, it is actually promoted to an
int. For the current code this has the effect of a wrong sign-extension,
and the result will also wrongly become zero when insert_pos >= 32.
Fix this by adding an explicit cast.
Furthermore, the partial prefix byte mask was computed incorrectly: the
byte is already shifted so the mask should not account for the shift.
2023-01-24 09:15:03 +03:00
Máté Kocsis
7936c8085e Fix GH-8329 Print true/false instead of bool in error and debug messages (#8385) 2023-01-23 10:52:14 +01:00
Máté Kocsis
7a9726d651 Merge branch 'PHP-8.2'
- PHP-8.2:
  Customize the link of some constants in the manual
2023-01-19 09:06:39 +01:00
Máté Kocsis
148ac364e9 Customize the link of some constants in the manual
These changes are necessary because the links which are generated by default are already taken.
2023-01-19 09:05:32 +01:00