Find this useful? Enter your email to receive occasional updates for securing PHP code.

Signing you up...

Thank you for signing up!

PHP Decode

<?php declare(strict_types=1); namespace PhpOffice\PhpSpreadsheetTests\Reader\Xlsx; use..

Decoded Output download

<?php

declare(strict_types=1);

namespace PhpOffice\PhpSpreadsheetTests\Reader\Xlsx;

use PhpOffice\PhpSpreadsheet\IOFactory;
use PhpOffice\PhpSpreadsheet\RichText\RichText;
use PHPUnit\Framework\TestCase;
use ZipArchive;

class Issue2362Test extends TestCase
{
    public function testPreliminaries(): void
    {
        // ZipArchive says file is 'inconsistent',
        // but Excel has no problem with it.
        $filename = 'tests/data/Reader/XLSX/issue.2362.xlsx';
        $zip = new ZipArchive();
        $res = $zip->open($filename, ZipArchive::CHECKCONS);
        self::assertSame(ZipArchive::ER_INCONS, $res);
    }

    public function testIssue2362(): void
    {
        $filename = 'tests/data/Reader/XLSX/issue.2362.xlsx';
        $reader = IOFactory::createReader('Xlsx');
        $spreadsheet = $reader->load($filename);
        $sheet = $spreadsheet->getActiveSheet();

        $value = $sheet->getCell('A1')->getValue();
        if ($value instanceof RichText) {
            self::assertSame('', (string) $value);
        } else {
            self::fail('A1 is not RichText');
        }
        $value = $sheet->getCell('D21')->getValue();
        if ($value instanceof RichText) {
            self::assertSame('391800,  , . , . , . 40', (string) $value);
        } else {
            self::fail('D21 is not RichText');
        }
        $spreadsheet->disconnectWorksheets();
    }
}
 ?>

Did this file decode correctly?

Original Code

<?php

declare(strict_types=1);

namespace PhpOffice\PhpSpreadsheetTests\Reader\Xlsx;

use PhpOffice\PhpSpreadsheet\IOFactory;
use PhpOffice\PhpSpreadsheet\RichText\RichText;
use PHPUnit\Framework\TestCase;
use ZipArchive;

class Issue2362Test extends TestCase
{
    public function testPreliminaries(): void
    {
        // ZipArchive says file is 'inconsistent',
        // but Excel has no problem with it.
        $filename = 'tests/data/Reader/XLSX/issue.2362.xlsx';
        $zip = new ZipArchive();
        $res = $zip->open($filename, ZipArchive::CHECKCONS);
        self::assertSame(ZipArchive::ER_INCONS, $res);
    }

    public function testIssue2362(): void
    {
        $filename = 'tests/data/Reader/XLSX/issue.2362.xlsx';
        $reader = IOFactory::createReader('Xlsx');
        $spreadsheet = $reader->load($filename);
        $sheet = $spreadsheet->getActiveSheet();

        $value = $sheet->getCell('A1')->getValue();
        if ($value instanceof RichText) {
            self::assertSame('', (string) $value);
        } else {
            self::fail('A1 is not RichText');
        }
        $value = $sheet->getCell('D21')->getValue();
        if ($value instanceof RichText) {
            self::assertSame('391800,  , . , . , . 40', (string) $value);
        } else {
            self::fail('D21 is not RichText');
        }
        $spreadsheet->disconnectWorksheets();
    }
}

Function Calls

None

Variables

None

Stats

MD5 02557715f765d9bfdb7366b2c0eb2ab4
Eval Count 0
Decode Time 100 ms