Bug #86428

simplexml_load_string in ImageInfo should ignore warnings

Added by R3 H6 12 months ago. Updated 5 months ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Content Rendering
Target version:
Start date:
2018-09-28
Due date:
% Done:

100%

TYPO3 Version:
8
PHP Version:
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

...as it does with errors.

Core: Error handler (FE): PHP Warning: simplexml_load_string(): <sfw xmlns="&ns_sfw;"> in /typo3_src-8.7.19/typo3/sysext/core/Classes/Type/File/ImageInfo.php line 95

vitra-logo-illustrator-not-working.svg View (2.21 KB) Sven Teuber, 2019-01-07 16:28

vitra-logo-inkscape-working.svg View (2.98 KB) Sven Teuber, 2019-01-07 16:28

Associated revisions

Revision bc76058e (diff)
Added by Remo H. 5 months ago

[BUGFIX] Prevent throwing warnings when extract svg image sizes

TYPO3 should silently ignore errors and warnings in svg images.

Resolves: #86428
Releases: master, 9.5, 8.7
Change-Id: I54bb19ac0a6c949a8b150808f52562b73653e739
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/59802
Tested-by: Daniel Goerz <>
Tested-by: TYPO3com <>
Tested-by: Susanne Moog <>
Reviewed-by: Daniel Goerz <>
Reviewed-by: Jörg Bösche <>
Reviewed-by: Susanne Moog <>

Revision 63c756ef (diff)
Added by Remo H. 5 months ago

[BUGFIX] Prevent throwing warnings when extract svg image sizes

TYPO3 should silently ignore errors and warnings in svg images.

Resolves: #86428
Releases: master, 9.5, 8.7
Change-Id: I54bb19ac0a6c949a8b150808f52562b73653e739
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/60470
Tested-by: TYPO3com <>
Tested-by: Susanne Moog <>
Reviewed-by: Susanne Moog <>

History

#1 Updated by Gerrit Code Review 12 months ago

  • Status changed from New to Under Review

Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/58450

#2 Updated by Tymoteusz Motylewski 12 months ago

please provide steps to reproduce the issue including example svg file.
Thanks!

#3 Updated by R3 H6 12 months ago

Unfortunately I can not provide the full svg because it is from client project which is not yet online.

The problem is, that simplexml_load_string throws a warning if the namespaces are not correct. This should simply be ignored.
It is not the responsibilty of TYPO3 to log/show any error within an uploaded svg image (external resource).

Here just the relevant part:

<?xml version="1.0" encoding="iso-8859-1"?>
<!-- Generator: Adobe Illustrator 22.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0)  -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN" "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd" [
    <!ENTITY ns_extend "http://ns.adobe.com/Extensibility/1.0/">
    <!ENTITY ns_ai "http://ns.adobe.com/AdobeIllustrator/10.0/">
    <!ENTITY ns_graphs "http://ns.adobe.com/Graphs/1.0/">
    <!ENTITY ns_vars "http://ns.adobe.com/Variables/1.0/">
    <!ENTITY ns_imrep "http://ns.adobe.com/ImageReplacement/1.0/">
    <!ENTITY ns_sfw "http://ns.adobe.com/SaveForWeb/1.0/">
    <!ENTITY ns_custom "http://ns.adobe.com/GenericCustomNamespace/1.0/">
    <!ENTITY ns_adobe_xpath "http://ns.adobe.com/XPath/1.0/">
    <!ENTITY st0 "display:none;">
    <!ENTITY st1 "display:inline;fill:#E5E9F5;">
    <!ENTITY st2 "fill:#E5EDF4;">
    <!ENTITY st3 "fill:#005292;">
]>
<svg version="1.0" xmlns:x="&ns_extend;" xmlns:i="&ns_ai;" xmlns:graph="&ns_graphs;" 
     xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 504.57 334.48" 
     style="enable-background:new 0 0 504.57 334.48;" xml:space="preserve">
<!-- ... -->
</svg

From sys_log:

 Core: Exception handler (WEB): Uncaught TYPO3 Exception: #1476107295                               
 : PHP Warning: simplexml_load_string(): namespace warning : xmlns: URI &amp;ns_sfw; is not absolute in
 /var/www/web/typo3/sysext/core/Classes/Type/File/ImageInfo.php line 124 
 | TYPO3\CMS\Core\Error\Exception thrown in file /var/www/web/typo3/sysext/core/Classes/Error/ErrorHandler.php in line 116. 
 Requested URL: http://www.domain.vm/typo3/index.php?route=%%2Fajax%%2Ffile%%2Fprocess&token=--Anonymiz

#4 Updated by Sven Teuber 9 months ago

Issue still exists in TYPO3 8.7.22. Example SVG attached.
It has something to do with the SVG code Adobe Illustrator exports. After optimizing the file in Inkscape, the SVG code looks very different and the file can be uploaded without errors (second attached file).

#5 Updated by Gerrit Code Review 7 months ago

Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/59802

#6 Updated by Gerrit Code Review 7 months ago

Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/59802

#7 Updated by Gerrit Code Review 6 months ago

Patch set 3 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/59802

#8 Updated by Gerrit Code Review 5 months ago

Patch set 1 for branch 9.5 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/60470

#9 Updated by Remo H. 5 months ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100

#10 Updated by Gerrit Code Review 5 months ago

  • Status changed from Resolved to Under Review

Patch set 1 for branch TYPO3_8-7 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/60473

#11 Updated by Remo H. 5 months ago

  • Status changed from Under Review to Resolved

#12 Updated by Benni Mack 5 months ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF