From: php at Bothware dot com
Operating system: Linux & Windows
PHP version: 4.3.2
PHP Bug Type: XSLT related
Bug description: Not all entity names recognised and some output glitches
Description:
------------
XSLT_process throws errors when it encounters certain valid entity names,
for the data I use, a suitable workarround was to replace them with
enitity numbers within a certain range.
( this maybe a missing feature as opposed to a proper bug )
A definite bug does occur with the output though :
character sequences such as ’ are output instead of entities such as
’ --- this is really really annoying, and I have to post-process the
output because of it.
WORKARROUNDS :
Solution to input 'bug'
$entities = array(128 => '#8364', 130 => '#8218', 131 => '#402', 132 =>
'#8222', 133 => '#8230', 134 => '#8224', 135 => '#8225', 136 => '#710',
137 => '#8240', 138 => '#352', 139 => '#8249', 140 => '#338', 145 =>
'#8216', 146 => '#8217', 147 => '#8220', 148 => '#8221', 149 => '#8226',
150 => '#8211', 151 => '#8212', 152 => '#732', 153 => '#8482', 154 =>
'#353', 155 => '#8250', 156 => '#339', 159 => '#376'
then do a find & replace
Soltuion to output 'bug'
function correctXSLT( $s ) {
$r = str_replace('’', '’', $s);
$r = str_replace('‘', '‘', $r);
$r = str_replace('“', '“', $r);
$r = str_replace('”', '”', $r);
$r = str_replace('…', '…', $r);
return $r;
}
Reproduce code:
---------------
$x = xslt_create();
$a['xml']='<?xml version="1.0" encoding="UTF-8" ?'.'><somedata>’
‘ “ ” …</somedata>';
$result = xslt_process($x, 'arg:/_xml', 'xslInstr.xsl', NULL, $a);
/* this is a very minimalised example -- the actual files I'm processing
are about 2mb each !! */
Expected result:
----------------
’
‘
“
”
…
Actual result:
--------------
’
‘
“
”
…
--
Edit bug report at http://bugs.php.net/?id=24863&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=24863&r=trysnapshot4
Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=24863&r=trysnapshot5
Fixed in CVS: http://bugs.php.net/fix.php?id=24863&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=24863&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=24863&r=needtrace
Try newer version: http://bugs.php.net/fix.php?id=24863&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=24863&r=support
Expected behavior: http://bugs.php.net/fix.php?id=24863&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=24863&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=24863&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=24863&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=24863&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=24863&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=24863&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=24863&r=gnused