mirror of
https://github.com/PHPOffice/PhpSpreadsheet.git
synced 2026-08-30 12:07:56 +00:00
First Php8.6 (Extremely Minor) Problem
In 8.6, XmlWriter is declared non-serializable. This changes the result of one unit test (we receive a different exception than we had expected).
This commit is contained in:
@@ -64,7 +64,15 @@ class XMLWriter extends \XMLWriter
|
||||
}
|
||||
}
|
||||
|
||||
/** @param mixed[] $data */
|
||||
/**
|
||||
* Unserialization is not allowed. This needs to be enforced
|
||||
* in the class before Php8.6, but, with that release,
|
||||
* this method is no longer needed and will not be executed.
|
||||
*
|
||||
* @see https://github.com/php/php-src/pull/21694
|
||||
*
|
||||
* @param mixed[] $data
|
||||
*/
|
||||
public function __unserialize(array $data): void
|
||||
{
|
||||
$this->tempFileName = '';
|
||||
|
||||
@@ -4,6 +4,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace PhpOffice\PhpSpreadsheetTests\Shared;
|
||||
|
||||
use Exception;
|
||||
use PhpOffice\PhpSpreadsheet\Exception as SpreadsheetException;
|
||||
use PhpOffice\PhpSpreadsheet\Shared\XMLWriter;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
@@ -22,10 +23,17 @@ class XmlWriterTest extends TestCase
|
||||
XMLWriter::$debugEnabled = $this->debugEnabled;
|
||||
}
|
||||
|
||||
protected static int $versionCheck = 80600;
|
||||
|
||||
public function testUnserialize(): void
|
||||
{
|
||||
$this->expectException(SpreadsheetException::class);
|
||||
$this->expectExceptionMessage('Unserialize not permitted');
|
||||
if (PHP_VERSION_ID >= self::$versionCheck) {
|
||||
$this->expectException(Exception::class);
|
||||
$this->expectExceptionMessage('Unserialization');
|
||||
} else {
|
||||
$this->expectException(SpreadsheetException::class);
|
||||
$this->expectExceptionMessage('Unserialize not permitted');
|
||||
}
|
||||
$className = XMLWriter::class;
|
||||
$classLen = strlen($className);
|
||||
$text = "O:$classLen:\"$className\":1:{";
|
||||
|
||||
Reference in New Issue
Block a user