Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PhpOffice\PhpPresentation\Shape\RichText\Paragraph::setSpacingBefore() #729

Closed
Bhadresh-Malankiya opened this issue Jan 17, 2023 · 6 comments · Fixed by #818
Closed

PhpOffice\PhpPresentation\Shape\RichText\Paragraph::setSpacingBefore() #729

Bhadresh-Malankiya opened this issue Jan 17, 2023 · 6 comments · Fixed by #818

Comments

@Bhadresh-Malankiya
Copy link

TypeError
PhpOffice\PhpPresentation\Shape\RichText\Paragraph::setSpacingBefore(): Argument #1 ($spacingBefore) must be of type int, float given, called in /home/pc1/Expresstech/certificates_poc/vendor/phpoffice/phppresentation/src/PhpPresentation/Reader/PowerPoint2007.php on line 1129

image

using php 8.0 with laravel 8

I was struggling to solve this from last 1 day but at last I think this is some internal library files type error, please let me know solution or fix it asap.

@samverhoeven
Copy link

I can confirm this issue.
On this line, the result of a division (will always be a float) is given to a function that expects an int.

@vibhavankhade
Copy link

I am facing same issue
please help me out
TypeError: PhpOffice\PhpPresentation\Shape\RichText\Paragraph::setSpacingBefore(): Argument #1 ($spacingBefore) must be of type int, float given, called in D:\Projects\xampp8.2.4\htdocs\magento246p1\vendor\phpoffice\phppresentation\src\PhpPresentation\Reader\PowerPoint2007.php on line 1131 and defined in D:\Projects\xampp8.2.4\htdocs\magento246p1\vendor\phpoffice\phppresentation\src\PhpPresentation\Shape\RichText\Paragraph.php:367

@Progi1984
Copy link
Member

@samverhoeven @Bhadresh-Malankiya @vibhavankhade Have you got a sample file with the error, please ?

@samverhoeven
Copy link

@Progi1984, I'm not sure anymore which files in my repos caused this issue, so that would that me too much time.
If the setSpacingBefore function really needs to receive an int, I would then cast the result of the division in PowerPoint2007 to an int. If the Paragraph can also work with the spacingBefore property being a float, I would just leave out the type hinting as long as php 7 is still supported.
Or am I oversimplifying things here?

@Progi1984
Copy link
Member

@Bhadresh-Malankiya @samverhoeven @vibhavankhade This issue has been fixed by a maintainer. You can help him by sponsoring him through Github sponsors.

@purohitvijay
Copy link

Hi @Progi1984 ,

Is it possible to address this issue in a patch, as it's a blocking problem? It would be helpful if the fix could be merged a bit sooner.

Thank You

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging a pull request may close this issue.

5 participants