Skip to content

Commit 269d41b

Browse files
committed
Better polyfill for get_debug_type
1 parent 2f71fbd commit 269d41b

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

src/functions.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ function get_debug_type($value): string
4848
}
4949

5050
return 'class@anonymous';
51-
case $value instanceof __PHP_Incomplete_Class: return '__PHP_Incomplete_Class';
5251
default:
5352
/** @var resource $value */
5453
/** @var string|null $type */

tests/GetDebugTypeTest.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,15 @@ public function testIncompleteClass(): void
5353
static::assertSame('__PHP_Incomplete_Class', get_debug_type($obj));
5454
}
5555

56+
public function testIncompleteClassUnserialize(): void
57+
{
58+
$unserializeCallbackHandler = (string)ini_set('unserialize_callback_func', '');
59+
$var = unserialize('O:8:"Foo\Buzz":0:{}');
60+
ini_set('unserialize_callback_func', $unserializeCallbackHandler);
61+
62+
$this->assertSame('__PHP_Incomplete_Class', get_debug_type($var));
63+
}
64+
5665
public function testResourceStream(): void
5766
{
5867
/** @var resource $fp */

0 commit comments

Comments
 (0)