Skip to content
Open
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
5 changes: 5 additions & 0 deletions UPGRADING
Original file line number Diff line number Diff line change
Expand Up @@ -454,6 +454,11 @@ PHP 8.6 UPGRADE NOTES
RFC: https://wiki.php.net/rfc/deprecations_php_8_6#deprecate_the_possibility_to_name_a_function_readonly
. Passing a 3rd argument to define() is now deprecated.
RFC: https://wiki.php.net/rfc/deprecations_php_8_6#deprecate_define_with_case_insensitive_being_specified
. Calling is_subclass_of() with a string when $allow_string is false is now
deprecated.
RFC: https://wiki.php.net/rfc/deprecations_php_8_6#deprecate_is_subclass_of_with_string_when_allow_string_is_false
. Calling is_a() with a string when $allow_string is false is now deprecated.
RFC: https://wiki.php.net/rfc/deprecations_php_8_6#deprecate_is_a_with_string_when_allow_string_is_false

- BZ2
. Passing an object for the Bzip2 {de}compression stream filter is now
Expand Down
16 changes: 16 additions & 0 deletions Zend/tests/is_a_string.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
--TEST--
is_a() with $allow_string false and a string
--FILE--
<?php

class Demo {}

var_dump(is_a(Demo::class, Demo::class, true));
var_dump(is_a(Demo::class, Demo::class, false));

?>
--EXPECTF--
bool(true)

Deprecated: Calling is_a() with a string when $allow_string is false in %s on line %d
bool(false)
18 changes: 18 additions & 0 deletions Zend/tests/is_subclass_of_string.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
--TEST--
is_subclass_of() with $allow_string false and a string
--FILE--
<?php

class Demo {}

class Child extends Demo {}

var_dump(is_subclass_of(Child::class, Demo::class, true));
var_dump(is_subclass_of(Child::class, Demo::class, false));

?>
--EXPECTF--
bool(true)

Deprecated: Calling is_subclass_of() with a string when $allow_string is false in %s on line %d
bool(false)
12 changes: 12 additions & 0 deletions Zend/zend_builtin_functions.c
Original file line number Diff line number Diff line change
Expand Up @@ -714,6 +714,18 @@ static void is_a_impl(INTERNAL_FUNCTION_PARAMETERS, bool only_subclass) /* {{{ *
if (!instance_ce) {
RETURN_FALSE;
}
} else if (Z_TYPE_P(obj) == IS_STRING) {
zend_string *function_name = get_active_function_or_method_name();
zend_error(
E_DEPRECATED,
"Calling %pS() with a string when $allow_string is false",
function_name
);
zend_string_release(function_name);
if (UNEXPECTED(EG(exception))) {
RETURN_THROWS();
}
RETURN_FALSE;
} else if (Z_TYPE_P(obj) == IS_OBJECT) {
instance_ce = Z_OBJCE_P(obj);
} else {
Expand Down
Loading
Loading