-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
Undefined index: height
exception on reading vmlDrawings
#1347
Comments
malles
added a commit
to malles/PhpSpreadsheet
that referenced
this issue
Feb 4, 2020
Fixes PHPOffice#1347. Indentation in the xml leaves spaces in style string even after replacing newlines. Replacing the spaces ensures no spaces in keys of the resulting style-array
malles
changed the title
Undefined index: height exception on reading vmlDrawings
Feb 4, 2020
Undefined index: height
exception on reading vmlDrawings
malles
added a commit
to malles/PhpSpreadsheet
that referenced
this issue
Feb 4, 2020
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. |
PowerKiKi
pushed a commit
to malles/PhpSpreadsheet
that referenced
this issue
Apr 5, 2020
Indentation in the xml leaves spaces in style string even after replacing newlines. Replacing the spaces ensures no spaces in keys of the resulting style-array Fixes PHPOffice#1347
PowerKiKi
pushed a commit
that referenced
this issue
Apr 5, 2020
Indentation in the xml leaves spaces in style string even after replacing newlines. Replacing the spaces ensures no spaces in keys of the resulting style-array Fixes #1347
Thanks! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is:
Similar closed issue (stale): #888
What is the expected behavior?
Styled vmlDrawings can be read from an xlsx file, or will at least not crash the reader..
What is the current behavior?
In some examples the reader throws exception
Undefined index: height
onXlsx.php (line 1048)
.What are the steps to reproduce?
I have found this issue in various XLSX files.
Consider an XML with a vmlDrawing like this
The style from the shape is extracted via Xlsx::toCSSArray. Here the newlines are stripped:
$style = trim(str_replace(["\r", "\n"], '', $style), ';');
.As a result, the whitespace from the tab is not trimmed;
position:absolute;margin-left:424.5pt;margin-top:169.5pt;width:67.5pt; height:13.5pt;z-index:5;mso-wrap-style:tight
.This leaves the spaces in the key for
height
in the resulting style array:This leads to
$hfImages[(string) $shape['id']]->setHeight($style['height']);
(src) throwing theUndefined index: height
exception.Proposed fix
Also replace the spaces in
Xlsx::toCSSArray
;$style = trim(str_replace(["\r", "\n", ' '], '', $style), ';');
Which versions of PhpSpreadsheet and PHP are affected?
Most recent (1.10.1).
The text was updated successfully, but these errors were encountered: