Skip to content

Commit 162b154

Browse files
committed
Merge branch 'master' into preload
* master: (34 commits) Eliminate useless $this related check Eliminate useless $this related checks Replace zend_parse_method_parameters() by zend_parse_parameters() and avoid useless checks. Replace getThis() by EX(This), when additional check is not necessary. Fixed tests Validate length on socket_write Fix compilation on x32 Fix #77141: Signedness issue in SOAP when precision=-1 Support SQLite3 @name notation Remove lexer files generated by RE2C Update libmagic.patch [ci skip] Update libmagic.patch [ci skip] Fork test with pcre.jit=0 Rework magic data Fix regex Fix regex Rework magic data Sync one more upstream libmagic piece Suppress already used warning Ignore getaddrinfo failed message ...
2 parents 45fdd03 + 8bda225 commit 162b154

File tree

119 files changed

+49709
-65672
lines changed

Some content is hidden

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

119 files changed

+49709
-65672
lines changed

.gitignore

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,21 @@ config.h.in
153153
/scripts/phpize
154154
php
155155

156+
# ------------------------------------------------------------------------------
157+
# Lexer files generated by re2c
158+
# ------------------------------------------------------------------------------
159+
/ext/json/json_scanner.c
160+
/ext/json/php_json_scanner_defs.h
161+
/ext/pdo/pdo_sql_parser.c
162+
/ext/phar/phar_path_check.c
163+
/ext/standard/url_scanner_ex.c
164+
/ext/standard/var_unserializer.c
165+
/sapi/phpdbg/phpdbg_lexer.c
166+
/Zend/zend_ini_scanner.c
167+
/Zend/zend_ini_scanner_defs.h
168+
/Zend/zend_language_scanner.c
169+
/Zend/zend_language_scanner_defs.h
170+
156171
# ------------------------------------------------------------------------------
157172
# PHP parser files generated by bison during the build process
158173
# ------------------------------------------------------------------------------

NEWS

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ PHP NEWS
99
- Date:
1010
. Fixed bug #75232 (print_r of DateTime creating side-effect). (Nikita)
1111

12+
- GD:
13+
. Fixed bug #76324 (cannot detect recent versions of freetype with
14+
pkg-config). (Eli Schwartz)
15+
1216
- Hash:
1317
. The hash extension is now an integral part of PHP and cannot be disabled
1418
as per RFC: https://wiki.php.net/rfc/permanent_hash_ext. (Kalle)
@@ -26,9 +30,13 @@ PHP NEWS
2630
. Implemented sqlite_stmt_readonly in PDO_SQLite. (BohwaZ)
2731
. Lifted requirements to SQLite 3.5.0. (cmb)
2832

33+
- Sockets:
34+
. Fixed bug #67619 (Validate length on socket_write). (thiagooak)
35+
2936
- SQLite3:
3037
. Unbundled libsqlite. (cmb)
3138
. Lifted requirements to SQLite 3.5.0. (cmb)
39+
. Added support for the SQLite @name notation. (cmb, BohwaZ)
3240

3341
- Standard:
3442
. Fixed bug #74764 (Bindto IPv6 works with file_get_contents but fails with

UPGRADING

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,12 @@ PHP 7.4 UPGRADE NOTES
9393
9. Other Changes to Extensions
9494
========================================
9595

96+
- GD:
97+
. Freetype detection now relies on pkg-config. The --with-freetype-dir option
98+
has been renamed to --enable-freetype and no longer accepts a directory.
99+
Instead pkg-config environment variables can be used to configure custom paths,
100+
see either ./configure --help or follow the instructions in error messages.
101+
96102
- Hash:
97103
. The hash extension cannot be disabled anymore and is always an integral
98104
part of any PHP build, similar to the date extension.
@@ -113,6 +119,7 @@ PHP 7.4 UPGRADE NOTES
113119
- SQLite3:
114120
. The bundled libsqlite has been removed. To build the SQLite3 and/or
115121
PDO_SQLite extensions a system libsqlite3 ≥ 3.5.0 is now required.
122+
. The @param notation can now also be used to denote SQL query parameters.
116123

117124
- Zip:
118125
. The bundled libzip library has been removed. A system libzip >= 0.11 is now

Zend/zend_closures.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ ZEND_METHOD(Closure, __invoke) /* {{{ */
4949
zend_function *func = EX(func);
5050
zval *arguments = ZEND_CALL_ARG(execute_data, 1);
5151

52-
if (call_user_function(CG(function_table), NULL, getThis(), return_value, ZEND_NUM_ARGS(), arguments) == FAILURE) {
52+
if (call_user_function(CG(function_table), NULL, &EX(This), return_value, ZEND_NUM_ARGS(), arguments) == FAILURE) {
5353
RETVAL_FALSE;
5454
}
5555

@@ -112,7 +112,7 @@ static zend_bool zend_valid_closure_binding(
112112
Call closure, binding to a given object with its class as the scope */
113113
ZEND_METHOD(Closure, call)
114114
{
115-
zval *zclosure, *newthis, closure_result;
115+
zval *newthis, closure_result;
116116
zend_closure *closure;
117117
zend_fcall_info fci;
118118
zend_fcall_info_cache fci_cache;
@@ -126,8 +126,7 @@ ZEND_METHOD(Closure, call)
126126
return;
127127
}
128128

129-
zclosure = getThis();
130-
closure = (zend_closure *) Z_OBJ_P(zclosure);
129+
closure = (zend_closure *) Z_OBJ(EX(This));
131130

132131
newobj = Z_OBJ_P(newthis);
133132

@@ -166,7 +165,7 @@ ZEND_METHOD(Closure, call)
166165
fci_cache.object = fci.object = newobj;
167166

168167
fci.size = sizeof(fci);
169-
ZVAL_COPY_VALUE(&fci.function_name, zclosure);
168+
ZVAL_OBJ(&fci.function_name, &closure->std);
170169
fci.retval = &closure_result;
171170
fci.no_separation = 1;
172171

Zend/zend_compile.c

Lines changed: 2 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1073,31 +1073,7 @@ ZEND_API int do_bind_function(zval *lcname) /* {{{ */
10731073
}
10741074
/* }}} */
10751075

1076-
ZEND_API int do_bind_class(zval *lcname) /* {{{ */
1077-
{
1078-
zend_class_entry *ce;
1079-
zval *rtd_key, *zv;
1080-
1081-
rtd_key = lcname + 1;
1082-
zv = zend_hash_find_ex(EG(class_table), Z_STR_P(rtd_key), 1);
1083-
if (UNEXPECTED(!zv)) {
1084-
zend_error_noreturn(E_COMPILE_ERROR, "Cannot declare %s, because the name is already in use", Z_STRVAL_P(lcname));
1085-
return FAILURE;
1086-
}
1087-
1088-
ce = (zend_class_entry*)Z_PTR_P(zv);
1089-
zv = zend_hash_set_bucket_key(EG(class_table), (Bucket*)zv, Z_STR_P(lcname));
1090-
if (UNEXPECTED(!zv)) {
1091-
zend_error_noreturn(E_COMPILE_ERROR, "Cannot declare %s %s, because the name is already in use", zend_get_object_type(ce), ZSTR_VAL(ce->name));
1092-
return FAILURE;
1093-
}
1094-
1095-
zend_do_link_class(ce, NULL);
1096-
return SUCCESS;
1097-
}
1098-
/* }}} */
1099-
1100-
ZEND_API int do_bind_inherited_class(zval *lcname, zend_class_entry *parent_ce) /* {{{ */
1076+
ZEND_API int do_bind_class(zval *lcname, zend_class_entry *parent_ce) /* {{{ */
11011077
{
11021078
zend_class_entry *ce;
11031079
zval *rtd_key, *zv;
@@ -1192,7 +1168,7 @@ ZEND_API void zend_do_delayed_early_binding(const zend_op_array *op_array, uint3
11921168
const zend_op *opline = &op_array->opcodes[opline_num];
11931169
zval *parent_name = RT_CONSTANT(opline, opline->op2);
11941170
if ((ce = zend_lookup_class_ex(Z_STR_P(parent_name), Z_STR_P(parent_name + 1), 0)) != NULL) {
1195-
do_bind_inherited_class(RT_CONSTANT(&op_array->opcodes[opline_num], op_array->opcodes[opline_num].op1), ce);
1171+
do_bind_class(RT_CONSTANT(&op_array->opcodes[opline_num], op_array->opcodes[opline_num].op1), ce);
11961172
}
11971173
opline_num = op_array->opcodes[opline_num].result.opline_num;
11981174
}

Zend/zend_compile.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -753,8 +753,7 @@ zend_bool zend_handle_encoding_declaration(zend_ast *ast);
753753
void zend_do_free(znode *op1);
754754

755755
ZEND_API int do_bind_function(zval *lcname);
756-
ZEND_API int do_bind_class(zval *lcname);
757-
ZEND_API int do_bind_inherited_class(zval *lcname, zend_class_entry *parent_ce);
756+
ZEND_API int do_bind_class(zval *lcname, zend_class_entry *parent_ce);
758757
ZEND_API uint32_t zend_build_delayed_early_binding_list(const zend_op_array *op_array);
759758
ZEND_API void zend_do_delayed_early_binding(const zend_op_array *op_array, uint32_t first_early_binding_opline);
760759

Zend/zend_exceptions.c

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ ZEND_METHOD(exception, __construct)
270270
zend_class_entry *base_ce;
271271
int argc = ZEND_NUM_ARGS();
272272

273-
object = getThis();
273+
object = &EX(This);
274274
base_ce = i_get_exception_base(object);
275275

276276
if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, argc, "|SlO!", &message, &code, &previous, zend_ce_throwable) == FAILURE) {
@@ -314,7 +314,7 @@ ZEND_METHOD(exception, __construct)
314314
ZEND_METHOD(exception, __wakeup)
315315
{
316316
zval value, *pvalue;
317-
zval *object = getThis();
317+
zval *object = &EX(This);
318318
CHECK_EXC_TYPE(ZEND_STR_MESSAGE, IS_STRING);
319319
CHECK_EXC_TYPE(ZEND_STR_STRING, IS_STRING);
320320
CHECK_EXC_TYPE(ZEND_STR_CODE, IS_LONG);
@@ -353,7 +353,7 @@ ZEND_METHOD(error_exception, __construct)
353353
return;
354354
}
355355

356-
object = getThis();
356+
object = &EX(This);
357357

358358
if (message) {
359359
ZVAL_STR_COPY(&tmp, message);
@@ -404,7 +404,7 @@ ZEND_METHOD(exception, getFile)
404404

405405
DEFAULT_0_PARAMS;
406406

407-
ZVAL_COPY(return_value, GET_PROPERTY(getThis(), ZEND_STR_FILE));
407+
ZVAL_COPY(return_value, GET_PROPERTY(&EX(This), ZEND_STR_FILE));
408408
}
409409
/* }}} */
410410

@@ -416,7 +416,7 @@ ZEND_METHOD(exception, getLine)
416416

417417
DEFAULT_0_PARAMS;
418418

419-
ZVAL_COPY(return_value, GET_PROPERTY(getThis(), ZEND_STR_LINE));
419+
ZVAL_COPY(return_value, GET_PROPERTY(&EX(This), ZEND_STR_LINE));
420420
}
421421
/* }}} */
422422

@@ -428,7 +428,7 @@ ZEND_METHOD(exception, getMessage)
428428

429429
DEFAULT_0_PARAMS;
430430

431-
ZVAL_COPY(return_value, GET_PROPERTY(getThis(), ZEND_STR_MESSAGE));
431+
ZVAL_COPY(return_value, GET_PROPERTY(&EX(This), ZEND_STR_MESSAGE));
432432
}
433433
/* }}} */
434434

@@ -440,7 +440,7 @@ ZEND_METHOD(exception, getCode)
440440

441441
DEFAULT_0_PARAMS;
442442

443-
ZVAL_COPY(return_value, GET_PROPERTY(getThis(), ZEND_STR_CODE));
443+
ZVAL_COPY(return_value, GET_PROPERTY(&EX(This), ZEND_STR_CODE));
444444
}
445445
/* }}} */
446446

@@ -452,7 +452,7 @@ ZEND_METHOD(exception, getTrace)
452452

453453
DEFAULT_0_PARAMS;
454454

455-
ZVAL_COPY(return_value, GET_PROPERTY(getThis(), ZEND_STR_TRACE));
455+
ZVAL_COPY(return_value, GET_PROPERTY(&EX(This), ZEND_STR_TRACE));
456456
}
457457
/* }}} */
458458

@@ -464,7 +464,7 @@ ZEND_METHOD(error_exception, getSeverity)
464464

465465
DEFAULT_0_PARAMS;
466466

467-
ZVAL_COPY(return_value, GET_PROPERTY(getThis(), ZEND_STR_SEVERITY));
467+
ZVAL_COPY(return_value, GET_PROPERTY(&EX(This), ZEND_STR_SEVERITY));
468468
}
469469
/* }}} */
470470

@@ -610,7 +610,7 @@ ZEND_METHOD(exception, getTraceAsString)
610610

611611
DEFAULT_0_PARAMS;
612612

613-
object = getThis();
613+
object = &EX(This);
614614
base_ce = i_get_exception_base(object);
615615

616616
trace = zend_read_property_ex(base_ce, object, ZSTR_KNOWN(ZEND_STR_TRACE), 1, &rv);
@@ -643,7 +643,7 @@ ZEND_METHOD(exception, getPrevious)
643643

644644
DEFAULT_0_PARAMS;
645645

646-
ZVAL_COPY(return_value, GET_PROPERTY_SILENT(getThis(), ZEND_STR_PREVIOUS));
646+
ZVAL_COPY(return_value, GET_PROPERTY_SILENT(&EX(This), ZEND_STR_PREVIOUS));
647647
} /* }}} */
648648

649649
/* {{{ proto string Exception|Error::__toString()
@@ -661,7 +661,7 @@ ZEND_METHOD(exception, __toString)
661661

662662
str = ZSTR_EMPTY_ALLOC();
663663

664-
exception = getThis();
664+
exception = &EX(This);
665665
fname = zend_string_init("gettraceasstring", sizeof("gettraceasstring")-1, 0);
666666

667667
while (exception && Z_TYPE_P(exception) == IS_OBJECT && instanceof_function(Z_OBJCE_P(exception), zend_ce_throwable)) {
@@ -718,7 +718,7 @@ ZEND_METHOD(exception, __toString)
718718
}
719719
zend_string_release_ex(fname, 0);
720720

721-
exception = getThis();
721+
exception = &EX(This);
722722
/* Reset apply counts */
723723
while (exception && Z_TYPE_P(exception) == IS_OBJECT && (base_ce = i_get_exception_base(exception)) && instanceof_function(Z_OBJCE_P(exception), base_ce)) {
724724
if (Z_IS_RECURSIVE_P(exception)) {
@@ -729,7 +729,7 @@ ZEND_METHOD(exception, __toString)
729729
exception = GET_PROPERTY(exception, ZEND_STR_PREVIOUS);
730730
}
731731

732-
exception = getThis();
732+
exception = &EX(This);
733733
base_ce = i_get_exception_base(exception);
734734

735735
/* We store the result in the private property string so we can access

Zend/zend_generators.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -877,7 +877,7 @@ ZEND_METHOD(Generator, rewind)
877877
return;
878878
}
879879

880-
generator = (zend_generator *) Z_OBJ_P(getThis());
880+
generator = (zend_generator *) Z_OBJ(EX(This));
881881

882882
zend_generator_rewind(generator);
883883
}
@@ -893,7 +893,7 @@ ZEND_METHOD(Generator, valid)
893893
return;
894894
}
895895

896-
generator = (zend_generator *) Z_OBJ_P(getThis());
896+
generator = (zend_generator *) Z_OBJ(EX(This));
897897

898898
zend_generator_ensure_initialized(generator);
899899

@@ -913,7 +913,7 @@ ZEND_METHOD(Generator, current)
913913
return;
914914
}
915915

916-
generator = (zend_generator *) Z_OBJ_P(getThis());
916+
generator = (zend_generator *) Z_OBJ(EX(This));
917917

918918
zend_generator_ensure_initialized(generator);
919919

@@ -936,7 +936,7 @@ ZEND_METHOD(Generator, key)
936936
return;
937937
}
938938

939-
generator = (zend_generator *) Z_OBJ_P(getThis());
939+
generator = (zend_generator *) Z_OBJ(EX(This));
940940

941941
zend_generator_ensure_initialized(generator);
942942

@@ -959,7 +959,7 @@ ZEND_METHOD(Generator, next)
959959
return;
960960
}
961961

962-
generator = (zend_generator *) Z_OBJ_P(getThis());
962+
generator = (zend_generator *) Z_OBJ(EX(This));
963963

964964
zend_generator_ensure_initialized(generator);
965965

@@ -978,7 +978,7 @@ ZEND_METHOD(Generator, send)
978978
Z_PARAM_ZVAL(value)
979979
ZEND_PARSE_PARAMETERS_END();
980980

981-
generator = (zend_generator *) Z_OBJ_P(getThis());
981+
generator = (zend_generator *) Z_OBJ(EX(This));
982982

983983
zend_generator_ensure_initialized(generator);
984984

@@ -1017,7 +1017,7 @@ ZEND_METHOD(Generator, throw)
10171017

10181018
Z_TRY_ADDREF_P(exception);
10191019

1020-
generator = (zend_generator *) Z_OBJ_P(getThis());
1020+
generator = (zend_generator *) Z_OBJ(EX(This));
10211021

10221022
zend_generator_ensure_initialized(generator);
10231023

@@ -1052,7 +1052,7 @@ ZEND_METHOD(Generator, getReturn)
10521052
return;
10531053
}
10541054

1055-
generator = (zend_generator *) Z_OBJ_P(getThis());
1055+
generator = (zend_generator *) Z_OBJ(EX(This));
10561056

10571057
zend_generator_ensure_initialized(generator);
10581058
if (UNEXPECTED(EG(exception))) {

0 commit comments

Comments
 (0)