Files
php-src/Zend/tests/is_subclass_of_string.phpt
Daniel Scherzer 4923c6079e [RFC] Deprecate is_a() and is_subclass_of() with string when not allowed (#23236)
For `is_a()` and `is_subclass_of()`, emit deprecation warnings when calling
with a string as the first argument but with `$allow_string` being false. The
two functions share implementation code and so are updated together.

https://wiki.php.net/rfc/deprecations_php_8_6
2026-08-31 14:03:55 -07:00

19 lines
379 B
PHP

--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)