Skip to content

Commit 47af4ea

Browse files
committed
fix detecting anonymous exception classes on Windows and PHP 7
1 parent c4a5a08 commit 47af4ea

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

Caster/ClassStub.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public function __construct(string $identifier, $callable = null)
5656
}
5757

5858
if (str_contains($identifier, "@anonymous\0")) {
59-
$this->value = $identifier = preg_replace_callback('/[a-zA-Z_\x7f-\xff][\\\\a-zA-Z0-9_\x7f-\xff]*+@anonymous\x00.*?\.php(?:0x?|:[0-9]++\$)[0-9a-fA-F]++/', function ($m) {
59+
$this->value = $identifier = preg_replace_callback('/[a-zA-Z_\x7f-\xff][\\\\a-zA-Z0-9_\x7f-\xff]*+@anonymous\x00.*?\.php(?:0x?|:[0-9]++\$)?[0-9a-fA-F]++/', function ($m) {
6060
return class_exists($m[0], false) ? (get_parent_class($m[0]) ?: key(class_implements($m[0])) ?: 'class').'@anonymous' : $m[0];
6161
}, $identifier);
6262
}

Caster/ExceptionCaster.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ private static function filterExceptionArray(string $xClass, array $a, string $x
288288
unset($a[$xPrefix.'string'], $a[Caster::PREFIX_DYNAMIC.'xdebug_message'], $a[Caster::PREFIX_DYNAMIC.'__destructorException']);
289289

290290
if (isset($a[Caster::PREFIX_PROTECTED.'message']) && str_contains($a[Caster::PREFIX_PROTECTED.'message'], "@anonymous\0")) {
291-
$a[Caster::PREFIX_PROTECTED.'message'] = preg_replace_callback('/[a-zA-Z_\x7f-\xff][\\\\a-zA-Z0-9_\x7f-\xff]*+@anonymous\x00.*?\.php(?:0x?|:[0-9]++\$)[0-9a-fA-F]++/', function ($m) {
291+
$a[Caster::PREFIX_PROTECTED.'message'] = preg_replace_callback('/[a-zA-Z_\x7f-\xff][\\\\a-zA-Z0-9_\x7f-\xff]*+@anonymous\x00.*?\.php(?:0x?|:[0-9]++\$)?[0-9a-fA-F]++/', function ($m) {
292292
return class_exists($m[0], false) ? (get_parent_class($m[0]) ?: key(class_implements($m[0])) ?: 'class').'@anonymous' : $m[0];
293293
}, $a[Caster::PREFIX_PROTECTED.'message']);
294294
}

0 commit comments

Comments
 (0)