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
4 changes: 3 additions & 1 deletion NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,9 @@ PHP NEWS
. Passing objects to mb_convert_variables() is now deprecated. (Girgias)

- MySQLi:
. The mysqli_get_charset() function is now deprecated. (Kamil Tekiela)
. The mysqli_get_charset() function and mysqli::get_charset() method are now deprecated. (Kamil Tekiela)
. The mysqli_stmt_init() function and mysqli::stmt_init() method are now deprecated. (Kamil Tekiela)
. Instantiation of mysqli_stmt without providing the $query parameter is now deprecated. (Kamil Tekiela)

- PDO:
. Fixed pdo_raise_impl_error() emitting a warning under ERRMODE_SILENT.
Expand Down
5 changes: 4 additions & 1 deletion UPGRADING
Original file line number Diff line number Diff line change
Expand Up @@ -476,8 +476,11 @@ PHP 8.6 UPGRADE NOTES
RFC: https://wiki.php.net/rfc/deprecations_php_8_6#passing_objects_for_vars_parameter_of_mb_convert_variables

- MySQLi:
. The mysqli_get_charset() function is now deprecated.
. The mysqli_get_charset() function and mysqli::get_charset() method are now deprecated.
RFC: https://wiki.php.net/rfc/deprecations_php_8_6#deprecate_mysqli_get_charset
. The mysqli_stmt_init() function, mysqli::stmt_init() method, and calling mysqli_stmt constructor
without providing the $query parameter are now deprecated.
RFC: https://wiki.php.net/rfc/deprecations_php_8_6#deprecate_mysqlistmt_init

- Reflection:
. Calling ReflectionProperty::setValue() with an object that is not an
Expand Down
42 changes: 42 additions & 0 deletions Zend/tests/partial_application/const_arg_opt_002.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
--TEST--
Constant argument optimization - strict_types bug
--CREDITS--
Ryan @ Calif.io
--INI--
opcache.enable=1
opcache.enable_cli=1
opcache.optimization_level=-1
opcache.file_update_protection=0
--FILE--
<?php

declare(strict_types=1);

function cand_86014_typed(int $bound, mixed $placeholder): void
{
echo 'CALLED:', get_debug_type($bound), ':', $bound, "\n";
}

function cand_86014_make_invalid(): Closure
{
return cand_86014_typed('123', ?);
}

try {
$partial = cand_86014_make_invalid();
echo "CONSTRUCTED\n";
} catch (Throwable $e) {
echo 'CREATE: ', get_class($e), ': ', $e->getMessage(), "\n";
}

if (isset($partial)) {
try {
$partial(null);
} catch (Throwable $e) {
echo 'CALL: ', get_class($e), ': ', $e->getMessage(), "\n";
}
}

?>
--EXPECT--
CREATE: TypeError: cand_86014_typed(): Argument #1 ($bound) must be of type int, string given
32 changes: 32 additions & 0 deletions Zend/tests/partial_application/const_arg_opt_003.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
--TEST--
Constant argument optimization - strict_types
--INI--
opcache.enable=1
opcache.enable_cli=1
opcache.optimization_level=-1
opcache.file_update_protection=0
--FILE--
<?php
declare(strict_types=1);

function f(int $a, $b) { return $a; }

// Check that optimizations are enabled
$f = f(3, ?);
$usedVars = new ReflectionFunction($f)->getClosureUsedVariables();
if ($usedVars !== []) {
echo "const arg optimization was not applied\n";
var_dump($usedVars);
exit;
}

var_dump($f(0));

// Actual test. Not catching this as it disables optimizations
f("3", ?)(0);

?>
--EXPECTF--
int(3)

Fatal error: Uncaught TypeError: f(): Argument #1 ($a) must be of type int, string given in %a
Loading