Inkscape strips processing instructions

Bug #199435 reported by Petr Dlouhý
2
Affects Status Importance Assigned to Milestone
Inkscape
Fix Released
Low
Unassigned
0.46.x
Won't Fix
Low
Unassigned

Bug Description

Xml document is valid, if a php script (<?php ..... ?> ) is included, and Inkscape open such document correctly. The problem is, that when this document is saved, all scripts are gone (at least in my version - 0.46~pre1-0ubuntu2).

My workaround is to make Inkscape not remove php scripts is:
<!--
         <?php
         print "-"."->\n";
         require("mapobject.php");
         print "<!-"."- ";
         ?>
-->
But when you need to send HTTP Content-Type header, you must not use "<!--" before - so it is unusable.

Revision history for this message
Petr Dlouhý (petr-dlouhy) wrote :
Revision history for this message
MenTaLguY (mental-deactivatedaccount) wrote :

Well... since we do make an effort to preserve comments, we should probably make an effort to preserve XML processing instructions as well (which is how the XML parser sees PHP fragments).

Note that not all uses of PHP can be accomodated, only those where the XML document structure is valid without PHP expansion.

Changed in inkscape:
importance: Undecided → Low
milestone: none → 0.47
status: New → Confirmed
assignee: nobody → mental
Revision history for this message
Petr Dlouhý (petr-dlouhy) wrote :

The similar problem like this is that when there is javascript in document with something between CDATA, like this:

<script type="text/javascript">
  //<![CDATA[
    document.write('something nasty<>&');
  //]]>
</script>

Then Inkscape will remove CDATA section and replace it with &something notation like this:

<svg:script
  id="script2419">
  //
  document.write('something nasty&lt;&gt;&amp;');
//</svg:script>

The meaning is equivalent, but this behaviour is unpleasant, because it could make the script unreadable.

Revision history for this message
MenTaLguY (mental-deactivatedaccount) wrote :

Comitted to trunk. We're a bit late in the 0.46 release cycle now, but the feature should show up in 0.47, and I'll leave the bug open so that it will be flagged for backporting to 0.46.1.

Changed in inkscape:
milestone: 0.47 → 0.46.1
Revision history for this message
MenTaLguY (mental-deactivatedaccount) wrote :

Please open a separate bug for the CDATA thing.

Changed in inkscape:
status: Confirmed → Fix Committed
Revision history for this message
MenTaLguY (mental-deactivatedaccount) wrote :

Note for backporters: the fix is in r17713 of trunk.

Revision history for this message
Petr Dlouhý (petr-dlouhy) wrote :

The bug is reported as #199656.

jazzynico (jazzynico)
Changed in inkscape:
milestone: 0.46.1 → 0.47
ScislaC (scislac)
Changed in inkscape:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.