Skip to content

XML Reader cache #932

Closed
Closed
@artkolev

Description

@artkolev

This is:

- [x] a bug report
- [ ] a feature request
- [ ] **not** a usage question (ask them on https://stackoverflow.com/questions/tagged/phpspreadsheet or https://gitter.im/PHPOffice/PhpSpreadsheet)

What is the expected behavior?

Correct get $spreadsheet

What is the current behavior?

Exception "Serialization of 'SimpleXMLElement' is not allowed"

What are the steps to reproduce?

<?php

require __DIR__ . '/vendor/autoload.php';

// Create new Spreadsheet object
$client = new \Memcached();
$client->connect('localhost', 11211);
$pool = new \Cache\Adapter\Memcached\MemcachedCachePool($client);
$simpleCache = new \Cache\Bridge\SimpleCache\SimpleCacheBridge($pool);

\PhpOffice\PhpSpreadsheet\Settings::setCache($simpleCache);

$this->reader = (\PhpOffice\PhpSpreadsheet\IOFactory::createReader(Xml);
$spreadsheet = $this->reader->load(__DIR__ . 'vendor/phpoffice/phpspreadsheet/samples/templates/Excel2003XMLTest.xml ')

Which versions of PhpSpreadsheet and PHP are affected?

PHP 7.2 PhpSpreadsheet 1.6

Solution to the problem

https://github.com/PHPOffice/PhpSpreadsheet/blob/master/src/PhpSpreadsheet/Reader/Xml.php#L514

$cellValue = self::convertStringEncoding((string) $cellValue, $this->charSet);

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions