PHPOffice / PHPPresentation

A pure PHP library for reading and writing presentations documents
https://phpoffice.github.io/PHPPresentation
Other
1.31k stars 523 forks source link

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

Open kolaente opened 7 months ago

kolaente commented 7 months ago

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 commented 7 months ago

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

Progi1984 commented 3 months ago

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

kolaente commented 2 months ago

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?

Progi1984 commented 2 months ago

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

kolaente commented 2 months ago

I'll investigate.

welja commented 2 months ago

@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!