Skip to content

Commit 7a9c2b4

Browse files
Merge branch 'php:master' into master
2 parents dbef9c3 + 334ecbe commit 7a9c2b4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+520
-240
lines changed

UPGRADING.INTERNALS

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,23 @@ PHP 8.3 INTERNALS UPGRADE NOTES
4343
- A new function php_json_validate_ex has been added to check if the
4444
provided C string is valid for the given depth and options.
4545

46+
b. ext/standard
47+
- The PHPAPI php_url_encode_hash_ex() function has had its signature change
48+
from:
49+
PHPAPI void php_url_encode_hash_ex(HashTable *ht, smart_str *formstr,
50+
const char *num_prefix, size_t num_prefix_len,
51+
const char *key_prefix, size_t key_prefix_len,
52+
const char *key_suffix, size_t key_suffix_len,
53+
zval *type, const char *arg_sep, int enc_type);
54+
to:
55+
PHPAPI void php_url_encode_hash_ex(HashTable *ht, smart_str *formstr,
56+
const char *num_prefix, size_t num_prefix_len,
57+
const zend_string *key_prefix,
58+
zval *type, const zend_string *arg_sep, int enc_type);
59+
The change to use zend_string prevent the computation of the arg_sep
60+
length at each call. The key_suffix parameter was dropped as it was a
61+
constant value and depended on the key_prefix parameter to not be NULL.
62+
4663
========================
4764
4. OpCode changes
4865
========================

Zend/zend_API.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,13 @@
1919
+----------------------------------------------------------------------+
2020
*/
2121

22-
#include "zend.h"
23-
#include "zend_execute.h"
2422
#include "zend_API.h"
25-
#include "zend_modules.h"
23+
#include "zend_arena.h"
24+
#include "zend_objects.h" // for zend_objects_new()
2625
#include "zend_extensions.h"
2726
#include "zend_constants.h"
28-
#include "zend_interfaces.h"
27+
#include "zend_interfaces.h" // for zend_ce_stringable
2928
#include "zend_exceptions.h"
30-
#include "zend_closures.h"
3129
#include "zend_inheritance.h"
3230
#include "zend_ini.h"
3331
#include "zend_enum.h"

Zend/zend_API.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@
2222
#ifndef ZEND_API_H
2323
#define ZEND_API_H
2424

25-
#include "zend_modules.h"
26-
#include "zend_list.h"
27-
#include "zend_operators.h"
28-
#include "zend_variables.h"
29-
#include "zend_execute.h"
30-
#include "zend_type_info.h"
25+
#include "zend_compile.h" // for zif_handler
26+
#include "zend_execute.h" // for get_active_function_or_method_name()
27+
#include "zend_globals.h" // for struct _zend_compiler_globals used by ZEND_MAP_PTR_GET_IMM()
28+
#include "zend_globals_macros.h" // for CG() used by ZEND_MAP_PTR_GET_IMM()
29+
#include "zend_portability.h" // for BEGIN_EXTERN_C
3130

31+
typedef struct _zend_module_entry zend_module_entry;
3232

3333
BEGIN_EXTERN_C()
3434

Zend/zend_ast.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@
1818
*/
1919

2020
#include "zend_ast.h"
21-
#include "zend_API.h"
22-
#include "zend_operators.h"
23-
#include "zend_language_parser.h"
24-
#include "zend_smart_str.h"
25-
#include "zend_exceptions.h"
21+
#include "zend_API.h" // for array_set_zval_key
22+
#include "zend_arena.h"
2623
#include "zend_constants.h"
2724
#include "zend_enum.h"
25+
#include "zend_language_parser.h" // for T_*
26+
#include "zend_smart_str.h"
27+
#include "zend_exceptions.h" // for zend_throw_error
2828

2929
ZEND_API zend_ast_process_t zend_ast_process = NULL;
3030

Zend/zend_ast.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@
2121
#ifndef ZEND_AST_H
2222
#define ZEND_AST_H
2323

24-
#include "zend.h"
24+
#include "zend_types.h" // for zval
25+
26+
#include <stdint.h>
2527

2628
#ifndef ZEND_AST_SPEC
2729
# define ZEND_AST_SPEC 1

Zend/zend_call_stack.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@
1818

1919
/* Inspired from Chromium's stack_util.cc */
2020

21-
#include "zend.h"
22-
#include "zend_globals.h"
23-
#include "zend_portability.h"
2421
#include "zend_call_stack.h"
22+
#include "zend_globals.h"
23+
2524
#include <stdint.h>
25+
2626
#ifdef ZEND_WIN32
2727
# include <processthreadsapi.h>
2828
# include <memoryapi.h>

Zend/zend_call_stack.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,14 @@
1919
#ifndef ZEND_CALL_STACK_H
2020
#define ZEND_CALL_STACK_H
2121

22-
#include "zend.h"
23-
#include "zend_portability.h"
22+
#include "zend_portability.h" // for zend_always_inline
23+
2424
#ifdef __APPLE__
2525
# include <pthread.h>
2626
#endif
2727

28+
#include <stdbool.h>
29+
2830
#ifdef ZEND_CHECK_STACK_LIMIT
2931

3032
typedef struct _zend_call_stack {

Zend/zend_closures.c

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,11 @@
1818
+----------------------------------------------------------------------+
1919
*/
2020

21-
#include "zend.h"
22-
#include "zend_API.h"
2321
#include "zend_closures.h"
24-
#include "zend_exceptions.h"
25-
#include "zend_interfaces.h"
26-
#include "zend_objects.h"
27-
#include "zend_objects_API.h"
28-
#include "zend_globals.h"
22+
#include "zend_API.h" //for ZEND_METHOD()
23+
#include "zend_arena.h"
24+
#include "zend_compile.h" // for union _zend_function
25+
#include "zend_objects.h" // for zend_object_std_init()
2926
#include "zend_closures_arginfo.h"
3027

3128
typedef struct _zend_closure {

Zend/zend_closures.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,15 @@
2020
#ifndef ZEND_CLOSURES_H
2121
#define ZEND_CLOSURES_H
2222

23+
#include "zend_portability.h" // for BEGIN_EXTERN_C
24+
25+
typedef struct _zend_class_entry zend_class_entry;
26+
typedef struct _zend_execute_data zend_execute_data;
27+
typedef union _zend_function zend_function;
28+
typedef struct _zend_object zend_object;
29+
typedef struct _zend_string zend_string;
30+
typedef struct _zval_struct zval;
31+
2332
BEGIN_EXTERN_C()
2433

2534
/* This macro depends on zend_closure structure layout */

Zend/zend_compile.c

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -18,23 +18,23 @@
1818
+----------------------------------------------------------------------+
1919
*/
2020

21-
#include <zend_language_parser.h>
22-
#include "zend.h"
23-
#include "zend_attributes.h"
2421
#include "zend_compile.h"
22+
#include "zend_API.h" // for zend_get_object_type()
23+
#include "zend_arena.h"
24+
#include "zend_attributes.h"
2525
#include "zend_constants.h"
26-
#include "zend_llist.h"
27-
#include "zend_API.h"
28-
#include "zend_exceptions.h"
29-
#include "zend_interfaces.h"
30-
#include "zend_virtual_cwd.h"
31-
#include "zend_multibyte.h"
32-
#include "zend_language_scanner.h"
33-
#include "zend_inheritance.h"
34-
#include "zend_vm.h"
3526
#include "zend_enum.h"
36-
#include "zend_observer.h"
37-
#include "zend_call_stack.h"
27+
#include "zend_exceptions.h" // for zend_throw_exception_ex()
28+
#include "zend_globals.h" // struct _zend_compiler_globals
29+
#include "zend_globals_macros.h" // for CG()
30+
#include "zend_inheritance.h" // for zend_do_link_class()
31+
#include "zend_language_parser.h"
32+
#include "zend_language_scanner.h"
33+
#include "zend_list.h" // for zend_init_rsrc_list()
34+
#include "zend_observer.h" // for zend_observer_function_declared_notify()
35+
#include "zend_type_info.h" // for MAY_BE_*
36+
#include "zend_virtual_cwd.h" // for IS_SLASH_P, DEFAULT_SLASH
37+
#include "zend_vm.h" // for ZEND_VM_SET_OPCODE_HANDLER()
3838

3939
#define SET_NODE(target, src) do { \
4040
target ## _type = (src)->op_type; \

Zend/zend_compile.h

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,12 @@
2020
#ifndef ZEND_COMPILE_H
2121
#define ZEND_COMPILE_H
2222

23-
#include "zend.h"
23+
#include "zend.h" // for INTERNAL_FUNCTION_PARAMETERS
2424
#include "zend_ast.h"
25+
#include "zend_portability.h" //for ZEND_FASTCALL
26+
#include "zend_types.h" // for zend_uchar
2527

26-
#include <stdarg.h>
27-
28-
#include "zend_llist.h"
28+
#include <stdint.h>
2929

3030
#define SET_UNUSED(op) do { \
3131
op ## _type = IS_UNUSED; \
@@ -758,8 +758,6 @@ struct _zend_execute_data {
758758

759759
#define ZEND_EXTRA_VALUE 1
760760

761-
#include "zend_globals.h"
762-
763761
typedef enum _zend_compile_position {
764762
ZEND_COMPILE_POSITION_AT_SHEBANG = 0,
765763
ZEND_COMPILE_POSITION_AT_OPEN_TAG,

Zend/zend_enum.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@
1616
+----------------------------------------------------------------------+
1717
*/
1818

19-
#include "zend.h"
20-
#include "zend_API.h"
21-
#include "zend_compile.h"
19+
#include "zend_enum.h"
20+
#include "zend_arena.h" // ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX2
21+
#include "zend_API.h" // for INIT_CLASS_ENTRY_EX()
2222
#include "zend_enum_arginfo.h"
2323
#include "zend_interfaces.h"
24-
#include "zend_enum.h"
25-
#include "zend_extensions.h"
24+
#include "zend_extensions.h" // for zend_internal_run_time_cache_reserved_size()
25+
#include "zend_objects.h" // for zend_objects_new()
2626
#include "zend_observer.h"
2727

2828
#define ZEND_ENUM_DISALLOW_MAGIC_METHOD(propertyName, methodName) \

Zend/zend_enum.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,11 @@
1919
#ifndef ZEND_ENUM_H
2020
#define ZEND_ENUM_H
2121

22-
#include "zend.h"
23-
#include "zend_types.h"
22+
#include "zend_compile.h" // for OBJ_PROP_NUM
23+
#include "zend_portability.h" // for BEGIN_EXTERN_C
24+
25+
typedef struct _zend_class_entry zend_class_entry;
26+
typedef struct _zend_function_entry zend_function_entry;
2427

2528
BEGIN_EXTERN_C()
2629

Zend/zend_execute.h

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,12 @@
2222
#define ZEND_EXECUTE_H
2323

2424
#include "zend_compile.h" // for zend_op_array
25+
#include "zend_globals.h" // for struct _zend_executor_globals
26+
#include "zend_globals_macros.h" // for EG()
2527
#include "zend_list.h" // for zend_rsrc_list_get_rsrc_type()
2628
#include "zend_portability.h" // for BEGIN_EXTERN_C
2729
#include "zend_types.h" // for zend_execute_data
2830

29-
#if ZEND_DEBUG
30-
#include "zend_globals.h" // for struct _zend_executor_globals
31-
#include "zend_globals_macros.h" // for EG()
32-
#endif
33-
3431
BEGIN_EXTERN_C()
3532
struct _zend_fcall_info;
3633
ZEND_API extern void (*zend_execute_ex)(zend_execute_data *execute_data);

Zend/zend_gc.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,14 @@
6666
*
6767
* @see http://researcher.watson.ibm.com/researcher/files/us-bacon/Bacon01Concurrent.pdf
6868
*/
69-
#include "zend.h"
70-
#include "zend_API.h"
71-
#include "zend_fibers.h"
69+
70+
#include "zend_gc.h"
71+
#include "zend_alloc.h" // for ZEND_MM_OVERHEAD
72+
#include "zend_fibers.h" // for zend_fiber_switch_block()
73+
#include "zend_globals.h" // for struct _zend_executor_globals
74+
#include "zend_globals_macros.h" // for EG()
75+
#include "zend_objects.h" // for zend_objects_destroy_object()
76+
#include "zend.h" // for zend_error()
7277

7378
#ifndef GC_BENCH
7479
# define GC_BENCH 0

Zend/zend_gc.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@
2020
#ifndef ZEND_GC_H
2121
#define ZEND_GC_H
2222

23+
#include "zend_portability.h" // for BEGIN_EXTERN_C
24+
#include "zend_types.h" // for GC_TYPE_INFO()
25+
2326
BEGIN_EXTERN_C()
2427

2528
typedef struct _zend_gc_status {

Zend/zend_globals_macros.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
#ifndef ZEND_GLOBALS_MACROS_H
2121
#define ZEND_GLOBALS_MACROS_H
2222

23+
#include "zend_portability.h" // for BEGIN_EXTERN_C
24+
2325
typedef struct _zend_compiler_globals zend_compiler_globals;
2426
typedef struct _zend_executor_globals zend_executor_globals;
2527
typedef struct _zend_php_scanner_globals zend_php_scanner_globals;

Zend/zend_inheritance.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
*/
1919

2020
#include "zend.h"
21+
#include "zend_arena.h"
2122
#include "zend_API.h"
2223
#include "zend_compile.h"
2324
#include "zend_execute.h"

Zend/zend_ini.c

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -519,6 +519,46 @@ ZEND_API char *zend_ini_string(const char *name, size_t name_length, int orig) /
519519
}
520520
/* }}} */
521521

522+
523+
ZEND_API zend_string *zend_ini_str_ex(const char *name, size_t name_length, bool orig, bool *exists) /* {{{ */
524+
{
525+
zend_ini_entry *ini_entry;
526+
527+
ini_entry = zend_hash_str_find_ptr(EG(ini_directives), name, name_length);
528+
if (ini_entry) {
529+
if (exists) {
530+
*exists = 1;
531+
}
532+
533+
if (orig && ini_entry->modified) {
534+
return ini_entry->orig_value ? ini_entry->orig_value : NULL;
535+
} else {
536+
return ini_entry->value ? ini_entry->value : NULL;
537+
}
538+
} else {
539+
if (exists) {
540+
*exists = 0;
541+
}
542+
return NULL;
543+
}
544+
}
545+
/* }}} */
546+
547+
ZEND_API zend_string *zend_ini_str(const char *name, size_t name_length, bool orig) /* {{{ */
548+
{
549+
bool exists = 1;
550+
zend_string *return_value;
551+
552+
return_value = zend_ini_str_ex(name, name_length, orig, &exists);
553+
if (!exists) {
554+
return NULL;
555+
} else if (!return_value) {
556+
return_value = ZSTR_EMPTY_ALLOC();
557+
}
558+
return return_value;
559+
}
560+
/* }}} */
561+
522562
ZEND_API zend_string *zend_ini_get_value(zend_string *name) /* {{{ */
523563
{
524564
zend_ini_entry *ini_entry;

Zend/zend_ini.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,8 @@ ZEND_API zend_long zend_ini_long(const char *name, size_t name_length, int orig)
9999
ZEND_API double zend_ini_double(const char *name, size_t name_length, int orig);
100100
ZEND_API char *zend_ini_string(const char *name, size_t name_length, int orig);
101101
ZEND_API char *zend_ini_string_ex(const char *name, size_t name_length, int orig, bool *exists);
102+
ZEND_API zend_string *zend_ini_str(const char *name, size_t name_length, bool orig);
103+
ZEND_API zend_string *zend_ini_str_ex(const char *name, size_t name_length, bool orig, bool *exists);
102104
ZEND_API zend_string *zend_ini_get_value(zend_string *name);
103105
ZEND_API bool zend_ini_parse_bool(zend_string *str);
104106

Zend/zend_interfaces.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,13 @@
1616
+----------------------------------------------------------------------+
1717
*/
1818

19+
#include "zend_interfaces.h"
1920
#include "zend.h"
2021
#include "zend_API.h"
21-
#include "zend_interfaces.h"
22+
#include "zend_arena.h"
2223
#include "zend_exceptions.h"
2324
#include "zend_interfaces_arginfo.h"
25+
#include "zend_objects.h" // for zend_object_std_init()
2426

2527
ZEND_API zend_class_entry *zend_ce_traversable;
2628
ZEND_API zend_class_entry *zend_ce_aggregate;

0 commit comments

Comments
 (0)