php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #68188 Imagick can't display "<" and "&"
Submitted: 2014-10-08 14:29 UTC Modified: 2014-10-17 13:13 UTC
From: martin dot schmitz at uni-bielefeld dot de Assigned:
Status: Not a bug Package: Unknown/Other Function
PHP Version: 5.6.1 OS: Linux 64Bit Mageia 5
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: martin dot schmitz at uni-bielefeld dot de
New email:
PHP Version: OS:

 

 [2014-10-08 14:29 UTC] martin dot schmitz at uni-bielefeld dot de
Description:
------------
---
From manual page: http://www.php.net/class.imagick
---
$im = new Imagick();
$svg = '<?xml version="1.0" encoding="UTF-8"?>';
$svg .= '<svg style="width:240; height:240;" version="1.1">';
$svg .= svg_figure();
$svg .= '</svg>';

$im->readImageBlob ($svg);
$im->setImageFormat ($_REQUEST['type']);
$im->paintTransparentImage ($im->getImagePixelColor (0, 0), 0, 0);
echo $im;

function svg_figure($char){
return '<svg>
<text id="letter" x="5" y="14"><tspan style="font-family:Arial, Helvetica, sans-serif; font-size:20pt;" >'.chr($char).'</tspan></text>
</svg>';
}

I run (code are just relevant sniplets) svg_figure() through various aasci-codes. All (printable) characters are printed fine except "<" and "&".




Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2014-10-17 13:13 UTC] tyrael@php.net
-Status: Open +Status: Not a bug
 [2014-10-17 13:13 UTC] tyrael@php.net
from what I can tell, you are generating invalid xml.
either use CDATA or htmlspecialchars if you want to put arbitrary strings into your svg xml.
 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Thu Oct 08 03:00:02 2026 UTC