PHPPresentation
PHPPresentation copied to clipboard
PowerPoint2007::loadShapeRichText() must be an instance of AbstractSlide, instance of Note given
TypeError: Argument 3 passed to PhpOffice\PhpPresentation\Reader\PowerPoint2007::loadShapeRichText() must be an instance of PhpOffice\PhpPresentation\Slide\AbstractSlide, instance of PhpOffice\PhpPresentation\Slide\Note given, called in /app/vendor/phpoffice/phppresentation/src/PhpPresentation/Reader/PowerPoint2007.php on line 1387 and defined in /app/vendor/phpoffice/phppresentation/src/PhpPresentation/Reader/PowerPoint2007.php:886
Stack trace:
#0 /app/vendor/phpoffice/phppresentation/src/PhpPresentation/Reader/PowerPoint2007.php(1387): PhpOffice\PhpPresentation\Reader\PowerPoint2007->loadShapeRichText(Object(PhpOffice\Common\XMLReader), Object(DOMElement), Object(PhpOffice\PhpPresentation\Slide\Note))
#1 /app/vendor/phpoffice/phppresentation/src/PhpPresentation/Reader/PowerPoint2007.php(756): PhpOffice\PhpPresentation\Reader\PowerPoint2007->loadSlideShapes(Object(PhpOffice\PhpPresentation\Slide\Note), Object(DOMNodeList), Object(PhpOffice\Common\XMLReader))
#2 /app/vendor/phpoffice/phppresentation/src/PhpPresentation/Reader/PowerPoint2007.php(370): PhpOffice\PhpPresentation\Reader\PowerPoint2007->loadSlideNote('notesSlide1.xml', Object(PhpOffice\PhpPresentation\Slide))
#3 /app/vendor/phpoffice/phppresentation/src/PhpPresentation/Reader/PowerPoint2007.php(170): PhpOffice\PhpPresentation\Reader\PowerPoint2007->loadSlides('<?xml version="...')
#4 /app/vendor/phpoffice/phppresentation/src/PhpPresentation/Reader/PowerPoint2007.php(137): PhpOffice\PhpPresentation\Reader\PowerPoint2007->loadFile('/app/data/templ...')
#5 /app/vendor/phpoffice/phppresentation/src/PhpPresentation/IOFactory.php(73): PhpOffice\PhpPresentation\Reader\PowerPoint2007->load('/app/data/templ...')
vendor/phpoffice/phppresentation/src/PhpPresentation/Reader/PowerPoint2007.php
protected function loadShapeRichText(XMLReader $document, DOMElement $node, AbstractSlide $oSlide): void
{
if (!$document->elementExists('p:txBody/a:p/a:r', $node)) {
return;
}
replace to
protected function loadShapeRichText(XMLReader $document, DOMElement $node, $oSlide): void
{
if (!$document->elementExists('p:txBody/a:p/a:r', $node) || !$oSlide instanceof AbstractSlide) {
return;
}
and in vendor/phpoffice/phppresentation/src/PhpPresentation/Style/Border.php
public function setLineWidth(int $pValue = 1): self
{
$this->lineWidth = $pValue;
replace to
public function setLineWidth($pValue = 1): self
{
$this->lineWidth = (int) $pValue;
but it is required from the developer
I can confirm that @IvanSerevko 's revision fixes this issue quite effectively. Any chance to get this pulled?
666666666666666
I fork and do this. Mb it's can help: https://github.com/dmtrbskkv/php-presentation-fix
Hi @dmtrbskkv , can you elaborate thanks.
Hi @dmtrbskkv , can you elaborate thanks.
I make fork of the main repository and fix this bug. Fix like in this answer. How to install, u can find on repository page