Commit graph

460 commits

Author SHA1 Message Date
Ilija Tovilo
2b5aac9303
Fix unescaped {TMP} variables in tests
On Windows {TMP} can return ~, which will result in a parse error
2023-03-01 13:24:39 +01:00
Bob Weinand
145602f38e Fix bug in zend_test assuming null not being the first type
(I agree that null should come last, but then it should rather throw with a proper message than emit an undefined key warning.)

Signed-off-by: Bob Weinand <bobwei9@hotmail.com>
2023-02-28 12:01:41 +01: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
Máté Kocsis
a981ad7ad2
Merge branch 'PHP-8.2'
* PHP-8.2:
  Add support for generating namespaced constant
2023-02-23 10:49:40 +01:00
SATO Kentaro
7fccdf72a4
Add support for generating namespaced constant
Closes GH-10552
2023-02-23 10:05:30 +01:00
Arnaud Le Blanc
d49e41925b Merge branch 'PHP-8.2'
* PHP-8.2:
  Fix concurrent testing
  [ci skip] NEWS
  Fix GH-10370: File corruption in _php_stream_copy_to_stream_ex when using copy_file_range (#10440)
2023-02-10 13:32:42 +01:00
Arnaud Le Blanc
10f2378584 Fix concurrent testing 2023-02-10 13:31:57 +01:00
Niels Dossche
b4db690cb3
Fix GH-10370: File corruption in _php_stream_copy_to_stream_ex when using copy_file_range (#10440)
copy_file_range can return early without copying all the data. This is
legal behaviour and worked properly, unless the mmap fallback was used.
The mmap fallback would read too much data into the destination,
corrupting the destination file. Furthermore, if the mmap fallback would
fail and have to fallback to the regular file copying mechanism, a
similar issue would occur because both maxlen and haveread are modified.
Furthermore, there was a mmap-resource in one of the failure paths of
the mmap fallback code.
This patch fixes these issues. This also adds regression tests using the
new copy_file_range early-return simulation added in the previous
commit.
2023-02-10 13:08:44 +01:00
Niels Dossche
c2d4bafc4f Copy UTF-8 flag for str_repeat 2023-02-05 14:32:50 +00:00
George Peter Banyard
64127b66c6 Concatenating two valid UTF-8 strings produces a valid UTF-8 string
The UTF-8 valid flag needs to be copied upon interning,
otherwise strings that are concatenated at compile time lose this information.

However, if previously this string was interned without the flag it is not added
E.g. in the case the string is an existing class name.

Co-authored-by: Niels Dossche <7771979+nielsdos@users.noreply.github.com>
2023-02-02 12:02:36 +00:00
George Peter Banyard
78720e39a6 Mark numeric strings as valid UTF-8 2023-02-02 12:02:36 +00:00
George Peter Banyard
0c9181b646 Add function in zend_test to check UTF8 flag is added
Also add test to check what strings are marked as having the flag
2023-02-02 12:02:36 +00: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
Bob Weinand
1fbe855971 Honor constant expressions instead of just taking the last constant encountered in stubs
As an example:
should be translated to:
ZVAL_LONG(&attribute_Attribute_class_test_arg0, ZEND_ATTRIBUTE_TARGET_FUNCTION | ZEND_ATTRIBUTE_TARGET_METHOD);
2023-01-22 21:24:54 +01:00
Tim Düsterhus
3e48e52d93
Register parameter attributes via stub in ext/zend_test (#10183) 2022-12-29 23:17:02 +01:00
Arnaud Le Blanc
a11c8a3039
Limit stack size (#9104) 2022-12-16 17:44:26 +01:00
Ilija Tovilo
bcad968b3b
Merge branch 'PHP-8.2'
* PHP-8.2:
  Disable opcache file_cache for observer preloading test
2022-11-11 19:33:52 +01:00
Ilija Tovilo
09f071e63b
Disable opcache file_cache for observer preloading test 2022-11-11 19:33:32 +01:00
Ilija Tovilo
e45afbf0ca
Merge branch 'PHP-8.2'
* PHP-8.2:
  [skip ci] Skip preloading test on Windows
2022-11-09 20:22:27 +01:00
Ilija Tovilo
12e2610594
[skip ci] Skip preloading test on Windows 2022-11-09 20:22:10 +01:00
Bob Weinand
2cab4874ad Merge branch 'PHP-8.2' 2022-11-09 16:36:50 +01:00
Bob Weinand
4052bbf0e3 Fix opcache preload with observers enabled
Signed-off-by: Bob Weinand <bobwei9@hotmail.com>
2022-11-09 16:36:28 +01:00
Ilija Tovilo
28dd6006c0
Merge branch 'PHP-8.2'
* PHP-8.2:
  Properly deal with internal attributes used on promoted properties.
2022-11-03 14:29:44 +01:00
Martin Schröder
fdd088fc81
Properly deal with internal attributes used on promoted properties.
Closes GH-9661
2022-11-03 14:29:22 +01:00
Bob Weinand
ef5ed06d3c Merge branch 'PHP-8.2' 2022-11-02 16:55:42 +01:00
Bob Weinand
8e49d7f32f Delay releasing closures until after observer end 2022-11-02 16:55:13 +01:00
Bob Weinand
cd7e98a82b Merge branch 'PHP-8.2' 2022-11-02 16:02:38 +01:00
Bob Weinand
4935e10fc8 Fix hardcoded paths in test 2022-11-02 16:02:16 +01:00
Bob Weinand
98646e3e21 Merge branch 'PHP-8.2' 2022-11-02 15:33:17 +01:00
Bob Weinand
b30448f48f Fix observing inherited internal functions
Fixes GH-9871
2022-11-02 15:33:04 +01:00
Christoph M. Becker
b2199f9559
Merge branch 'PHP-8.2'
* PHP-8.2:
  Don’t reset func in zend_closure_internal_handler
2022-11-02 14:02:34 +01:00
Florian Sowade
8dabbda8bc Don’t reset func in zend_closure_internal_handler
The pointer is used in _zend_observe_fcall_begin().
2022-11-02 11:46:43 +01:00
Bob Weinand
56d2c76249 Merge branch 'PHP-8.2' 2022-10-26 12:23:04 +02:00
Florian Sowade
56c121cea2 Initialize run time cache in PDO methods (#9818)
Without the memset the memory was uninitialized and the new test segfaulted when accessing the memory in _zend_observe_fcall_begin().
2022-10-26 12:21:41 +02:00
Máté Kocsis
c153ec877f
Merge branch 'PHP-8.2'
* PHP-8.2:
  Improve string class constant code generation
2022-09-26 23:13:31 +02:00
Máté Kocsis
e4f2376919
Improve string class constant code generation (#9577)
Using strlen() will make sure that non-constant values can also be used.
2022-09-26 23:12:34 +02:00
Ilija Tovilo
17b0e498e5
Merge branch 'PHP-8.2'
* PHP-8.2:
  Fix class link observer with file_cache_only=1
2022-09-16 14:15:43 +02:00
Ilija Tovilo
6622c54c53
Fix class link observer with file_cache_only=1
Previously, notify would only get called on classes with CE_CACHE.
However, during compilation class names are non-permanent which won't
get a CE_CACHE and thus wouldn't not get notified.

Closes GH-9550
2022-09-16 14:15:05 +02:00
Bob Weinand
a01dd9feda Revert "Port all internally used classes to use default_object_handlers"
This reverts commit 94ee4f9834.

The commit was a bit too late to be included in PHP 8.2 RC1. Given it's a massive ABI break, we decide to postpone the change to PHP 8.3.
2022-09-14 11:13:23 +02:00
George Peter Banyard
163c0b5f4c Merge branch 'PHP-8.2' 2022-09-06 10:42:34 +01:00
George Peter Banyard
3e362f51ac Add zend_string INI validators
Currently we only have validators for char* which is rather annoying as INI settings are saved as zend_string* in the first place

Closes GH-9328
2022-09-06 10:41:47 +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
Máté Kocsis
c547fc183c
Add support for validation of missing class synopses (#9472) 2022-09-05 14:21:15 +02:00
Bob Weinand
94ee4f9834 Port all internally used classes to use default_object_handlers
Signed-off-by: Bob Weinand <bobwei9@hotmail.com>
2022-08-31 16:45:27 +02:00
Máté Kocsis
8d78dce902
Remove unused ext/zend_test alias functions 2022-08-30 11:57:29 +02:00
Máté Kocsis
869ab3c481
Adjust PHPDoc 2022-08-30 11:56:29 +02:00
Máté Kocsis
ef21bbe66c
Fix zend/test aliases 2022-08-30 11:48:12 +02:00
Andreas Braun
f7d42f646b
Update gen_stub to avoid compile errors on duplicate function names
Closes GH-9406
2022-08-30 11:33:45 +02:00
Máté Kocsis
b4ec3e9bc0
Do not generate CONST_CS when registering constants (#9439) 2022-08-28 08:27:19 +02:00
Bob Weinand
bf427b732a Add an API to observe functions and classes being linked
To observe when the functions and classes start being officially available to the user

Signed-off-by: Bob Weinand <bobwei9@hotmail.com>
2022-08-23 15:22:22 +02:00