Skip to content

Commit 4af532a

Browse files
committed
Merge branch 'master' into jit-dynasm
* master: fix news Fix for Bug 74196: PharData->decompress() does not correctly support dot names Fix of Bug #74383: Wrong reflection on Phar::running Fix of Bug #74383: Wrong reflection on Phar::running Update NEWS Fixed bug #74379 (syntax error compile error in libmagic/apprentice.c) Missed NEWS Add NEWS entries Add NEWS Resolve bug #74188 (undefined statics raising with ?? operator) Fixed bug #72071: Prevent Max-Age from being negative Fixed #74298 - IntlDateFormatter->format() doesn't return microseconds/fractions pull-request/2456: increase test coverage in calendar extension consistent warnings in calendar extension Fix typo in NEWS Switch to FindFirstFileEx with basic info level Update NEWS with OpenSSL 1.1.0 support info Add OpenSSL 1.1.0 support to PHP 7.0
2 parents 83860d3 + 9e4c48a commit 4af532a

36 files changed

+476
-194
lines changed

NEWS

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ PHP NEWS
3737
. Fixed bug #73971 (Filename got limited to MAX_PATH on Win32 when scan
3838
directory). (Anatol)
3939
. Fixed bug #74149 (static embed SAPI linkage error). (krakjoe)
40-
. Fixed bug #72359, bug #72451, bug #73706, bug #71115 and athers related
40+
. Fixed bug #72359, bug #72451, bug #73706, bug #71115 and others related
4141
to interned strings handling in TS builds. (Anatol, Dmitry)
4242

4343
- BCMath:
@@ -138,6 +138,12 @@ PHP NEWS
138138
- PDO_Sqlite
139139
. Switch to sqlite3_prepare_v2() and sqlite3_close_v2() functions (rasmus)
140140

141+
- phar:
142+
. Fixed bug #74383 (phar method parameters reflection correction).
143+
(mhagstrand)
144+
. Fixed bug #74196 (phar does not correctly handle names containing dots).
145+
(mhagstrand)
146+
141147
- PHPDBG
142148
. Added extended_value to opcode dump output. (Sara)
143149

Zend/zend_execute.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1919,7 +1919,7 @@ static zend_always_inline void zend_fetch_property_address(zval *result, zval *c
19191919
}
19201920
}
19211921

1922-
static zend_always_inline zval* zend_fetch_static_property_address(zend_execute_data *execute_data, zval *varname, zend_uchar varname_type, znode_op op2, zend_uchar op2_type)
1922+
static zend_always_inline zval* zend_fetch_static_property_address(zend_execute_data *execute_data, zval *varname, zend_uchar varname_type, znode_op op2, zend_uchar op2_type, int type)
19231923
{
19241924
zval *retval;
19251925
zend_string *name;
@@ -1943,7 +1943,9 @@ static zend_always_inline zval* zend_fetch_static_property_address(zend_execute_
19431943

19441944
/* check if static properties were destoyed */
19451945
if (UNEXPECTED(CE_STATIC_MEMBERS(ce) == NULL)) {
1946-
zend_throw_error(NULL, "Access to undeclared static property: %s::$%s", ZSTR_VAL(ce->name), ZSTR_VAL(name));
1946+
if (type != BP_VAR_IS) {
1947+
zend_throw_error(NULL, "Access to undeclared static property: %s::$%s", ZSTR_VAL(ce->name), ZSTR_VAL(name));
1948+
}
19471949
return NULL;
19481950
}
19491951

@@ -1979,15 +1981,17 @@ static zend_always_inline zval* zend_fetch_static_property_address(zend_execute_
19791981

19801982
/* check if static properties were destoyed */
19811983
if (UNEXPECTED(CE_STATIC_MEMBERS(ce) == NULL)) {
1982-
zend_throw_error(NULL, "Access to undeclared static property: %s::$%s", ZSTR_VAL(ce->name), ZSTR_VAL(name));
1984+
if (type != BP_VAR_IS) {
1985+
zend_throw_error(NULL, "Access to undeclared static property: %s::$%s", ZSTR_VAL(ce->name), ZSTR_VAL(name));
1986+
}
19831987
return NULL;
19841988
}
19851989

19861990
return retval;
19871991
}
19881992
}
19891993

1990-
retval = zend_std_get_static_property(ce, name, 0);
1994+
retval = zend_std_get_static_property(ce, name, type == BP_VAR_IS);
19911995

19921996
if (varname_type != IS_CONST) {
19931997
zend_string_release(name);

Zend/zend_virtual_cwd.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -812,7 +812,7 @@ static int tsrm_realpath_r(char *path, int start, int len, int *ll, time_t *t, i
812812
if (!pathw) {
813813
return -1;
814814
}
815-
hFind = FindFirstFileW(pathw, &dataw);
815+
hFind = FindFirstFileExW(pathw, FindExInfoBasic, &dataw, FindExSearchNameMatch, NULL, 0);
816816
if (INVALID_HANDLE_VALUE == hFind) {
817817
if (use_realpath == CWD_REALPATH) {
818818
/* file not found */

Zend/zend_vm_def.h

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1542,13 +1542,17 @@ ZEND_VM_HELPER(zend_fetch_static_prop_helper, CONST|TMPVAR|CV, UNUSED|CONST|VAR,
15421542
SAVE_OPLINE();
15431543
varname = GET_OP1_ZVAL_PTR_UNDEF(BP_VAR_R);
15441544

1545-
retval = zend_fetch_static_property_address(execute_data, varname, OP1_TYPE, opline->op2, OP2_TYPE);
1546-
1545+
retval = zend_fetch_static_property_address(execute_data, varname, OP1_TYPE, opline->op2, OP2_TYPE, type);
1546+
15471547
if (UNEXPECTED(retval == NULL)) {
1548-
ZEND_ASSERT(EG(exception));
1549-
FREE_OP1();
1550-
ZVAL_UNDEF(EX_VAR(opline->result.var));
1551-
HANDLE_EXCEPTION();
1548+
if (EG(exception)) {
1549+
FREE_OP1();
1550+
ZVAL_UNDEF(EX_VAR(opline->result.var));
1551+
HANDLE_EXCEPTION();
1552+
} else {
1553+
ZEND_ASSERT(type == BP_VAR_IS);
1554+
retval = &EG(uninitialized_zval);
1555+
}
15521556
}
15531557

15541558
FREE_OP1();

Zend/zend_vm_execute.h

Lines changed: 75 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -4876,13 +4876,17 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_fetch_static_prop_helper_SPEC_
48764876
SAVE_OPLINE();
48774877
varname = EX_CONSTANT(opline->op1);
48784878

4879-
retval = zend_fetch_static_property_address(execute_data, varname, IS_CONST, opline->op2, IS_CONST);
4879+
retval = zend_fetch_static_property_address(execute_data, varname, IS_CONST, opline->op2, IS_CONST, type);
48804880

48814881
if (UNEXPECTED(retval == NULL)) {
4882-
ZEND_ASSERT(EG(exception));
4882+
if (EG(exception)) {
48834883

4884-
ZVAL_UNDEF(EX_VAR(opline->result.var));
4885-
HANDLE_EXCEPTION();
4884+
ZVAL_UNDEF(EX_VAR(opline->result.var));
4885+
HANDLE_EXCEPTION();
4886+
} else {
4887+
ZEND_ASSERT(type == BP_VAR_IS);
4888+
retval = &EG(uninitialized_zval);
4889+
}
48864890
}
48874891

48884892
if (type == BP_VAR_R || type == BP_VAR_IS) {
@@ -6671,13 +6675,17 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_fetch_static_prop_helper_SPEC_
66716675
SAVE_OPLINE();
66726676
varname = EX_CONSTANT(opline->op1);
66736677

6674-
retval = zend_fetch_static_property_address(execute_data, varname, IS_CONST, opline->op2, IS_VAR);
6678+
retval = zend_fetch_static_property_address(execute_data, varname, IS_CONST, opline->op2, IS_VAR, type);
66756679

66766680
if (UNEXPECTED(retval == NULL)) {
6677-
ZEND_ASSERT(EG(exception));
6681+
if (EG(exception)) {
66786682

6679-
ZVAL_UNDEF(EX_VAR(opline->result.var));
6680-
HANDLE_EXCEPTION();
6683+
ZVAL_UNDEF(EX_VAR(opline->result.var));
6684+
HANDLE_EXCEPTION();
6685+
} else {
6686+
ZEND_ASSERT(type == BP_VAR_IS);
6687+
retval = &EG(uninitialized_zval);
6688+
}
66816689
}
66826690

66836691
if (type == BP_VAR_R || type == BP_VAR_IS) {
@@ -7174,13 +7182,17 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_fetch_static_prop_helper_SPEC_
71747182
SAVE_OPLINE();
71757183
varname = EX_CONSTANT(opline->op1);
71767184

7177-
retval = zend_fetch_static_property_address(execute_data, varname, IS_CONST, opline->op2, IS_UNUSED);
7185+
retval = zend_fetch_static_property_address(execute_data, varname, IS_CONST, opline->op2, IS_UNUSED, type);
71787186

71797187
if (UNEXPECTED(retval == NULL)) {
7180-
ZEND_ASSERT(EG(exception));
7188+
if (EG(exception)) {
71817189

7182-
ZVAL_UNDEF(EX_VAR(opline->result.var));
7183-
HANDLE_EXCEPTION();
7190+
ZVAL_UNDEF(EX_VAR(opline->result.var));
7191+
HANDLE_EXCEPTION();
7192+
} else {
7193+
ZEND_ASSERT(type == BP_VAR_IS);
7194+
retval = &EG(uninitialized_zval);
7195+
}
71847196
}
71857197

71867198
if (type == BP_VAR_R || type == BP_VAR_IS) {
@@ -35598,13 +35610,17 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_fetch_static_prop_helper_SPEC_
3559835610
SAVE_OPLINE();
3559935611
varname = _get_zval_ptr_cv_undef(execute_data, opline->op1.var);
3560035612

35601-
retval = zend_fetch_static_property_address(execute_data, varname, IS_CV, opline->op2, IS_CONST);
35613+
retval = zend_fetch_static_property_address(execute_data, varname, IS_CV, opline->op2, IS_CONST, type);
3560235614

3560335615
if (UNEXPECTED(retval == NULL)) {
35604-
ZEND_ASSERT(EG(exception));
35616+
if (EG(exception)) {
3560535617

35606-
ZVAL_UNDEF(EX_VAR(opline->result.var));
35607-
HANDLE_EXCEPTION();
35618+
ZVAL_UNDEF(EX_VAR(opline->result.var));
35619+
HANDLE_EXCEPTION();
35620+
} else {
35621+
ZEND_ASSERT(type == BP_VAR_IS);
35622+
retval = &EG(uninitialized_zval);
35623+
}
3560835624
}
3560935625

3561035626
if (type == BP_VAR_R || type == BP_VAR_IS) {
@@ -38611,13 +38627,17 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_fetch_static_prop_helper_SPEC_
3861138627
SAVE_OPLINE();
3861238628
varname = _get_zval_ptr_cv_undef(execute_data, opline->op1.var);
3861338629

38614-
retval = zend_fetch_static_property_address(execute_data, varname, IS_CV, opline->op2, IS_VAR);
38630+
retval = zend_fetch_static_property_address(execute_data, varname, IS_CV, opline->op2, IS_VAR, type);
3861538631

3861638632
if (UNEXPECTED(retval == NULL)) {
38617-
ZEND_ASSERT(EG(exception));
38633+
if (EG(exception)) {
3861838634

38619-
ZVAL_UNDEF(EX_VAR(opline->result.var));
38620-
HANDLE_EXCEPTION();
38635+
ZVAL_UNDEF(EX_VAR(opline->result.var));
38636+
HANDLE_EXCEPTION();
38637+
} else {
38638+
ZEND_ASSERT(type == BP_VAR_IS);
38639+
retval = &EG(uninitialized_zval);
38640+
}
3862138641
}
3862238642

3862338643
if (type == BP_VAR_R || type == BP_VAR_IS) {
@@ -39446,13 +39466,17 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_fetch_static_prop_helper_SPEC_
3944639466
SAVE_OPLINE();
3944739467
varname = _get_zval_ptr_cv_undef(execute_data, opline->op1.var);
3944839468

39449-
retval = zend_fetch_static_property_address(execute_data, varname, IS_CV, opline->op2, IS_UNUSED);
39469+
retval = zend_fetch_static_property_address(execute_data, varname, IS_CV, opline->op2, IS_UNUSED, type);
3945039470

3945139471
if (UNEXPECTED(retval == NULL)) {
39452-
ZEND_ASSERT(EG(exception));
39472+
if (EG(exception)) {
3945339473

39454-
ZVAL_UNDEF(EX_VAR(opline->result.var));
39455-
HANDLE_EXCEPTION();
39474+
ZVAL_UNDEF(EX_VAR(opline->result.var));
39475+
HANDLE_EXCEPTION();
39476+
} else {
39477+
ZEND_ASSERT(type == BP_VAR_IS);
39478+
retval = &EG(uninitialized_zval);
39479+
}
3945639480
}
3945739481

3945839482
if (type == BP_VAR_R || type == BP_VAR_IS) {
@@ -48917,13 +48941,17 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_fetch_static_prop_helper_SPEC_
4891748941
SAVE_OPLINE();
4891848942
varname = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1);
4891948943

48920-
retval = zend_fetch_static_property_address(execute_data, varname, (IS_TMP_VAR|IS_VAR), opline->op2, IS_CONST);
48944+
retval = zend_fetch_static_property_address(execute_data, varname, (IS_TMP_VAR|IS_VAR), opline->op2, IS_CONST, type);
4892148945

4892248946
if (UNEXPECTED(retval == NULL)) {
48923-
ZEND_ASSERT(EG(exception));
48924-
zval_ptr_dtor_nogc(free_op1);
48925-
ZVAL_UNDEF(EX_VAR(opline->result.var));
48926-
HANDLE_EXCEPTION();
48947+
if (EG(exception)) {
48948+
zval_ptr_dtor_nogc(free_op1);
48949+
ZVAL_UNDEF(EX_VAR(opline->result.var));
48950+
HANDLE_EXCEPTION();
48951+
} else {
48952+
ZEND_ASSERT(type == BP_VAR_IS);
48953+
retval = &EG(uninitialized_zval);
48954+
}
4892748955
}
4892848956

4892948957
zval_ptr_dtor_nogc(free_op1);
@@ -49797,13 +49825,17 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_fetch_static_prop_helper_SPEC_
4979749825
SAVE_OPLINE();
4979849826
varname = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1);
4979949827

49800-
retval = zend_fetch_static_property_address(execute_data, varname, (IS_TMP_VAR|IS_VAR), opline->op2, IS_VAR);
49828+
retval = zend_fetch_static_property_address(execute_data, varname, (IS_TMP_VAR|IS_VAR), opline->op2, IS_VAR, type);
4980149829

4980249830
if (UNEXPECTED(retval == NULL)) {
49803-
ZEND_ASSERT(EG(exception));
49804-
zval_ptr_dtor_nogc(free_op1);
49805-
ZVAL_UNDEF(EX_VAR(opline->result.var));
49806-
HANDLE_EXCEPTION();
49831+
if (EG(exception)) {
49832+
zval_ptr_dtor_nogc(free_op1);
49833+
ZVAL_UNDEF(EX_VAR(opline->result.var));
49834+
HANDLE_EXCEPTION();
49835+
} else {
49836+
ZEND_ASSERT(type == BP_VAR_IS);
49837+
retval = &EG(uninitialized_zval);
49838+
}
4980749839
}
4980849840

4980949841
zval_ptr_dtor_nogc(free_op1);
@@ -50216,13 +50248,17 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_fetch_static_prop_helper_SPEC_
5021650248
SAVE_OPLINE();
5021750249
varname = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1);
5021850250

50219-
retval = zend_fetch_static_property_address(execute_data, varname, (IS_TMP_VAR|IS_VAR), opline->op2, IS_UNUSED);
50251+
retval = zend_fetch_static_property_address(execute_data, varname, (IS_TMP_VAR|IS_VAR), opline->op2, IS_UNUSED, type);
5022050252

5022150253
if (UNEXPECTED(retval == NULL)) {
50222-
ZEND_ASSERT(EG(exception));
50223-
zval_ptr_dtor_nogc(free_op1);
50224-
ZVAL_UNDEF(EX_VAR(opline->result.var));
50225-
HANDLE_EXCEPTION();
50254+
if (EG(exception)) {
50255+
zval_ptr_dtor_nogc(free_op1);
50256+
ZVAL_UNDEF(EX_VAR(opline->result.var));
50257+
HANDLE_EXCEPTION();
50258+
} else {
50259+
ZEND_ASSERT(type == BP_VAR_IS);
50260+
retval = &EG(uninitialized_zval);
50261+
}
5022650262
}
5022750263

5022850264
zval_ptr_dtor_nogc(free_op1);

ext/calendar/calendar.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ PHP_FUNCTION(cal_info)
313313

314314

315315
if (cal != -1 && (cal < 0 || cal >= CAL_NUM_CALS)) {
316-
php_error_docref(NULL, E_WARNING, "invalid calendar ID " ZEND_LONG_FMT ".", cal);
316+
php_error_docref(NULL, E_WARNING, "invalid calendar ID " ZEND_LONG_FMT, cal);
317317
RETURN_FALSE;
318318
}
319319

@@ -335,7 +335,7 @@ PHP_FUNCTION(cal_days_in_month)
335335
}
336336

337337
if (cal < 0 || cal >= CAL_NUM_CALS) {
338-
php_error_docref(NULL, E_WARNING, "invalid calendar ID " ZEND_LONG_FMT ".", cal);
338+
php_error_docref(NULL, E_WARNING, "invalid calendar ID " ZEND_LONG_FMT, cal);
339339
RETURN_FALSE;
340340
}
341341

@@ -344,7 +344,7 @@ PHP_FUNCTION(cal_days_in_month)
344344
sdn_start = calendar->to_jd(year, month, 1);
345345

346346
if (sdn_start == 0) {
347-
php_error_docref(NULL, E_WARNING, "invalid date.");
347+
php_error_docref(NULL, E_WARNING, "invalid date");
348348
RETURN_FALSE;
349349
}
350350

@@ -381,7 +381,7 @@ PHP_FUNCTION(cal_to_jd)
381381
}
382382

383383
if (cal < 0 || cal >= CAL_NUM_CALS) {
384-
php_error_docref(NULL, E_WARNING, "invalid calendar ID " ZEND_LONG_FMT ".", cal);
384+
php_error_docref(NULL, E_WARNING, "invalid calendar ID " ZEND_LONG_FMT, cal);
385385
RETURN_FALSE;
386386
}
387387

@@ -403,7 +403,7 @@ PHP_FUNCTION(cal_from_jd)
403403
}
404404

405405
if (cal < 0 || cal >= CAL_NUM_CALS) {
406-
php_error_docref(NULL, E_WARNING, "invalid calendar ID " ZEND_LONG_FMT "", cal);
406+
php_error_docref(NULL, E_WARNING, "invalid calendar ID " ZEND_LONG_FMT, cal);
407407
RETURN_FALSE;
408408
}
409409
calendar = &cal_conversion_table[cal];
@@ -623,7 +623,7 @@ PHP_FUNCTION(jdtojewish)
623623
RETURN_STRING(date);
624624
} else {
625625
if (year <= 0 || year > 9999) {
626-
php_error_docref(NULL, E_WARNING, "Year out of range (0-9999).");
626+
php_error_docref(NULL, E_WARNING, "Year out of range (0-9999)");
627627
RETURN_FALSE;
628628
}
629629

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
--TEST--
2+
Test cal_days_in_month() function : error conditions
3+
--CREDITS--
4+
edgarsandi - <edgar.r.sandi@gmail.com>
5+
--SKIPIF--
6+
<?php include 'skipif.inc'; ?>
7+
--FILE--
8+
<?php
9+
var_dump(cal_days_in_month(-1, 4, 2017));
10+
var_dump(cal_days_in_month(CAL_GREGORIAN,0, 2009));
11+
?>
12+
--EXPECTF--
13+
Warning: cal_days_in_month(): invalid calendar ID -1 in %s on line %d
14+
bool(false)
15+
16+
Warning: cal_days_in_month(): invalid date in %s on line %d
17+
bool(false)
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
--TEST--
2+
Test cal_from_jd() function : error conditions
3+
--CREDITS--
4+
edgarsandi - <edgar.r.sandi@gmail.com>
5+
--SKIPIF--
6+
<?php include 'skipif.inc'; ?>
7+
--FILE--
8+
<?php
9+
var_dump(cal_from_jd(1748326, -1));
10+
?>
11+
--EXPECTF--
12+
Warning: cal_from_jd(): invalid calendar ID -1 in %s on line %d
13+
bool(false)

ext/calendar/tests/cal_info.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,4 +213,4 @@ Array
213213
[calsymbol] => CAL_JULIAN
214214
)
215215

216-
Warning: cal_info(): invalid calendar ID 99999. in %s on line %d
216+
Warning: cal_info(): invalid calendar ID 99999 in %s on line %d

0 commit comments

Comments
 (0)