Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ PHP NEWS
using OPcache). (timwolla)
. Fixed bug GH-19480 (error_log php.ini cannot be unset when open_basedir is
configured). (nielsdos)
. Fixed bug GH-19719 (Allow empty statements before declare(strict_types)).
(nielsdos)

- Curl:
. Fix cloning of CURLOPT_POSTFIELDS when using the clone operator instead
Expand All @@ -32,6 +34,9 @@ PHP NEWS
. Fixed GH-8157 (post_max_size evaluates .user.ini too late in php-fpm).
(Jakub Zelenka)

- Iconv:
. Extends the ICONV_CONST preprocessor for illumos/solaris. (jMichaelA)

- Opcache:
. Fixed bug GH-19669 (assertion failure in zend_jit_trace_type_to_info_ex).
(Arnaud)
Expand All @@ -53,6 +58,7 @@ PHP NEWS
. Add new Uri\UriError exception that is thrown for internal error
conditions. (timwolla)
. Further clean up the internal API. (timwolla)
. Fixed bug GH-19892 (Refcounting on zend_empty_array). (ilutov, timwolla)

- Windows:
. Fix GH-19722 (_get_osfhandle asserts in debug mode when given a socket).
Expand Down
21 changes: 21 additions & 0 deletions Zend/tests/gh19719.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
--TEST--
GH-19719: Allow empty expressions before declare(strict_types)
--FILE--
<?php
// e.g some comments
?>
<?php

declare(strict_types=1);

function takesInt(int $x) {}

try {
takesInt('42');
} catch (Error $e) {
echo $e->getMessage(), "\n";
}

?>
--EXPECTF--
takesInt(): Argument #1 ($x) must be of type int, string given, called in %s on line %d
1 change: 1 addition & 0 deletions Zend/zend_API.h
Original file line number Diff line number Diff line change
Expand Up @@ -1364,6 +1364,7 @@ ZEND_API zend_result zend_try_assign_typed_ref_zval_ex(zend_reference *ref, zval

#define ZEND_TRY_ASSIGN_REF_ARR(zv, arr) do { \
ZEND_ASSERT(Z_ISREF_P(zv)); \
ZEND_ASSERT(!(GC_FLAGS(arr) & GC_IMMUTABLE)); \
_ZEND_TRY_ASSIGN_ARR(zv, arr, 1); \
} while (0)

Expand Down
2 changes: 1 addition & 1 deletion Zend/zend_compile.c
Original file line number Diff line number Diff line change
Expand Up @@ -7008,7 +7008,7 @@ static void zend_compile_declare(zend_ast *ast) /* {{{ */
} else if (zend_string_equals_literal_ci(name, "strict_types")) {
zval value_zv;

if (FAILURE == zend_is_first_statement(ast, /* allow_nop */ 0)) {
if (FAILURE == zend_is_first_statement(ast, /* allow_nop */ true)) {
zend_error_noreturn(E_COMPILE_ERROR, "strict_types declaration must be "
"the very first statement in the script");
}
Expand Down
2 changes: 1 addition & 1 deletion ext/iconv/iconv.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
#undef iconv
#endif

#if defined(__NetBSD__)
#if defined(__NetBSD__) || (defined(__sun) && defined(__SVR4))
// unfortunately, netbsd has still the old non posix conformant signature
// libiconv tends to match the eventual system's iconv too.
#define ICONV_CONST const
Expand Down
2 changes: 1 addition & 1 deletion ext/uri/php_uri.c
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ static zend_result pass_errors_by_ref_and_free(zval *errors_zv, zval *errors)
return SUCCESS;
}

ZEND_TRY_ASSIGN_REF_ARR(errors_zv, Z_ARRVAL_P(errors));
ZEND_TRY_ASSIGN_REF_TMP(errors_zv, errors);
if (EG(exception)) {
return FAILURE;
}
Expand Down
12 changes: 12 additions & 0 deletions ext/uri/tests/gh19892.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
--TEST--
GH-19892: Successful \Uri\WhatWg\Url::parse() with empty errors array
--FILE--
<?php

\Uri\WhatWg\Url::parse('https://example.com', errors: $errors);
var_dump($errors);

?>
--EXPECT--
array(0) {
}