PHPPresentation icon indicating copy to clipboard operation
PHPPresentation copied to clipboard

The parameter pValue can't have the value "020B0604030504040204" (Validation: The length is not equals to 10)

Open kolaente opened this issue 1 year ago • 6 comments

When trying to read a pptx file using the latest version from the develop branch, reading fails with the error message:

The parameter pValue can't have the value "020B0604030504040204" (Validation: The length is not equals to 10)

Why does that happen? What can I do to prevent it? Why is there a limit of 10 characters?

It looks like the limit was added in https://github.com/PHPOffice/PHPPresentation/commit/ec4700e447b2c4f798f43f0bb6e71acfa3006874#diff-3412465bd7f45b4c39d517277b37db019c65ab68d5f03d5557fd4463caad5a46

pinging @Progi1984 as you introduced the change. Any idea what could cause this?

kolaente avatar Mar 28 '24 14:03 kolaente

If I change this line to $pValue = '';, it seems to work.

kolaente avatar Mar 28 '24 15:03 kolaente

@kolaente Could you send me a sample file, please, for fixing the bug ?

Progi1984 avatar Aug 19 '24 06:08 Progi1984

Unfortunately, I can't send you the file, since it was provided to me under NDA. Do you have any tips on how to debug this?

kolaente avatar Aug 25 '24 14:08 kolaente

@kolaente Can't you clean the file and check with a basic file ?

Progi1984 avatar Aug 25 '24 15:08 Progi1984

I'll investigate.

kolaente avatar Aug 26 '24 14:08 kolaente

@Progi1984 I have the same problem and i have created a sample file triggering the error for you.

My code:

try {
	$dir_path = MVC_UPLOADS_PRIVATE;
	$file = 'blanco3'.'.pptx';
	$presentation = IOFactory::load($dir_path.$file);
}
catch( Exception $e ) {
	echo $e->getMessage();
	echo $e->getTraceAsString();
}
exit;

Here is the file: blanco3.pptx

And this is the exception trace:

The parameter pValue can't have the value "020F0502020204030204" (Validation: The length is not equals to 10)

#0 /var/www/vendor/phpoffice/phppresentation/src/PhpPresentation/Reader/PowerPoint2007.php(1342): PhpOffice\PhpPresentation\Style\Font->setPanose('020F05020202040...')
#1 /var/www/vendor/phpoffice/phppresentation/src/PhpPresentation/Reader/PowerPoint2007.php(1018): PhpOffice\PhpPresentation\Reader\PowerPoint2007->loadParagraph(Object(PhpOffice\Common\XMLReader), Object(DOMElement), Object(PhpOffice\PhpPresentation\Shape\RichText))
#2 /var/www/vendor/phpoffice/phppresentation/src/PhpPresentation/Reader/PowerPoint2007.php(1503): PhpOffice\PhpPresentation\Reader\PowerPoint2007->loadShapeRichText(Object(PhpOffice\Common\XMLReader), Object(DOMElement), Object(PhpOffice\PhpPresentation\Slide))
#3 /var/www/vendor/phpoffice/phppresentation/src/PhpPresentation/Reader/PowerPoint2007.php(497): PhpOffice\PhpPresentation\Reader\PowerPoint2007->loadSlideShapes(Object(PhpOffice\PhpPresentation\Slide), Object(DOMNodeList), Object(PhpOffice\Common\XMLReader))
#4 /var/www/vendor/phpoffice/phppresentation/src/PhpPresentation/Reader/PowerPoint2007.php(392): PhpOffice\PhpPresentation\Reader\PowerPoint2007->loadSlide('loadSlides('loadFile('/var/www/privat...')
#7 /var/www/vendor/phpoffice/phppresentation/src/PhpPresentation/IOFactory.php(65): PhpOffice\PhpPresentation\Reader\PowerPoint2007->load('/var/www/privat...')

Good luck!

welja avatar Sep 09 '24 11:09 welja