mirror of
https://github.com/Seldaek/monolog.git
synced 2025-08-12 08:04:02 +02:00
Fixes php8 non-backward compatible changes (#1568)
* Utils method added to resolve PCRE error messages properly
This commit is contained in:
@@ -109,4 +109,36 @@ class UtilsTest extends \PHPUnit_Framework_TestCase
|
||||
'object' => [$obj, $obj],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider providesPcreLastErrorMessage
|
||||
* @param int $code
|
||||
* @param string $msg
|
||||
*/
|
||||
public function testPcreLastErrorMessage($code, $msg)
|
||||
{
|
||||
if (PHP_VERSION_ID >= 80000) {
|
||||
$this->assertSame('No error', Utils::pcreLastErrorMessage($code));
|
||||
return;
|
||||
}
|
||||
|
||||
$this->assertEquals($msg, Utils::pcreLastErrorMessage($code));
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array[]
|
||||
*/
|
||||
public function providesPcreLastErrorMessage()
|
||||
{
|
||||
return [
|
||||
[0, 'PREG_NO_ERROR'],
|
||||
[1, 'PREG_INTERNAL_ERROR'],
|
||||
[2, 'PREG_BACKTRACK_LIMIT_ERROR'],
|
||||
[3, 'PREG_RECURSION_LIMIT_ERROR'],
|
||||
[4, 'PREG_BAD_UTF8_ERROR'],
|
||||
[5, 'PREG_BAD_UTF8_OFFSET_ERROR'],
|
||||
[6, 'PREG_JIT_STACKLIMIT_ERROR'],
|
||||
[-1, 'UNDEFINED_ERROR'],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user