Merge branch '4.4' into 5.0
* 4.4: Fix displaying anonymous classes on PHP 7.4 Fix merge
This commit is contained in:
commit
6fe308bb2a
@ -26,7 +26,7 @@ env:
|
|||||||
matrix:
|
matrix:
|
||||||
include:
|
include:
|
||||||
- php: 7.2
|
- php: 7.2
|
||||||
env: php_extra="7.4snapshot"
|
env: php_extra="7.4"
|
||||||
- php: 7.3
|
- php: 7.3
|
||||||
env: deps=high
|
env: deps=high
|
||||||
- php: 7.4
|
- php: 7.4
|
||||||
|
@ -783,7 +783,7 @@ class Application implements ResetInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (false !== strpos($message, "class@anonymous\0")) {
|
if (false !== strpos($message, "class@anonymous\0")) {
|
||||||
$message = preg_replace_callback('/class@anonymous\x00.*?\.php0x?[0-9a-fA-F]++/', function ($m) {
|
$message = preg_replace_callback('/class@anonymous\x00.*?\.php(?:0x?|:)[0-9a-fA-F]++/', function ($m) {
|
||||||
return class_exists($m[0], false) ? get_parent_class($m[0]).'@anonymous' : $m[0];
|
return class_exists($m[0], false) ? get_parent_class($m[0]).'@anonymous' : $m[0];
|
||||||
}, $message);
|
}, $message);
|
||||||
}
|
}
|
||||||
|
@ -73,7 +73,7 @@ abstract class FileLoader extends BaseFileLoader
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($args !== $frame['args']) {
|
if (__FILE__ !== $frame['file']) {
|
||||||
throw $e;
|
throw $e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -761,7 +761,7 @@ class ErrorHandler
|
|||||||
*/
|
*/
|
||||||
private function parseAnonymousClass(string $message): string
|
private function parseAnonymousClass(string $message): string
|
||||||
{
|
{
|
||||||
return preg_replace_callback('/class@anonymous\x00.*?\.php0x?[0-9a-fA-F]++/', static function ($m) {
|
return preg_replace_callback('/class@anonymous\x00.*?\.php(?:0x?|:)[0-9a-fA-F]++/', static function ($m) {
|
||||||
return class_exists($m[0], false) ? get_parent_class($m[0]).'@anonymous' : $m[0];
|
return class_exists($m[0], false) ? get_parent_class($m[0]).'@anonymous' : $m[0];
|
||||||
}, $message);
|
}, $message);
|
||||||
}
|
}
|
||||||
|
@ -200,7 +200,7 @@ class FlattenException
|
|||||||
public function setMessage($message): self
|
public function setMessage($message): self
|
||||||
{
|
{
|
||||||
if (false !== strpos($message, "class@anonymous\0")) {
|
if (false !== strpos($message, "class@anonymous\0")) {
|
||||||
$message = preg_replace_callback('/class@anonymous\x00.*?\.php0x?[0-9a-fA-F]++/', function ($m) {
|
$message = preg_replace_callback('/class@anonymous\x00.*?\.php(?:0x?|:)[0-9a-fA-F]++/', function ($m) {
|
||||||
return class_exists($m[0], false) ? get_parent_class($m[0]).'@anonymous' : $m[0];
|
return class_exists($m[0], false) ? get_parent_class($m[0]).'@anonymous' : $m[0];
|
||||||
}, $message);
|
}, $message);
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
<?php } ?>
|
<?php } ?>
|
||||||
|
|
||||||
<?php if ('compact' !== $style && $trace['function']) { ?>
|
<?php if ('compact' !== $style && $trace['function']) { ?>
|
||||||
<span class="trace-class"><?= $this->abbrClass($trace['class']); ?></span><?php if ($trace['type']) { ?><span class="trace-type"><?= $trace['type']; ?></span><?php } ?><span class="trace-method"><?= $trace['function']; ?></span><span class="trace-arguments">(<?= $this->formatArgs($trace['args']); ?>)</span>
|
<span class="trace-class"><?= $this->abbrClass($trace['class']); ?></span><?php if ($trace['type']) { ?><span class="trace-type"><?= $trace['type']; ?></span><?php } ?><span class="trace-method"><?= $trace['function']; ?></span><?php if (isset($trace['args'])) { ?><span class="trace-arguments">(<?= $this->formatArgs($trace['args']); ?>)</span><?php } ?>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
|
|
||||||
<?php if ($trace['file']) { ?>
|
<?php if ($trace['file']) { ?>
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
foreach ($exception['trace'] as $trace) {
|
foreach ($exception['trace'] as $trace) {
|
||||||
echo "\n ";
|
echo "\n ";
|
||||||
if ($trace['function']) {
|
if ($trace['function']) {
|
||||||
echo 'at '.$trace['class'].$trace['type'].$trace['function'].'('.$this->formatArgsAsText($trace['args']).')';
|
echo 'at '.$trace['class'].$trace['type'].$trace['function'].'('.(isset($trace['args']) ? $this->formatArgsAsText($trace['args']) : '').')';
|
||||||
}
|
}
|
||||||
if ($trace['file'] && $trace['line']) {
|
if ($trace['file'] && $trace['line']) {
|
||||||
echo($trace['function'] ? "\n (" : 'at ').strtr(strip_tags($this->formatFile($trace['file'], $trace['line'])), [' at line '.$trace['line'] => '']).':'.$trace['line'].($trace['function'] ? ')' : '');
|
echo($trace['function'] ? "\n (" : 'at ').strtr(strip_tags($this->formatFile($trace['file'], $trace['line'])), [' at line '.$trace['line'] => '']).':'.$trace['line'].($trace['function'] ? ')' : '');
|
||||||
|
@ -226,6 +226,10 @@ class FlattenExceptionTest extends TestCase
|
|||||||
|
|
||||||
public function testArguments()
|
public function testArguments()
|
||||||
{
|
{
|
||||||
|
if (\PHP_VERSION_ID >= 70400) {
|
||||||
|
$this->markTestSkipped('PHP 7.4 removes arguments from exception traces.');
|
||||||
|
}
|
||||||
|
|
||||||
$dh = opendir(__DIR__);
|
$dh = opendir(__DIR__);
|
||||||
$fh = tmpfile();
|
$fh = tmpfile();
|
||||||
|
|
||||||
@ -288,6 +292,10 @@ class FlattenExceptionTest extends TestCase
|
|||||||
|
|
||||||
public function testRecursionInArguments()
|
public function testRecursionInArguments()
|
||||||
{
|
{
|
||||||
|
if (\PHP_VERSION_ID >= 70400) {
|
||||||
|
$this->markTestSkipped('PHP 7.4 removes arguments from exception traces.');
|
||||||
|
}
|
||||||
|
|
||||||
$a = null;
|
$a = null;
|
||||||
$a = ['foo', [2, &$a]];
|
$a = ['foo', [2, &$a]];
|
||||||
$exception = $this->createException($a);
|
$exception = $this->createException($a);
|
||||||
@ -299,6 +307,10 @@ class FlattenExceptionTest extends TestCase
|
|||||||
|
|
||||||
public function testTooBigArray()
|
public function testTooBigArray()
|
||||||
{
|
{
|
||||||
|
if (\PHP_VERSION_ID >= 70400) {
|
||||||
|
$this->markTestSkipped('PHP 7.4 removes arguments from exception traces.');
|
||||||
|
}
|
||||||
|
|
||||||
$a = [];
|
$a = [];
|
||||||
for ($i = 0; $i < 20; ++$i) {
|
for ($i = 0; $i < 20; ++$i) {
|
||||||
for ($j = 0; $j < 50; ++$j) {
|
for ($j = 0; $j < 50; ++$j) {
|
||||||
|
@ -287,7 +287,7 @@ class ConnectionTest extends TestCase
|
|||||||
$factory->method('createQueue')->willReturn($amqpQueue);
|
$factory->method('createQueue')->willReturn($amqpQueue);
|
||||||
|
|
||||||
$amqpExchange->expects($this->once())->method('declareExchange');
|
$amqpExchange->expects($this->once())->method('declareExchange');
|
||||||
$amqpExchange->expects($this->once())->method('publish')->with('body', null, AMQP_NOPARAM, ['headers' => []]);
|
$amqpExchange->expects($this->once())->method('publish')->with('body', null, AMQP_NOPARAM, ['headers' => [], 'delivery_mode' => 2]);
|
||||||
$amqpQueue->expects($this->once())->method('declareQueue');
|
$amqpQueue->expects($this->once())->method('declareQueue');
|
||||||
$amqpQueue->expects($this->exactly(1))->method('bind')->withConsecutive(
|
$amqpQueue->expects($this->exactly(1))->method('bind')->withConsecutive(
|
||||||
[self::DEFAULT_EXCHANGE_NAME, null, ['x-match' => 'all']]
|
[self::DEFAULT_EXCHANGE_NAME, null, ['x-match' => 'all']]
|
||||||
|
@ -56,7 +56,7 @@ class ClassStub extends ConstStub
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (false !== strpos($identifier, "class@anonymous\0")) {
|
if (false !== strpos($identifier, "class@anonymous\0")) {
|
||||||
$this->value = $identifier = preg_replace_callback('/class@anonymous\x00.*?\.php0x?[0-9a-fA-F]++/', function ($m) {
|
$this->value = $identifier = preg_replace_callback('/class@anonymous\x00.*?\.php(?:0x?|:)[0-9a-fA-F]++/', function ($m) {
|
||||||
return class_exists($m[0], false) ? get_parent_class($m[0]).'@anonymous' : $m[0];
|
return class_exists($m[0], false) ? get_parent_class($m[0]).'@anonymous' : $m[0];
|
||||||
}, $identifier);
|
}, $identifier);
|
||||||
}
|
}
|
||||||
|
@ -283,7 +283,7 @@ class ExceptionCaster
|
|||||||
unset($a[$xPrefix.'string'], $a[Caster::PREFIX_DYNAMIC.'xdebug_message'], $a[Caster::PREFIX_DYNAMIC.'__destructorException']);
|
unset($a[$xPrefix.'string'], $a[Caster::PREFIX_DYNAMIC.'xdebug_message'], $a[Caster::PREFIX_DYNAMIC.'__destructorException']);
|
||||||
|
|
||||||
if (isset($a[Caster::PREFIX_PROTECTED.'message']) && false !== strpos($a[Caster::PREFIX_PROTECTED.'message'], "class@anonymous\0")) {
|
if (isset($a[Caster::PREFIX_PROTECTED.'message']) && false !== strpos($a[Caster::PREFIX_PROTECTED.'message'], "class@anonymous\0")) {
|
||||||
$a[Caster::PREFIX_PROTECTED.'message'] = preg_replace_callback('/class@anonymous\x00.*?\.php0x?[0-9a-fA-F]++/', function ($m) {
|
$a[Caster::PREFIX_PROTECTED.'message'] = preg_replace_callback('/class@anonymous\x00.*?\.php(?:0x?|:)[0-9a-fA-F]++/', function ($m) {
|
||||||
return class_exists($m[0], false) ? get_parent_class($m[0]).'@anonymous' : $m[0];
|
return class_exists($m[0], false) ? get_parent_class($m[0]).'@anonymous' : $m[0];
|
||||||
}, $a[Caster::PREFIX_PROTECTED.'message']);
|
}, $a[Caster::PREFIX_PROTECTED.'message']);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user