Bug #86428

simplexml_load_string in ImageInfo should ignore warnings

Added by R3 H6 5 months ago. Updated about 1 month ago.

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

0%

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

History

#1 Updated by Gerrit Code Review 5 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 5 months ago

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

#3 Updated by R3 H6 5 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 about 1 month 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).

Also available in: Atom PDF