Skip to content

Commit 021fd94

Browse files
committed
Merge branch 'master' into assert
* master: (59 commits) Improved ASSIGN_DIM handler Don't inline slow path Revert a part committted by mistake Fixed compilation warnings Fixed a bug that header value is not terminated by '\0' when accessed through getenv(). better name Improve fix for #69038 Update NEWs Fixed bug #69108 ("Segmentation fault" when (de)serializing SplObjectStorage) Added specialized versions of DO_FCALL handler: DO_ICALL - for internal functions DO_UCALL - for user functions DO_FCALL_BY_NAME - plain, most probably user, funcstions (not methods) Use cache_slot offsets instead of indexes (simplify run-time instructions) Split INIT_FCALL_BY_NAME inti INIT_FCALL_BY_NAME(CONST+STRING) and INIT_DYNAMIC_CALL(CONST-STRING|TMPVAR|CV) Support list($a, $b) = $a Avoid unnecassary check Make zend_array_destroy() to free the corresponding zend_array Eliminate check on the fast path Make current() and key() receive argument by value. Use Firebird default home folder, replace Interbase with Firebird Updated NEWS updated NEWS ... Conflicts: Zend/zend_vm_execute.h Zend/zend_vm_opcodes.c Zend/zend_vm_opcodes.h
2 parents 49963eb + ace1f82 commit 021fd94

Some content is hidden

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

70 files changed

+2596
-1551
lines changed

NEWS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
. Implemented FR #55467 (phpinfo: PHP Variables with $ and single quotes). (Kalle)
3535
. Fixed bug #55415 (php_info produces invalid anchor names). (Kalle, Johannes)
3636
. Added ?? operator. (Andrea)
37+
. Added <=> operator. (Andrea)
3738
. Added \u{xxxxx} Unicode Codepoint Escape Syntax. (Andrea)
3839
. Fixed oversight where define() did not support arrays yet const syntax did. (Andrea, Dmitry)
3940
. Use "integer" and "float" instead of "long" and "double" in ZPP, type hint and conversion error messages. (Andrea)

UPGRADING

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -398,6 +398,8 @@ Other
398398
. Added \u{xxxxxx} Unicode Codepoint Escape Syntax for double-quoted strings
399399
and heredocs.
400400
. define() now supports arrays as constant values, fixing an oversight where define() did not support arrays yet const syntax did.
401+
. Added the comparison operator (<=>), aka the spaceship operator.
402+
(RFC: https://wiki.php.net/rfc/combined-comparison-operator)
401403

402404
========================================
403405
3. Changes in SAPI modules

Zend/tests/bug69092.2.phpt

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
--TEST--
2+
Bug #69092-2 (Declare Encoding Compile Check Wrong) - multibyte off
3+
--INI--
4+
zend.multibyte=0
5+
--FILE--
6+
<?php
7+
echo "Hi";
8+
9+
function foo() {
10+
declare(encoding="UTF-8");
11+
}
12+
13+
echo "Bye"
14+
?>
15+
--EXPECTF--
16+
Warning: declare(encoding=...) ignored because Zend multibyte feature is turned off by settings in %s on line %d
17+
18+
Fatal error: Encoding declaration pragma must be the very first statement in the script in %s on line %d

Zend/tests/bug69092.phpt

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
--TEST--
2+
Bug #69092 (Declare Encoding Compile Check Wrong)
3+
--SKIPIF--
4+
<?php
5+
if (!extension_loaded("mbstring")) {
6+
die("skip Requires mbstring extension");
7+
}
8+
?>
9+
--INI--
10+
zend.multibyte=On
11+
--FILE--
12+
<?php
13+
echo "Hi";
14+
15+
function foo() {
16+
declare(encoding="utf-8");
17+
}
18+
19+
echo "Bye"
20+
?>
21+
--EXPECTF--
22+
Fatal error: Encoding declaration pragma must be the very first statement in the script in %s on line %d

Zend/tests/gc_034.phpt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
--TEST--
2+
GC 034: GC in request shutdown and resource list destroy
3+
--FILE--
4+
<?php
5+
/* run with valgrind */
6+
$a = array(fopen(__FILE__, 'r'));
7+
$a[] = &$a;
8+
?>
9+
==DONE==
10+
--EXPECT--
11+
==DONE==

Zend/tests/list_self_assign.phpt

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
--TEST--
2+
Test variable occuring on both LHS and RHS of list()
3+
--FILE--
4+
<?php
5+
6+
$a = [1, 2, 3];
7+
list($a, $b, $c) = $a;
8+
var_dump($a, $b, $c);
9+
10+
$b = [1, 2, 3];
11+
list($a, $b, $c) = $b;
12+
var_dump($a, $b, $c);
13+
14+
$c = [1, 2, 3];
15+
list($a, $b, $c) = $c;
16+
var_dump($a, $b, $c);
17+
18+
$a = [[1, 2], 3];
19+
list(list($a, $b), $c) = $a;
20+
var_dump($a, $b, $c);
21+
22+
$b = [[1, 2], 3];
23+
list(list($a, $b), $c) = $b;
24+
var_dump($a, $b, $c);
25+
26+
$b = [1, [2, 3]];
27+
list($a, list($b, $c)) = $b;
28+
var_dump($a, $b, $c);
29+
30+
$c = [1, [2, 3]];
31+
list($a, list($b, $c)) = $c;
32+
var_dump($a, $b, $c);
33+
34+
?>
35+
--EXPECT--
36+
int(1)
37+
int(2)
38+
int(3)
39+
int(1)
40+
int(2)
41+
int(3)
42+
int(1)
43+
int(2)
44+
int(3)
45+
int(1)
46+
int(2)
47+
int(3)
48+
int(1)
49+
int(2)
50+
int(3)
51+
int(1)
52+
int(2)
53+
int(3)
54+
int(1)
55+
int(2)
56+
int(3)

Zend/zend.c

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -494,22 +494,28 @@ static void compiler_globals_dtor(zend_compiler_globals *compiler_globals) /* {{
494494
static void executor_globals_ctor(zend_executor_globals *executor_globals) /* {{{ */
495495
{
496496
ZEND_TSRMLS_CACHE_UPDATE();
497+
497498
zend_startup_constants();
498499
zend_copy_constants(EG(zend_constants), GLOBAL_CONSTANTS_TABLE);
499500
zend_init_rsrc_plist();
500501
zend_init_exception_op();
501-
EG(lambda_count) = 0;
502-
ZVAL_UNDEF(&EG(user_error_handler));
503-
ZVAL_UNDEF(&EG(user_exception_handler));
504-
EG(in_autoload) = NULL;
505-
EG(current_execute_data) = NULL;
506-
EG(current_module) = NULL;
507-
EG(exit_status) = 0;
502+
executor_globals->lambda_count = 0;
503+
ZVAL_UNDEF(&executor_globals->user_error_handler);
504+
ZVAL_UNDEF(&executor_globals->user_exception_handler);
505+
executor_globals->in_autoload = NULL;
506+
executor_globals->current_execute_data = NULL;
507+
executor_globals->current_module = NULL;
508+
executor_globals->exit_status = 0;
508509
#if XPFPA_HAVE_CW
509-
EG(saved_fpu_cw) = 0;
510+
executor_globals->saved_fpu_cw = 0;
510511
#endif
511-
EG(saved_fpu_cw_ptr) = NULL;
512-
EG(active) = 0;
512+
executor_globals->saved_fpu_cw_ptr = NULL;
513+
executor_globals->active = 0;
514+
executor_globals->bailout = NULL;
515+
executor_globals->error_handling = EH_NORMAL;
516+
executor_globals->exception_class = NULL;
517+
executor_globals->exception = NULL;
518+
executor_globals->objects_store.object_buckets = NULL;
513519
}
514520
/* }}} */
515521

@@ -690,9 +696,8 @@ int zend_startup(zend_utility_functions *utility_functions, char **extensions) /
690696
ini_scanner_globals_ctor(&ini_scanner_globals);
691697
php_scanner_globals_ctor(&language_scanner_globals);
692698
zend_set_default_compile_time_values();
693-
ZVAL_UNDEF(&EG(user_error_handler));
694-
ZVAL_UNDEF(&EG(user_exception_handler));
695699
#endif
700+
EG(error_reporting) = E_ALL & ~E_NOTICE;
696701

697702
zend_interned_strings_init();
698703
zend_startup_builtin_functions();
@@ -921,14 +926,14 @@ ZEND_API void zend_deactivate(void) /* {{{ */
921926
shutdown_compiler();
922927
} zend_end_try();
923928

924-
zend_destroy_rsrc_list(&EG(regular_list));
925-
926929
#if ZEND_DEBUG
927930
if (GC_G(gc_enabled) && !CG(unclean_shutdown)) {
928931
gc_collect_cycles();
929932
}
930933
#endif
931934

935+
zend_destroy_rsrc_list(&EG(regular_list));
936+
932937
#if GC_BENCH
933938
fprintf(stderr, "GC Statistics\n");
934939
fprintf(stderr, "-------------\n");

Zend/zend_API.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3915,7 +3915,7 @@ ZEND_API zend_string *zend_resolve_method_name(zend_class_entry *ce, zend_functi
39153915
zend_string *name;
39163916

39173917
if (f->common.type != ZEND_USER_FUNCTION ||
3918-
*(f->op_array.refcount) < 2 ||
3918+
(f->op_array.refcount && *(f->op_array.refcount) < 2) ||
39193919
!f->common.scope ||
39203920
!f->common.scope->trait_aliases) {
39213921
return f->common.function_name;

Zend/zend_ast.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -890,7 +890,6 @@ static void zend_ast_export_zval(smart_str *str, zval *zv, int priority, int ind
890890

891891
static void zend_ast_export_ex(smart_str *str, zend_ast *ast, int priority, int indent)
892892
{
893-
zval *zv;
894893
zend_ast_decl *decl;
895894
int p, pl, pr;
896895
const char *op;

Zend/zend_builtin_functions.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1227,7 +1227,7 @@ ZEND_FUNCTION(get_class_methods)
12271227
zend_binary_strcasecmp(key->val, key->len, mptr->common.function_name->val, len) == 0) {
12281228

12291229
if (mptr->type == ZEND_USER_FUNCTION &&
1230-
*mptr->op_array.refcount > 1 &&
1230+
(!mptr->op_array.refcount || *mptr->op_array.refcount > 1) &&
12311231
!same_name(key, mptr->common.function_name)) {
12321232
ZVAL_STR_COPY(&method_name, zend_find_alias_name(mptr->common.scope, key));
12331233
zend_hash_next_index_insert_new(Z_ARRVAL_P(return_value), &method_name);
@@ -1936,7 +1936,9 @@ ZEND_FUNCTION(create_function)
19361936
zend_error(E_ERROR, "Unexpected inconsistency in create_function()");
19371937
RETURN_FALSE;
19381938
}
1939-
(*func->refcount)++;
1939+
if (func->refcount) {
1940+
(*func->refcount)++;
1941+
}
19401942
static_variables = func->static_variables;
19411943
func->static_variables = NULL;
19421944
zend_hash_str_del(EG(function_table), LAMBDA_TEMP_FUNCNAME, sizeof(LAMBDA_TEMP_FUNCNAME)-1);
@@ -2256,6 +2258,9 @@ ZEND_FUNCTION(debug_print_backtrace)
22562258
skip->prev_execute_data->func &&
22572259
ZEND_USER_CODE(skip->prev_execute_data->func->common.type) &&
22582260
skip->prev_execute_data->opline->opcode != ZEND_DO_FCALL &&
2261+
skip->prev_execute_data->opline->opcode != ZEND_DO_ICALL &&
2262+
skip->prev_execute_data->opline->opcode != ZEND_DO_UCALL &&
2263+
skip->prev_execute_data->opline->opcode != ZEND_DO_FCALL_BY_NAME &&
22592264
skip->prev_execute_data->opline->opcode != ZEND_INCLUDE_OR_EVAL) {
22602265
skip = skip->prev_execute_data;
22612266
}
@@ -2451,6 +2456,9 @@ ZEND_API void zend_fetch_debug_backtrace(zval *return_value, int skip_last, int
24512456
skip->prev_execute_data->func &&
24522457
ZEND_USER_CODE(skip->prev_execute_data->func->common.type) &&
24532458
skip->prev_execute_data->opline->opcode != ZEND_DO_FCALL &&
2459+
skip->prev_execute_data->opline->opcode != ZEND_DO_ICALL &&
2460+
skip->prev_execute_data->opline->opcode != ZEND_DO_UCALL &&
2461+
skip->prev_execute_data->opline->opcode != ZEND_DO_FCALL_BY_NAME &&
24542462
skip->prev_execute_data->opline->opcode != ZEND_INCLUDE_OR_EVAL) {
24552463
skip = skip->prev_execute_data;
24562464
}

0 commit comments

Comments
 (0)