Here's the output:
PHP Notice: Trying to get property of non-object in /var/www/saxon/crap.php on line 28
^spits those characters out with the error function turned off too
Similar output with the XML_XSLT2ProcessorTest.php:
PHP Notice: Use of undefined constant PHPUnit_MAIN_METHOD - assumed 'PHPUnit_MAIN_METHOD' in /var/www/pear/tests/XML_XSLT2Processor/tests/XML_XSLT2ProcessorTest.php on line 686
The first script works fine with PHP on Windows as long as I take out the: "echo XML_XSLT2Processor::getErrors(-1)->level;"
Here are the Linux/BSD machines I tested on. All have identical results:
+++++++++============+++++++++
OpenBSD box:
$ php -v
PHP 5.2.3 with Suhosin-Patch 0.9.6.2 (cli) (built: Aug 18 2007 00:03:59)
Copyright (c) 1997-2007 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2007 Zend Technologies
Also tested on a CentOS5 virtuozzo server with virtually identical apache and php as the Red Hat box. If you need more information from me, feel free to contact. Thanks.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
That's very interesting. I must say, I've never made any tests on any Linux machine, so all is pretty insteresting, and every information you can give out is, and will be appeciated a lot.
I see the reason for the "" that appears everywhere. That's UTF-8's Byte Order Mark (BOM). I saved all files as UTF-8 to ensure they would work well in cases where i13n is of the essense. I guess BOM is not needed. I'll remove it in the next release.
The notice in the test comes from the last part in the test suite file:
if (PHPUnit_MAIN_METHOD == 'Framework_AllTests::main') {
Framework_AllTests::main();
}
Honestly said, I'm not sure what that is. I just copied it from PHPUnit's documentation. I assumed its needed in cases where the tests may be run from an environment other than the CLI. Comment that out and see if the test suite actually runs. I'm most interested in seeing the results from it.
From your own sample, instead of
echo XML_XSLT2Processor::getErrors(-1)->level;
try to get the output of
print_r(XML_XSLT2Processor::getErrors());
and see what's wrong from there. If you can show me the XML/XSLT you're using, it would also help in showing what may cause all this (though I'm assuming the XML and XSLT are fine and dandy since you say it works on Windows).
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
"I see the reason for the "" that appears everywhere. That's UTF-8's Byte Order Mark (BOM). I saved all files as UTF-8..."
Ah, that makes sense then. You don't have to take it out if it would affect those needing the file in that format.
"...try to get the output of
print_r(XML_XSLT2Processor::getErrors());
and see what's wrong from there. If you can show me the XML/XSLT you're using, it would also help in showing what may cause all this (though I'm assuming the XML and XSLT are fine and dandy since you say it works on Windows). "
Running the test suite didn't produce output different than what I posted before. I was surprised by that. Yes, transforms with the class work great on my Windows platform. I tested that running XAMPP. I don't want to post the XSLT/XML files here, but if you like I can email them if it will help diagnose the problem.
I should have also mentioned that when I run saxon9.jar or Transform.exe (via mono) from the shell on the files, I get the expected output: an html file. It's seems almost as if PHP isn't really invoking saxon, even when I point the script directly at it. Same behavior now matter how I change the environmental variables. Yet if I deliberately point the script to the wrong "saxon" path it says it's an invalid. I looked at the class and I don't see why it wouldn't invoke saxon correctly. Every once in a while, a tmp file in XML format will appear in the web root. That's really hit or miss. I can't get it to occur reliably. The only other information I have that I think may play a part is I've tried running the script under Apache running php as a cgi, and as an Apache module. Same results with both.
I'll keep trying different things and let you know if I have any success.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Try to pass the names of the XML and XSLT as file names, instead of DOMDocuments. That is, replace
$xml = new DOMDocument;
$xml->load('index.xml');
$xsl = new DOMDocument;
$xsl->load('style.xsl');
===
with
===
$xml = 'index.xml';
$xsl = 'style.xsl';
===
If that is still not working, look at the various values you get with $proc->command, perhaps with something like that:
if ($html = $proc->transformToXML($xml)) {
echo $html;
} else {
echo $proc->command;
}
===
If you try to run THAT command on the command line, are there any errors? There should be, otherwise the condition shouldn't have matched to echo the command.
I *think* DOMDocument objects may behave like that because there's a bug in PHP 5.2.3 and earlier that affects how tempnam() handles relative paths. I'm not using relative anywhere though, so I'm not sure how this is related. It's just that the difference between using a DOMDocument object and passing a filename directly is that a new temporary file is created and that file is used for the transformation.
The other possible reason may be the DOM extension itself. I've seen weird Linux builds that practically use the DOM_XML extension (I mean, seriously, in PHP5?!? Please!!!), but still allow you to construct a DOMDocument object. That too doesn't make complete sence though, as DOM_XML doesn't have a load() method, so I would have guessed there will be an error at loading the XML and XSLT (i.e. before transformToXML() actually starts).
And another guess, in the source of 'XML/XSLT2Processor.php', find:
proc_open('"' . $this->command . '"',
and replace it with
proc_open($this->command,
The quotes were added at the early days when exec() was used. I'm not sure if proc_open() needs them too.
(beware that this is really shooting in the dark for me)
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Aha! Changing proc_open did it. You were right on the money. I actually tried without the DOM stuff like that before because I was pretty sure that was deprecated in XSLT 2.0. I could be wrong.
On an unrelated note, for some reason PHP is ignoring the environmental variables I set up, so I wrote a shell script and set the construct function to call that instead of saxon directly. I'll have to fix that later... Anyway, here's what the transformation script looks like in case it will help someone else:
<html>
<?php
include "XML/XSLT2Processor.php";
XML_XSLT2Processor::clearErrors ();
$xml = 'indexfoo.xml';
$xsl = 'stylefoo.xsl';
$proc = new XML_XSLT2Processor('SAXON', 'file:////usr/java/jdk1.5.0_14/bin/java_exec');
$proc->importStyleSheet($xsl); // attach the xsl rules
I forgot to mention a couple of things... I ran the PHPunit tests incorrectly earlier (whoops) because I failed to notice the wiki article. When I run it as specified there now I only get two failures and one error that seem inconsequential. I'm not so sure I'd want to junk up the forum by posting all that output here...
Also, here's the "java_exec" shell wrapper I wrote for starting java until I figure out why the env variables are disregarded by php-cgi:
I'm glad it works for you. Now, I was just wondering, could you show me the output of the test suite? I mean, after the failures and errors (the names of the failed tests, and the debugging info there). If I'm to solve those problems, I'd first need to know what problems actually exist. I'll obviously try to fix the command line initialization issue, but if there are more failures and an error, there may be more that I'm missing.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I'm not sure if you were sarcastic about that (I mean you said "ASAP", yet it's over a week and I see nothing), but I've released a new release, attempting to fix the issue described here.
If the test suite still has some errors/failures, please show at least the names of the failed tests and ideally also show the debuggging info that is outputted.
Anyway...
Thank you very much for what you have done already.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
No, not sarcastic. Just forgetful. Apologies for that. Installed the new release. There's a lot of debug output, most errors are generated by a missing file in the test suite. I ran this as root or else it complains about lack of mkdir() permission...
Raw error log:
<?xml version="1.0"?>
<errorLog><instance processor="SAXON" interface="JAVA-CLI">Picked up _JAVA_OPTIONS: -Xms20m -Xmx64m -XX:MinHeapFreeRatio=20 -XX:MaxHeapFreeRatio=40 -XX:NewSize=10m -XX:MaxNewSize=10m -XX:SurvivorRatio=6 -XX:TargetSurvivorRatio=80 -XX:+CMSClassUnloadingEnabled -XX:+CMSPermGenSweepingEnabled
Warning: at xsl:stylesheet on line 2 of file:/usr/share/pear/test/XML_XSLT2Processor/tests/stylesheets/simple.xsl:
Running an XSLT 1.0 stylesheet with an XSLT 2.0 processor
Error
java.io.FileNotFoundException:
/d:/svnrepos/XML_XSLT2Processor/branches/0.5.1/XML_XSLT2Processor-0.5.1/tests/sources/sample.dtd (No such file or directory)
Transformation failed: Run-time errors were reported
<tmpFile>/usr/share/pear/test/XML_XSLT2Processor/tests/RESULT_TEMP4QmrGm</tmpFile><tmpFile>/usr/share/pear/test/XML_XSLT2Processor/tests/ERROR_LOG_DtwTss</tmpFile></instance></errorLog>
Failed asserting that two strings are equal.
expected string <<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><title>Untitled Document</title></head><body>This is a simple well formed XML document.</body></html>>
difference <????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????>
got string <>
/usr/share/pear/test/XML_XSLT2Processor/tests/XML_XSLT2ProcessorTest.php:85
Raw error log:
<?xml version="1.0"?>
<errorLog><instance processor="SAXON" interface="JAVA-CLI">Picked up _JAVA_OPTIONS: -Xms20m -Xmx64m -XX:MinHeapFreeRatio=20 -XX:MaxHeapFreeRatio=40 -XX:NewSize=10m -XX:MaxNewSize=10m -XX:SurvivorRatio=6 -XX:TargetSurvivorRatio=80 -XX:+CMSClassUnloadingEnabled -XX:+CMSPermGenSweepingEnabled
Warning: at xsl:stylesheet on line 2 of file:/usr/share/pear/test/XML_XSLT2Processor/tests/stylesheets/simple.xsl:
Running an XSLT 1.0 stylesheet with an XSLT 2.0 processor
Error
java.io.FileNotFoundException:
/d:/svnrepos/XML_XSLT2Processor/branches/0.5.1/XML_XSLT2Processor-0.5.1/tests/sources/sample.dtd (No such file or directory)
Transformation failed: Run-time errors were reported
<tmpFile>/usr/share/pear/test/XML_XSLT2Processor/tests/RESULT_TEMP2qoLfy</tmpFile></instance></errorLog>
Failed asserting that two strings are equal.
expected string <DOMDocument>
difference <???????????>
got string <>
/usr/share/pear/test/XML_XSLT2Processor/tests/XML_XSLT2ProcessorTest.php:93
Raw error log:
<?xml version="1.0"?>
<errorLog><instance processor="SAXON" interface="JAVA-CLI">Picked up _JAVA_OPTIONS: -Xms20m -Xmx64m -XX:MinHeapFreeRatio=20 -XX:MaxHeapFreeRatio=40 -XX:NewSize=10m -XX:MaxNewSize=10m -XX:SurvivorRatio=6 -XX:TargetSurvivorRatio=80 -XX:+CMSClassUnloadingEnabled -XX:+CMSPermGenSweepingEnabled
Warning: at xsl:stylesheet on line 2 of file:/usr/share/pear/test/XML_XSLT2Processor/tests/stylesheets/XSL_TEMPZrgRET:
Running an XSLT 1.0 stylesheet with an XSLT 2.0 processor
Error
java.io.FileNotFoundException:
/d:/svnrepos/XML_XSLT2Processor/branches/0.5.1/XML_XSLT2Processor-0.5.1/tests/sources/sample.dtd (No such file or directory)
Transformation failed: Run-time errors were reported
<tmpFile>/usr/share/pear/test/XML_XSLT2Processor/tests/stylesheets/XSL_TEMPZrgRET</tmpFile><tmpFile>/usr/share/pear/test/XML_XSLT2Processor/tests/RESULT_TEMPgGEpN0</tmpFile></instance></errorLog>
Failed asserting that two strings are equal.
expected string <<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><title>Untitled Document</title></head><body>changed\<br>used<br></body></html>>
difference <??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????>
got string <>
/usr/share/pear/test/XML_XSLT2Processor/tests/XML_XSLT2ProcessorTest.php:134
Raw error log:
<?xml version="1.0"?>
<errorLog><instance processor="SAXON" interface="JAVA-CLI">Picked up _JAVA_OPTIONS: -Xms20m -Xmx64m -XX:MinHeapFreeRatio=20 -XX:MaxHeapFreeRatio=40 -XX:NewSize=10m -XX:MaxNewSize=10m -XX:SurvivorRatio=6 -XX:TargetSurvivorRatio=80 -XX:+CMSClassUnloadingEnabled -XX:+CMSPermGenSweepingEnabled
Warning: at xsl:stylesheet on line 2 of file:/usr/share/pear/test/XML_XSLT2Processor/tests/stylesheets/XSL_TEMP5JJ9h9:
Running an XSLT 1.0 stylesheet with an XSLT 2.0 processor
Error
java.io.FileNotFoundException:
/d:/svnrepos/XML_XSLT2Processor/branches/0.5.1/XML_XSLT2Processor-0.5.1/tests/sources/sample.dtd (No such file or directory)
Transformation failed: Run-time errors were reported
<tmpFile>/usr/share/pear/test/XML_XSLT2Processor/tests/stylesheets/XSL_TEMP5JJ9h9</tmpFile><tmpFile>/usr/share/pear/test/XML_XSLT2Processor/tests/RESULT_TEMPmjeXMh</tmpFile><tmpFile>/usr/share/pear/test/XML_XSLT2Processor/tests/sources/XML_TEMPxwBLhq</tmpFile></instance></errorLog>
Failed asserting that two strings are equal.
expected string <<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><title>Untitled Document</title></head><body>This is a simple well formed XML document.</body></html>>
difference <????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????>
got string <>
/usr/share/pear/test/XML_XSLT2Processor/tests/XML_XSLT2ProcessorTest.php:163
Raw error log:
<?xml version="1.0"?>
<errorLog><instance processor="SAXON" interface="JAVA-CLI">Picked up _JAVA_OPTIONS: -Xms20m -Xmx64m -XX:MinHeapFreeRatio=20 -XX:MaxHeapFreeRatio=40 -XX:NewSize=10m -XX:MaxNewSize=10m -XX:SurvivorRatio=6 -XX:TargetSurvivorRatio=80 -XX:+CMSClassUnloadingEnabled -XX:+CMSPermGenSweepingEnabled
Warning: at xsl:stylesheet on line 2 of file:/usr/share/pear/test/XML_XSLT2Processor/tests/stylesheets/XSL_TEMPistJ8z:
Running an XSLT 1.0 stylesheet with an XSLT 2.0 processor
Error
java.io.FileNotFoundException:
/d:/svnrepos/XML_XSLT2Processor/branches/0.5.1/XML_XSLT2Processor-0.5.1/tests/sources/sample.dtd (No such file or directory)
Transformation failed: Run-time errors were reported
<tmpFile>/usr/share/pear/test/XML_XSLT2Processor/tests/stylesheets/XSL_TEMPistJ8z</tmpFile><tmpFile>/usr/share/pear/test/XML_XSLT2Processor/tests/RESULT_TEMPHRnJZJ</tmpFile><tmpFile>/usr/share/pear/test/XML_XSLT2Processor/tests/sources/XML_TEMP8AXJQT</tmpFile></instance></errorLog>
Failed asserting that two strings are equal.
expected string <<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><title>Untitled Document</title></head><body>Altered</body></html>>
difference <?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????>
got string <>
/usr/share/pear/test/XML_XSLT2Processor/tests/XML_XSLT2ProcessorTest.php:174
Raw error log:
<?xml version="1.0"?>
<errorLog><instance processor="SAXON" interface="JAVA-CLI">Picked up _JAVA_OPTIONS: -Xms20m -Xmx64m -XX:MinHeapFreeRatio=20 -XX:MaxHeapFreeRatio=40 -XX:NewSize=10m -XX:MaxNewSize=10m -XX:SurvivorRatio=6 -XX:TargetSurvivorRatio=80 -XX:+CMSClassUnloadingEnabled -XX:+CMSPermGenSweepingEnabled
Warning: at xsl:stylesheet on line 2 of file:/usr/share/pear/test/XML_XSLT2Processor/tests/stylesheets/param.xsl:
Running an XSLT 1.0 stylesheet with an XSLT 2.0 processor
Error
java.io.FileNotFoundException:
/d:/svnrepos/XML_XSLT2Processor/branches/0.5.1/XML_XSLT2Processor-0.5.1/tests/sources/sample.dtd (No such file or directory)
Transformation failed: Run-time errors were reported
<tmpFile>/usr/share/pear/test/XML_XSLT2Processor/tests/RESULT_TEMPNtAahP</tmpFile></instance></errorLog>
Failed asserting that two strings are equal.
expected string <<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><title>Untitled Document</title></head><body>"changed\<br>us"ed"<br></body></html>>
difference <?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????>
got string <>
/usr/share/pear/test/XML_XSLT2Processor/tests/XML_XSLT2ProcessorTest.php:224
Raw error log:
<?xml version="1.0"?>
<errorLog><instance processor="SAXON" interface="JAVA-CLI">Picked up _JAVA_OPTIONS: -Xms20m -Xmx64m -XX:MinHeapFreeRatio=20 -XX:MaxHeapFreeRatio=40 -XX:NewSize=10m -XX:MaxNewSize=10m -XX:SurvivorRatio=6 -XX:TargetSurvivorRatio=80 -XX:+CMSClassUnloadingEnabled -XX:+CMSPermGenSweepingEnabled
Warning: at xsl:stylesheet on line 2 of file:/usr/share/pear/test/XML_XSLT2Processor/tests/stylesheets/param.xsl:
Running an XSLT 1.0 stylesheet with an XSLT 2.0 processor
Error
java.io.FileNotFoundException:
/d:/svnrepos/XML_XSLT2Processor/branches/0.5.1/XML_XSLT2Processor-0.5.1/tests/sources/sample.dtd (No such file or directory)
Transformation failed: Run-time errors were reported
<tmpFile>/usr/share/pear/test/XML_XSLT2Processor/tests/RESULT_TEMPix6Pg3</tmpFile><tmpFile>/usr/share/pear/test/XML_XSLT2Processor/tests/PARAM_TEMP_testNJFxgh</tmpFile><tmpFile>/usr/share/pear/test/XML_XSLT2Processor/tests/PARAM_TEMP_path6zMggv</tmpFile></instance></errorLog>
Failed asserting that two strings are equal.
expected string <<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><title>Untitled Document</title></head><body>йе\<br>Ñ~Oко<br></body></html>>
difference <?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????>
got string <>
/usr/share/pear/test/XML_XSLT2Processor/tests/XML_XSLT2ProcessorTest.php:234
Raw error log:
<?xml version="1.0"?>
<errorLog><instance processor="SAXON" interface="JAVA-CLI">Picked up _JAVA_OPTIONS: -Xms20m -Xmx64m -XX:MinHeapFreeRatio=20 -XX:MaxHeapFreeRatio=40 -XX:NewSize=10m -XX:MaxNewSize=10m -XX:SurvivorRatio=6 -XX:TargetSurvivorRatio=80 -XX:+CMSClassUnloadingEnabled -XX:+CMSPermGenSweepingEnabled
Warning: at xsl:stylesheet on line 2 of file:/usr/share/pear/test/XML_XSLT2Processor/tests/stylesheets/param.xsl:
Running an XSLT 1.0 stylesheet with an XSLT 2.0 processor
Error
java.io.FileNotFoundException:
/d:/svnrepos/XML_XSLT2Processor/branches/0.5.1/XML_XSLT2Processor-0.5.1/tests/sources/sample.dtd (No such file or directory)
Transformation failed: Run-time errors were reported
<tmpFile>/usr/share/pear/test/XML_XSLT2Processor/tests/RESULT_TEMPdwLrAK</tmpFile></instance></errorLog>
Failed asserting that two strings are equal.
expected string <<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><title>Untitled Document</title></head><body>This is a simple well formed XML document.<br>parameter<br></body></html>>
difference <?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????>
got string <>
/usr/share/pear/test/XML_XSLT2Processor/tests/XML_XSLT2ProcessorTest.php:244
Raw error log:
<?xml version="1.0"?>
<errorLog><instance processor="SAXON" interface="JAVA-CLI">Picked up _JAVA_OPTIONS: -Xms20m -Xmx64m -XX:MinHeapFreeRatio=20 -XX:MaxHeapFreeRatio=40 -XX:NewSize=10m -XX:MaxNewSize=10m -XX:SurvivorRatio=6 -XX:TargetSurvivorRatio=80 -XX:+CMSClassUnloadingEnabled -XX:+CMSPermGenSweepingEnabled
Warning: at xsl:stylesheet on line 2 of file:/usr/share/pear/test/XML_XSLT2Processor/tests/stylesheets/param.xsl:
Running an XSLT 1.0 stylesheet with an XSLT 2.0 processor
Error
java.io.FileNotFoundException:
/d:/svnrepos/XML_XSLT2Processor/branches/0.5.1/XML_XSLT2Processor-0.5.1/tests/sources/sample.dtd (No such file or directory)
Transformation failed: Run-time errors were reported
<tmpFile>/usr/share/pear/test/XML_XSLT2Processor/tests/RESULT_TEMPoB8Rg1</tmpFile></instance></errorLog>
Failed asserting that two strings are equal.
expected string <<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><title>Untitled Document</title></head><body>default<br>unchanged<br></body></html>>
difference <??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????>
got string <>
/usr/share/pear/test/XML_XSLT2Processor/tests/XML_XSLT2ProcessorTest.php:264
10) testAutoStylesheetByPI(testSAXON_JAVACLI)
Command:
java -jar '/usr/local/saxon/saxon9.jar' -o:/usr/share/pear/test/XML_XSLT2Processor/tests/RESULT_TEMPpGiiij -a -s:/usr/share/pear/test/XML_XSLT2Processor/tests/sources/well-formed.xml
Libxml:
XML_XSLT2Processor:
Raw error log:
<?xml version="1.0"?>
<errorLog><instance processor="SAXON" interface="JAVA-CLI">Picked up _JAVA_OPTIONS: -Xms20m -Xmx64m -XX:MinHeapFreeRatio=20 -XX:MaxHeapFreeRatio=40 -XX:NewSize=10m -XX:MaxNewSize=10m -XX:SurvivorRatio=6 -XX:TargetSurvivorRatio=80 -XX:+CMSClassUnloadingEnabled -XX:+CMSPermGenSweepingEnabled
Failed while looking for xml-stylesheet PI
<tmpFile>/usr/share/pear/test/XML_XSLT2Processor/tests/RESULT_TEMPpGiiij</tmpFile></instance></errorLog>
Failed asserting that two strings are equal.
expected string <<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><title>Untitled Document</title></head><body>This is a simple well formed XML document.</body></html>>
difference <????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????>
got string <>
/usr/share/pear/test/XML_XSLT2Processor/tests/XML_XSLT2ProcessorTest.php:285
11) testDomAutoStylesheetByPI(testSAXON_JAVACLI)
Command:
java -jar '/usr/local/saxon/saxon9.jar' -o:/usr/share/pear/test/XML_XSLT2Processor/tests/RESULT_TEMPgmDW4B -a -s:/usr/share/pear/test/XML_XSLT2Processor/tests/sources/XML_TEMPv8MBRU
Libxml:
XML_XSLT2Processor:
Raw error log:
<?xml version="1.0"?>
<errorLog><instance processor="SAXON" interface="JAVA-CLI">Picked up _JAVA_OPTIONS: -Xms20m -Xmx64m -XX:MinHeapFreeRatio=20 -XX:MaxHeapFreeRatio=40 -XX:NewSize=10m -XX:MaxNewSize=10m -XX:SurvivorRatio=6 -XX:TargetSurvivorRatio=80 -XX:+CMSClassUnloadingEnabled -XX:+CMSPermGenSweepingEnabled
Failed while looking for xml-stylesheet PI
<tmpFile>/usr/share/pear/test/XML_XSLT2Processor/tests/RESULT_TEMPgmDW4B</tmpFile><tmpFile>/usr/share/pear/test/XML_XSLT2Processor/tests/sources/XML_TEMPv8MBRU</tmpFile></instance></errorLog>
Failed asserting that two strings are equal.
expected string <<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><title>Untitled Document</title></head><body>This is a simple well formed XML document.</body></html>>
difference <????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????>
got string <>
/usr/share/pear/test/XML_XSLT2Processor/tests/XML_XSLT2ProcessorTest.php:293
Raw error log:
<?xml version="1.0"?>
<errorLog><instance processor="SAXON" interface="JAVA-CLI">Picked up _JAVA_OPTIONS: -Xms20m -Xmx64m -XX:MinHeapFreeRatio=20 -XX:MaxHeapFreeRatio=40 -XX:NewSize=10m -XX:MaxNewSize=10m -XX:SurvivorRatio=6 -XX:TargetSurvivorRatio=80 -XX:+CMSClassUnloadingEnabled -XX:+CMSPermGenSweepingEnabled
Warning: at xsl:stylesheet on line 2 of file:/usr/share/pear/test/XML_XSLT2Processor/tests/stylesheets/simple.xsl:
Running an XSLT 1.0 stylesheet with an XSLT 2.0 processor
Error
java.io.FileNotFoundException:
/d:/svnrepos/XML_XSLT2Processor/branches/0.5.1/XML_XSLT2Processor-0.5.1/tests/sources/sample.dtd (No such file or directory)
Transformation failed: Run-time errors were reported
<tmpFile>/usr/share/pear/test/XML_XSLT2Processor/tests/RESULT_TEMPVra7Gd</tmpFile></instance></errorLog>
Failed asserting that two strings are equal.
expected string <<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><title>Untitled Document</title></head><body>This is a simple well formed XML document.</body></html>>
difference <????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????>
got string <>
/usr/share/pear/test/XML_XSLT2Processor/tests/XML_XSLT2ProcessorTest.php:455
FAILURES!
Tests: 38, Failures: 12, Errors: 1.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The well-formed.xml test file has an absolute path to the DTD. It should have been relative.
Go to the well-formed.xml file (in "PEAR/tests/XML_XSLT2Processor/tests/sources/") and change
"file:///d:/svnrepos/XML_XSLT2Processor/branches/0.5.1/XML_XSLT2Processor-0.5.1/tests/sources/sample.dtd"
to just
"sample.dtd"
In the mean time, I'll change it, along with something else I've noticed, and will release a new release (I think I'll call it 0.5.1a).
God... how embarrassing.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
OK. I've released it. To install it, you'll have to first uninstall your current version, as the PEAR installer doesn't seem to find 0.5.1a greather than 0.5.1.
Also, ensure the folder "results" doesn't already exist in the "/usr/share/pear/test/XML_XSLT2Processor/tests/" folder before starting the tests. That's where the error at the beginning comes from.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
On second though, I replaced the 0.5.1 release, and removed the 0.5.1a (and I verified it would isntall). You were the only one to see all of those goofs anyway ^_^ .
(well... you, and anyone reading this topic anyway)
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
One last thing. Could you try how "All_Tests" works out? All non SAXON_JAVACLI tests should be marked skipped, but since we're talking Linux here, I'm not sure how will PHP react when COM is not available. It shouldn't emit any errors, but I'd like to know if it does.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
# phpunit All_Tests XML_XSLT2ProcessorTest.phpPHPUnit 3.2.15 by Sebastian Bergmann.
....SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS....................... 60 / 181
..........SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSPHP Fatal error: Class 'COM' not found in /usr/share/pear/XML/XSLT2Processor.php on line 238
Fatal error: Class 'COM' not found in /usr/share/pear/XML/XSLT2Processor.php on line 238
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I've tried this:
<?php
include "XML/XSLT2Processor.php";
// Load the XML source
$xml = new DOMDocument;
$xml->load('index.xml');
$xsl = new DOMDocument;
$xsl->load('style.xsl');
// Configure the transformer
$proc = new XML_XSLT2Processor('SAXON', 'saxon9.jar', 'JAVA-CLI');
$proc->importStyleSheet($xsl); // attach the xsl rules
//$proc->transformToURI($xml, 'out.html');
//if ($proc = $proc->transformToXML($xml)) {
// echo $proc;
//} else {
// trigger_error('XSL transformation failed.', E_USER_ERROR);
//}
//print $proc->transformToXML($xml);
if ($html = $proc->transformToXML($xml)) {
echo $html;
} else {
echo XML_XSLT2Processor::getErrors(-1)->level;
}
?>
Here's the output:
PHP Notice: Trying to get property of non-object in /var/www/saxon/crap.php on line 28
^spits those characters out with the error function turned off too
Similar output with the XML_XSLT2ProcessorTest.php:
PHP Notice: Use of undefined constant PHPUnit_MAIN_METHOD - assumed 'PHPUnit_MAIN_METHOD' in /var/www/pear/tests/XML_XSLT2Processor/tests/XML_XSLT2ProcessorTest.php on line 686
The first script works fine with PHP on Windows as long as I take out the: "echo XML_XSLT2Processor::getErrors(-1)->level;"
Here are the Linux/BSD machines I tested on. All have identical results:
+++++++++============+++++++++
OpenBSD box:
$ php -v
PHP 5.2.3 with Suhosin-Patch 0.9.6.2 (cli) (built: Aug 18 2007 00:03:59)
Copyright (c) 1997-2007 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2007 Zend Technologies
$ uname -a
OpenBSD 4.2 GENERIC.MP#1 amd64
$ httpd -v
Server version: Apache/1.3.29 (Unix)
+++++++++============+++++++++
+++++++++============+++++++++
RHEL5 box:
$ uname -a
Linux 2.6.18-53.1.13.el5 #1 SMP Mon Feb 11 13:27:52 EST 2008 i686 i686 i386 GNU/Linux
$ httpd -v
Server version: Apache/2.2.3
Server built: Jan 11 2008 08:19:18
$ php -v
PHP 5.1.6 (cli) (built: Sep 12 2007 11:10:42)
Copyright (c) 1997-2006 The PHP Group
Zend Engine v2.1.0, Copyright (c) 1998-2006 Zend Technologies
+++++++++============+++++++++
+++++++++============+++++++++
Also tested on a CentOS5 virtuozzo server with virtually identical apache and php as the Red Hat box. If you need more information from me, feel free to contact. Thanks.
That's very interesting. I must say, I've never made any tests on any Linux machine, so all is pretty insteresting, and every information you can give out is, and will be appeciated a lot.
I see the reason for the "" that appears everywhere. That's UTF-8's Byte Order Mark (BOM). I saved all files as UTF-8 to ensure they would work well in cases where i13n is of the essense. I guess BOM is not needed. I'll remove it in the next release.
The notice in the test comes from the last part in the test suite file:
if (PHPUnit_MAIN_METHOD == 'Framework_AllTests::main') {
Framework_AllTests::main();
}
Honestly said, I'm not sure what that is. I just copied it from PHPUnit's documentation. I assumed its needed in cases where the tests may be run from an environment other than the CLI. Comment that out and see if the test suite actually runs. I'm most interested in seeing the results from it.
From your own sample, instead of
echo XML_XSLT2Processor::getErrors(-1)->level;
try to get the output of
print_r(XML_XSLT2Processor::getErrors());
and see what's wrong from there. If you can show me the XML/XSLT you're using, it would also help in showing what may cause all this (though I'm assuming the XML and XSLT are fine and dandy since you say it works on Windows).
"I see the reason for the "" that appears everywhere. That's UTF-8's Byte Order Mark (BOM). I saved all files as UTF-8..."
Ah, that makes sense then. You don't have to take it out if it would affect those needing the file in that format.
"...try to get the output of
print_r(XML_XSLT2Processor::getErrors());
and see what's wrong from there. If you can show me the XML/XSLT you're using, it would also help in showing what may cause all this (though I'm assuming the XML and XSLT are fine and dandy since you say it works on Windows). "
Running the test suite didn't produce output different than what I posted before. I was surprised by that. Yes, transforms with the class work great on my Windows platform. I tested that running XAMPP. I don't want to post the XSLT/XML files here, but if you like I can email them if it will help diagnose the problem.
I should have also mentioned that when I run saxon9.jar or Transform.exe (via mono) from the shell on the files, I get the expected output: an html file. It's seems almost as if PHP isn't really invoking saxon, even when I point the script directly at it. Same behavior now matter how I change the environmental variables. Yet if I deliberately point the script to the wrong "saxon" path it says it's an invalid. I looked at the class and I don't see why it wouldn't invoke saxon correctly. Every once in a while, a tmp file in XML format will appear in the web root. That's really hit or miss. I can't get it to occur reliably. The only other information I have that I think may play a part is I've tried running the script under Apache running php as a cgi, and as an Apache module. Same results with both.
I'll keep trying different things and let you know if I have any success.
OK. That's something new and useful.
Try to pass the names of the XML and XSLT as file names, instead of DOMDocuments. That is, replace
$xml = new DOMDocument;
$xml->load('index.xml');
$xsl = new DOMDocument;
$xsl->load('style.xsl');
===
with
===
$xml = 'index.xml';
$xsl = 'style.xsl';
===
If that is still not working, look at the various values you get with $proc->command, perhaps with something like that:
if ($html = $proc->transformToXML($xml)) {
echo $html;
} else {
echo $proc->command;
}
===
If you try to run THAT command on the command line, are there any errors? There should be, otherwise the condition shouldn't have matched to echo the command.
I *think* DOMDocument objects may behave like that because there's a bug in PHP 5.2.3 and earlier that affects how tempnam() handles relative paths. I'm not using relative anywhere though, so I'm not sure how this is related. It's just that the difference between using a DOMDocument object and passing a filename directly is that a new temporary file is created and that file is used for the transformation.
The other possible reason may be the DOM extension itself. I've seen weird Linux builds that practically use the DOM_XML extension (I mean, seriously, in PHP5?!? Please!!!), but still allow you to construct a DOMDocument object. That too doesn't make complete sence though, as DOM_XML doesn't have a load() method, so I would have guessed there will be an error at loading the XML and XSLT (i.e. before transformToXML() actually starts).
And another guess, in the source of 'XML/XSLT2Processor.php', find:
proc_open('"' . $this->command . '"',
and replace it with
proc_open($this->command,
The quotes were added at the early days when exec() was used. I'm not sure if proc_open() needs them too.
(beware that this is really shooting in the dark for me)
Aha! Changing proc_open did it. You were right on the money. I actually tried without the DOM stuff like that before because I was pretty sure that was deprecated in XSLT 2.0. I could be wrong.
On an unrelated note, for some reason PHP is ignoring the environmental variables I set up, so I wrote a shell script and set the construct function to call that instead of saxon directly. I'll have to fix that later... Anyway, here's what the transformation script looks like in case it will help someone else:
<html>
<?php
include "XML/XSLT2Processor.php";
XML_XSLT2Processor::clearErrors ();
$xml = 'indexfoo.xml';
$xsl = 'stylefoo.xsl';
$proc = new XML_XSLT2Processor('SAXON', 'file:////usr/java/jdk1.5.0_14/bin/java_exec');
$proc->importStyleSheet($xsl); // attach the xsl rules
if ($html = $proc->transformToXML($xml)) {
print $html;
} else {
print_r(XML_XSLT2Processor::getErrors());
//echo $proc->command;
}
?>
</html>
Thanks for taking the time to assist in getting this working. I appreciate it.
I forgot to mention a couple of things... I ran the PHPunit tests incorrectly earlier (whoops) because I failed to notice the wiki article. When I run it as specified there now I only get two failures and one error that seem inconsequential. I'm not so sure I'd want to junk up the forum by posting all that output here...
Also, here's the "java_exec" shell wrapper I wrote for starting java until I figure out why the env variables are disregarded by php-cgi:
#!/bin/bash
export _JAVA_OPTIONS="-Xms20m -Xmx64m -XX:MinHeapFreeRatio=20 -XX:MaxHeapFreeRatio=40 -XX:NewSize=10m -XX:MaxNewSize=10m -XX:SurvivorRatio=6 -XX:TargetSurvivorRatio=80 -XX:+CMSClassUnloadingEnabled -XX:+CMSPermGenSweepingEnabled"
/usr/java/jdk1.5.0_14/bin/java -jar /usr/local/saxon/saxon9.jar $1 $2
I'm glad it works for you. Now, I was just wondering, could you show me the output of the test suite? I mean, after the failures and errors (the names of the failed tests, and the debugging info there). If I'm to solve those problems, I'd first need to know what problems actually exist. I'll obviously try to fix the command line initialization issue, but if there are more failures and an error, there may be more that I'm missing.
I'll get this to you ASAP.
I'm not sure if you were sarcastic about that (I mean you said "ASAP", yet it's over a week and I see nothing), but I've released a new release, attempting to fix the issue described here.
If the test suite still has some errors/failures, please show at least the names of the failed tests and ideally also show the debuggging info that is outputted.
Anyway...
Thank you very much for what you have done already.
No, not sarcastic. Just forgetful. Apologies for that. Installed the new release. There's a lot of debug output, most errors are generated by a missing file in the test suite. I ran this as root or else it complains about lack of mkdir() permission...
#phpunit SAXON_JAVACLI_Tests tests/XML_XSLT2ProcessorTest.php
PHPUnit 3.2.15 by Sebastian Bergmann.
....FFE...FFF.....FFFFFF...........F..
Time: 10 seconds
There was 1 error:
1) testSimpleUriTransformation(testSAXON_JAVACLI)
mkdir(): File exists
/usr/share/pear/test/XML_XSLT2Processor/tests/XML_XSLT2ProcessorTest.php:99
--
There were 12 failures:
1) testSimpleTransformation(testSAXON_JAVACLI)
Command:
java -jar '/usr/local/saxon/saxon9.jar' -o:/usr/share/pear/test/XML_XSLT2Processor/tests/RESULT_TEMP4QmrGm -s:/usr/share/pear/test/XML_XSLT2Processor/tests/sources/well-formed.xml -xsl:/usr/share/pear/test/XML_XSLT2Processor/tests/stylesheets/simple.xsl
Libxml:
XML_XSLT2Processor:
Array
(
[0] => XML_XSLT2Processor_Error Object
(
[code] =>
[column] =>
[file] => /usr/share/pear/test/XML_XSLT2Processor/tests/
[level] => 1
[line] => 0
[message] =>
)
[1] => XML_XSLT2Processor_Error Object
(
[code] =>
[column] =>
[file] => /usr/share/pear/test/XML_XSLT2Processor/tests/
[level] => 1
[line] => 0
[message] =>
)
)
Raw error log:
<?xml version="1.0"?>
<errorLog><instance processor="SAXON" interface="JAVA-CLI">Picked up _JAVA_OPTIONS: -Xms20m -Xmx64m -XX:MinHeapFreeRatio=20 -XX:MaxHeapFreeRatio=40 -XX:NewSize=10m -XX:MaxNewSize=10m -XX:SurvivorRatio=6 -XX:TargetSurvivorRatio=80 -XX:+CMSClassUnloadingEnabled -XX:+CMSPermGenSweepingEnabled
Warning: at xsl:stylesheet on line 2 of file:/usr/share/pear/test/XML_XSLT2Processor/tests/stylesheets/simple.xsl:
Running an XSLT 1.0 stylesheet with an XSLT 2.0 processor
Error
java.io.FileNotFoundException:
/d:/svnrepos/XML_XSLT2Processor/branches/0.5.1/XML_XSLT2Processor-0.5.1/tests/sources/sample.dtd (No such file or directory)
Transformation failed: Run-time errors were reported
<tmpFile>/usr/share/pear/test/XML_XSLT2Processor/tests/RESULT_TEMP4QmrGm</tmpFile><tmpFile>/usr/share/pear/test/XML_XSLT2Processor/tests/ERROR_LOG_DtwTss</tmpFile></instance></errorLog>
Failed asserting that two strings are equal.
expected string <<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><title>Untitled Document</title></head><body>This is a simple well formed XML document.</body></html>>
difference <????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????>
got string <>
/usr/share/pear/test/XML_XSLT2Processor/tests/XML_XSLT2ProcessorTest.php:85
2) testSimpleDomTransformation(testSAXON_JAVACLI)
Command:
java -jar '/usr/local/saxon/saxon9.jar' -o:/usr/share/pear/test/XML_XSLT2Processor/tests/RESULT_TEMP2qoLfy -s:/usr/share/pear/test/XML_XSLT2Processor/tests/sources/well-formed.xml -xsl:/usr/share/pear/test/XML_XSLT2Processor/tests/stylesheets/simple.xsl
Libxml:
XML_XSLT2Processor:
Array
(
[0] => XML_XSLT2Processor_Error Object
(
[code] =>
[column] =>
[file] => /usr/share/pear/test/XML_XSLT2Processor/tests/
[level] => 1
[line] => 0
[message] =>
)
[1] => XML_XSLT2Processor_Error Object
(
[code] =>
[column] =>
[file] => /usr/share/pear/test/XML_XSLT2Processor/tests/
[level] => 1
[line] => 0
[message] =>
)
)
Raw error log:
<?xml version="1.0"?>
<errorLog><instance processor="SAXON" interface="JAVA-CLI">Picked up _JAVA_OPTIONS: -Xms20m -Xmx64m -XX:MinHeapFreeRatio=20 -XX:MaxHeapFreeRatio=40 -XX:NewSize=10m -XX:MaxNewSize=10m -XX:SurvivorRatio=6 -XX:TargetSurvivorRatio=80 -XX:+CMSClassUnloadingEnabled -XX:+CMSPermGenSweepingEnabled
Warning: at xsl:stylesheet on line 2 of file:/usr/share/pear/test/XML_XSLT2Processor/tests/stylesheets/simple.xsl:
Running an XSLT 1.0 stylesheet with an XSLT 2.0 processor
Error
java.io.FileNotFoundException:
/d:/svnrepos/XML_XSLT2Processor/branches/0.5.1/XML_XSLT2Processor-0.5.1/tests/sources/sample.dtd (No such file or directory)
Transformation failed: Run-time errors were reported
<tmpFile>/usr/share/pear/test/XML_XSLT2Processor/tests/RESULT_TEMP2qoLfy</tmpFile></instance></errorLog>
Failed asserting that two strings are equal.
expected string <DOMDocument>
difference <???????????>
got string <>
/usr/share/pear/test/XML_XSLT2Processor/tests/XML_XSLT2ProcessorTest.php:93
3) testDomModifiedStylesheet(testSAXON_JAVACLI)
Command:
java -jar '/usr/local/saxon/saxon9.jar' -o:/usr/share/pear/test/XML_XSLT2Processor/tests/RESULT_TEMPgGEpN0 -s:/usr/share/pear/test/XML_XSLT2Processor/tests/sources/well-formed.xml -xsl:/usr/share/pear/test/XML_XSLT2Processor/tests/stylesheets/XSL_TEMPZrgRET
Libxml:
XML_XSLT2Processor:
Array
(
[0] => XML_XSLT2Processor_Error Object
(
[code] =>
[column] =>
[file] => /usr/share/pear/test/XML_XSLT2Processor/tests/
[level] => 1
[line] => 0
[message] =>
)
[1] => XML_XSLT2Processor_Error Object
(
[code] =>
[column] =>
[file] => /usr/share/pear/test/XML_XSLT2Processor/tests/
[level] => 1
[line] => 0
[message] =>
)
)
Raw error log:
<?xml version="1.0"?>
<errorLog><instance processor="SAXON" interface="JAVA-CLI">Picked up _JAVA_OPTIONS: -Xms20m -Xmx64m -XX:MinHeapFreeRatio=20 -XX:MaxHeapFreeRatio=40 -XX:NewSize=10m -XX:MaxNewSize=10m -XX:SurvivorRatio=6 -XX:TargetSurvivorRatio=80 -XX:+CMSClassUnloadingEnabled -XX:+CMSPermGenSweepingEnabled
Warning: at xsl:stylesheet on line 2 of file:/usr/share/pear/test/XML_XSLT2Processor/tests/stylesheets/XSL_TEMPZrgRET:
Running an XSLT 1.0 stylesheet with an XSLT 2.0 processor
Error
java.io.FileNotFoundException:
/d:/svnrepos/XML_XSLT2Processor/branches/0.5.1/XML_XSLT2Processor-0.5.1/tests/sources/sample.dtd (No such file or directory)
Transformation failed: Run-time errors were reported
<tmpFile>/usr/share/pear/test/XML_XSLT2Processor/tests/stylesheets/XSL_TEMPZrgRET</tmpFile><tmpFile>/usr/share/pear/test/XML_XSLT2Processor/tests/RESULT_TEMPgGEpN0</tmpFile></instance></errorLog>
Failed asserting that two strings are equal.
expected string <<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><title>Untitled Document</title></head><body>changed\<br>used<br></body></html>>
difference <??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????>
got string <>
/usr/share/pear/test/XML_XSLT2Processor/tests/XML_XSLT2ProcessorTest.php:134
4) testDomSource(testSAXON_JAVACLI)
Command:
java -jar '/usr/local/saxon/saxon9.jar' -o:/usr/share/pear/test/XML_XSLT2Processor/tests/RESULT_TEMPmjeXMh -s:/usr/share/pear/test/XML_XSLT2Processor/tests/sources/XML_TEMPxwBLhq -xsl:/usr/share/pear/test/XML_XSLT2Processor/tests/stylesheets/XSL_TEMP5JJ9h9
Libxml:
XML_XSLT2Processor:
Array
(
[0] => XML_XSLT2Processor_Error Object
(
[code] =>
[column] =>
[file] => /usr/share/pear/test/XML_XSLT2Processor/tests/
[level] => 1
[line] => 0
[message] =>
)
[1] => XML_XSLT2Processor_Error Object
(
[code] =>
[column] =>
[file] => /usr/share/pear/test/XML_XSLT2Processor/tests/
[level] => 1
[line] => 0
[message] =>
)
)
Raw error log:
<?xml version="1.0"?>
<errorLog><instance processor="SAXON" interface="JAVA-CLI">Picked up _JAVA_OPTIONS: -Xms20m -Xmx64m -XX:MinHeapFreeRatio=20 -XX:MaxHeapFreeRatio=40 -XX:NewSize=10m -XX:MaxNewSize=10m -XX:SurvivorRatio=6 -XX:TargetSurvivorRatio=80 -XX:+CMSClassUnloadingEnabled -XX:+CMSPermGenSweepingEnabled
Warning: at xsl:stylesheet on line 2 of file:/usr/share/pear/test/XML_XSLT2Processor/tests/stylesheets/XSL_TEMP5JJ9h9:
Running an XSLT 1.0 stylesheet with an XSLT 2.0 processor
Error
java.io.FileNotFoundException:
/d:/svnrepos/XML_XSLT2Processor/branches/0.5.1/XML_XSLT2Processor-0.5.1/tests/sources/sample.dtd (No such file or directory)
Transformation failed: Run-time errors were reported
<tmpFile>/usr/share/pear/test/XML_XSLT2Processor/tests/stylesheets/XSL_TEMP5JJ9h9</tmpFile><tmpFile>/usr/share/pear/test/XML_XSLT2Processor/tests/RESULT_TEMPmjeXMh</tmpFile><tmpFile>/usr/share/pear/test/XML_XSLT2Processor/tests/sources/XML_TEMPxwBLhq</tmpFile></instance></errorLog>
Failed asserting that two strings are equal.
expected string <<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><title>Untitled Document</title></head><body>This is a simple well formed XML document.</body></html>>
difference <????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????>
got string <>
/usr/share/pear/test/XML_XSLT2Processor/tests/XML_XSLT2ProcessorTest.php:163
5) testDomModifiedSource(testSAXON_JAVACLI)
Command:
java -jar '/usr/local/saxon/saxon9.jar' -o:/usr/share/pear/test/XML_XSLT2Processor/tests/RESULT_TEMPHRnJZJ -s:/usr/share/pear/test/XML_XSLT2Processor/tests/sources/XML_TEMP8AXJQT -xsl:/usr/share/pear/test/XML_XSLT2Processor/tests/stylesheets/XSL_TEMPistJ8z
Libxml:
XML_XSLT2Processor:
Array
(
[0] => XML_XSLT2Processor_Error Object
(
[code] =>
[column] =>
[file] => /usr/share/pear/test/XML_XSLT2Processor/tests/
[level] => 1
[line] => 0
[message] =>
)
[1] => XML_XSLT2Processor_Error Object
(
[code] =>
[column] =>
[file] => /usr/share/pear/test/XML_XSLT2Processor/tests/
[level] => 1
[line] => 0
[message] =>
)
)
Raw error log:
<?xml version="1.0"?>
<errorLog><instance processor="SAXON" interface="JAVA-CLI">Picked up _JAVA_OPTIONS: -Xms20m -Xmx64m -XX:MinHeapFreeRatio=20 -XX:MaxHeapFreeRatio=40 -XX:NewSize=10m -XX:MaxNewSize=10m -XX:SurvivorRatio=6 -XX:TargetSurvivorRatio=80 -XX:+CMSClassUnloadingEnabled -XX:+CMSPermGenSweepingEnabled
Warning: at xsl:stylesheet on line 2 of file:/usr/share/pear/test/XML_XSLT2Processor/tests/stylesheets/XSL_TEMPistJ8z:
Running an XSLT 1.0 stylesheet with an XSLT 2.0 processor
Error
java.io.FileNotFoundException:
/d:/svnrepos/XML_XSLT2Processor/branches/0.5.1/XML_XSLT2Processor-0.5.1/tests/sources/sample.dtd (No such file or directory)
Transformation failed: Run-time errors were reported
<tmpFile>/usr/share/pear/test/XML_XSLT2Processor/tests/stylesheets/XSL_TEMPistJ8z</tmpFile><tmpFile>/usr/share/pear/test/XML_XSLT2Processor/tests/RESULT_TEMPHRnJZJ</tmpFile><tmpFile>/usr/share/pear/test/XML_XSLT2Processor/tests/sources/XML_TEMP8AXJQT</tmpFile></instance></errorLog>
Failed asserting that two strings are equal.
expected string <<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><title>Untitled Document</title></head><body>Altered</body></html>>
difference <?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????>
got string <>
/usr/share/pear/test/XML_XSLT2Processor/tests/XML_XSLT2ProcessorTest.php:174
6) testSetParameterModeSTRING(testSAXON_JAVACLI)
Command:
java -jar '/usr/local/saxon/saxon9.jar' -o:/usr/share/pear/test/XML_XSLT2Processor/tests/RESULT_TEMPNtAahP -s:/usr/share/pear/test/XML_XSLT2Processor/tests/sources/well-formed.xml -xsl:/usr/share/pear/test/XML_XSLT2Processor/tests/stylesheets/param.xsl "{}test=\"changed\\" "{}path=us\"ed\""
Libxml:
XML_XSLT2Processor:
Array
(
[0] => XML_XSLT2Processor_Error Object
(
[code] =>
[column] =>
[file] => /usr/share/pear/test/XML_XSLT2Processor/tests/
[level] => 1
[line] => 0
[message] =>
)
[1] => XML_XSLT2Processor_Error Object
(
[code] =>
[column] =>
[file] => /usr/share/pear/test/XML_XSLT2Processor/tests/
[level] => 1
[line] => 0
[message] =>
)
)
Raw error log:
<?xml version="1.0"?>
<errorLog><instance processor="SAXON" interface="JAVA-CLI">Picked up _JAVA_OPTIONS: -Xms20m -Xmx64m -XX:MinHeapFreeRatio=20 -XX:MaxHeapFreeRatio=40 -XX:NewSize=10m -XX:MaxNewSize=10m -XX:SurvivorRatio=6 -XX:TargetSurvivorRatio=80 -XX:+CMSClassUnloadingEnabled -XX:+CMSPermGenSweepingEnabled
Warning: at xsl:stylesheet on line 2 of file:/usr/share/pear/test/XML_XSLT2Processor/tests/stylesheets/param.xsl:
Running an XSLT 1.0 stylesheet with an XSLT 2.0 processor
Error
java.io.FileNotFoundException:
/d:/svnrepos/XML_XSLT2Processor/branches/0.5.1/XML_XSLT2Processor-0.5.1/tests/sources/sample.dtd (No such file or directory)
Transformation failed: Run-time errors were reported
<tmpFile>/usr/share/pear/test/XML_XSLT2Processor/tests/RESULT_TEMPNtAahP</tmpFile></instance></errorLog>
Failed asserting that two strings are equal.
expected string <<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><title>Untitled Document</title></head><body>"changed\<br>us"ed"<br></body></html>>
difference <?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????>
got string <>
/usr/share/pear/test/XML_XSLT2Processor/tests/XML_XSLT2ProcessorTest.php:224
7) testSetParameterModeSAFE_STRING(testSAXON_JAVACLI)
Command:
java -jar '/usr/local/saxon/saxon9.jar' -o:/usr/share/pear/test/XML_XSLT2Processor/tests/RESULT_TEMPix6Pg3 -s:/usr/share/pear/test/XML_XSLT2Processor/tests/sources/well-formed.xml -xsl:/usr/share/pear/test/XML_XSLT2Processor/tests/stylesheets/param.xsl "+test=/usr/share/pear/test/XML_XSLT2Processor/tests/PARAM_TEMP_testNJFxgh" "+path=/usr/share/pear/test/XML_XSLT2Processor/tests/PARAM_TEMP_path6zMggv"
Libxml:
XML_XSLT2Processor:
Array
(
[0] => XML_XSLT2Processor_Error Object
(
[code] =>
[column] =>
[file] => /usr/share/pear/test/XML_XSLT2Processor/tests/
[level] => 1
[line] => 0
[message] =>
)
[1] => XML_XSLT2Processor_Error Object
(
[code] =>
[column] =>
[file] => /usr/share/pear/test/XML_XSLT2Processor/tests/
[level] => 1
[line] => 0
[message] =>
)
)
Raw error log:
<?xml version="1.0"?>
<errorLog><instance processor="SAXON" interface="JAVA-CLI">Picked up _JAVA_OPTIONS: -Xms20m -Xmx64m -XX:MinHeapFreeRatio=20 -XX:MaxHeapFreeRatio=40 -XX:NewSize=10m -XX:MaxNewSize=10m -XX:SurvivorRatio=6 -XX:TargetSurvivorRatio=80 -XX:+CMSClassUnloadingEnabled -XX:+CMSPermGenSweepingEnabled
Warning: at xsl:stylesheet on line 2 of file:/usr/share/pear/test/XML_XSLT2Processor/tests/stylesheets/param.xsl:
Running an XSLT 1.0 stylesheet with an XSLT 2.0 processor
Error
java.io.FileNotFoundException:
/d:/svnrepos/XML_XSLT2Processor/branches/0.5.1/XML_XSLT2Processor-0.5.1/tests/sources/sample.dtd (No such file or directory)
Transformation failed: Run-time errors were reported
<tmpFile>/usr/share/pear/test/XML_XSLT2Processor/tests/RESULT_TEMPix6Pg3</tmpFile><tmpFile>/usr/share/pear/test/XML_XSLT2Processor/tests/PARAM_TEMP_testNJFxgh</tmpFile><tmpFile>/usr/share/pear/test/XML_XSLT2Processor/tests/PARAM_TEMP_path6zMggv</tmpFile></instance></errorLog>
Failed asserting that two strings are equal.
expected string <<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><title>Untitled Document</title></head><body>йе\<br>Ñ~Oко<br></body></html>>
difference <?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????>
got string <>
/usr/share/pear/test/XML_XSLT2Processor/tests/XML_XSLT2ProcessorTest.php:234
8) testSetParameterModeFILE(testSAXON_JAVACLI)
Command:
java -jar '/usr/local/saxon/saxon9.jar' -o:/usr/share/pear/test/XML_XSLT2Processor/tests/RESULT_TEMPdwLrAK -s:/usr/share/pear/test/XML_XSLT2Processor/tests/sources/well-formed.xml -xsl:/usr/share/pear/test/XML_XSLT2Processor/tests/stylesheets/param.xsl "+test=/usr/share/pear/test/XML_XSLT2Processor/tests/sources/well-formed.xml" "+path=/usr/share/pear/test/XML_XSLT2Processor/tests/sources/param.xml"
Libxml:
XML_XSLT2Processor:
Array
(
[0] => XML_XSLT2Processor_Error Object
(
[code] =>
[column] =>
[file] => /usr/share/pear/test/XML_XSLT2Processor/tests/
[level] => 1
[line] => 0
[message] =>
)
[1] => XML_XSLT2Processor_Error Object
(
[code] =>
[column] =>
[file] => /usr/share/pear/test/XML_XSLT2Processor/tests/
[level] => 1
[line] => 0
[message] =>
)
)
Raw error log:
<?xml version="1.0"?>
<errorLog><instance processor="SAXON" interface="JAVA-CLI">Picked up _JAVA_OPTIONS: -Xms20m -Xmx64m -XX:MinHeapFreeRatio=20 -XX:MaxHeapFreeRatio=40 -XX:NewSize=10m -XX:MaxNewSize=10m -XX:SurvivorRatio=6 -XX:TargetSurvivorRatio=80 -XX:+CMSClassUnloadingEnabled -XX:+CMSPermGenSweepingEnabled
Warning: at xsl:stylesheet on line 2 of file:/usr/share/pear/test/XML_XSLT2Processor/tests/stylesheets/param.xsl:
Running an XSLT 1.0 stylesheet with an XSLT 2.0 processor
Error
java.io.FileNotFoundException:
/d:/svnrepos/XML_XSLT2Processor/branches/0.5.1/XML_XSLT2Processor-0.5.1/tests/sources/sample.dtd (No such file or directory)
Transformation failed: Run-time errors were reported
<tmpFile>/usr/share/pear/test/XML_XSLT2Processor/tests/RESULT_TEMPdwLrAK</tmpFile></instance></errorLog>
Failed asserting that two strings are equal.
expected string <<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><title>Untitled Document</title></head><body>This is a simple well formed XML document.<br>parameter<br></body></html>>
difference <?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????>
got string <>
/usr/share/pear/test/XML_XSLT2Processor/tests/XML_XSLT2ProcessorTest.php:244
9) testSetParameterModeUNKNOWN(testSAXON_JAVACLI)
Command:
java -jar '/usr/local/saxon/saxon9.jar' -o:/usr/share/pear/test/XML_XSLT2Processor/tests/RESULT_TEMPoB8Rg1 -s:/usr/share/pear/test/XML_XSLT2Processor/tests/sources/well-formed.xml -xsl:/usr/share/pear/test/XML_XSLT2Processor/tests/stylesheets/param.xsl
Libxml:
XML_XSLT2Processor:
Array
(
[0] => XML_XSLT2Processor_Error Object
(
[code] =>
[column] =>
[file] => /usr/share/pear/test/XML_XSLT2Processor/tests/
[level] => 1
[line] => 0
[message] =>
)
[1] => XML_XSLT2Processor_Error Object
(
[code] =>
[column] =>
[file] => /usr/share/pear/test/XML_XSLT2Processor/tests/
[level] => 1
[line] => 0
[message] =>
)
)
Raw error log:
<?xml version="1.0"?>
<errorLog><instance processor="SAXON" interface="JAVA-CLI">Picked up _JAVA_OPTIONS: -Xms20m -Xmx64m -XX:MinHeapFreeRatio=20 -XX:MaxHeapFreeRatio=40 -XX:NewSize=10m -XX:MaxNewSize=10m -XX:SurvivorRatio=6 -XX:TargetSurvivorRatio=80 -XX:+CMSClassUnloadingEnabled -XX:+CMSPermGenSweepingEnabled
Warning: at xsl:stylesheet on line 2 of file:/usr/share/pear/test/XML_XSLT2Processor/tests/stylesheets/param.xsl:
Running an XSLT 1.0 stylesheet with an XSLT 2.0 processor
Error
java.io.FileNotFoundException:
/d:/svnrepos/XML_XSLT2Processor/branches/0.5.1/XML_XSLT2Processor-0.5.1/tests/sources/sample.dtd (No such file or directory)
Transformation failed: Run-time errors were reported
<tmpFile>/usr/share/pear/test/XML_XSLT2Processor/tests/RESULT_TEMPoB8Rg1</tmpFile></instance></errorLog>
Failed asserting that two strings are equal.
expected string <<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><title>Untitled Document</title></head><body>default<br>unchanged<br></body></html>>
difference <??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????>
got string <>
/usr/share/pear/test/XML_XSLT2Processor/tests/XML_XSLT2ProcessorTest.php:264
10) testAutoStylesheetByPI(testSAXON_JAVACLI)
Command:
java -jar '/usr/local/saxon/saxon9.jar' -o:/usr/share/pear/test/XML_XSLT2Processor/tests/RESULT_TEMPpGiiij -a -s:/usr/share/pear/test/XML_XSLT2Processor/tests/sources/well-formed.xml
Libxml:
XML_XSLT2Processor:
Raw error log:
<?xml version="1.0"?>
<errorLog><instance processor="SAXON" interface="JAVA-CLI">Picked up _JAVA_OPTIONS: -Xms20m -Xmx64m -XX:MinHeapFreeRatio=20 -XX:MaxHeapFreeRatio=40 -XX:NewSize=10m -XX:MaxNewSize=10m -XX:SurvivorRatio=6 -XX:TargetSurvivorRatio=80 -XX:+CMSClassUnloadingEnabled -XX:+CMSPermGenSweepingEnabled
Failed while looking for xml-stylesheet PI
<tmpFile>/usr/share/pear/test/XML_XSLT2Processor/tests/RESULT_TEMPpGiiij</tmpFile></instance></errorLog>
Failed asserting that two strings are equal.
expected string <<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><title>Untitled Document</title></head><body>This is a simple well formed XML document.</body></html>>
difference <????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????>
got string <>
/usr/share/pear/test/XML_XSLT2Processor/tests/XML_XSLT2ProcessorTest.php:285
11) testDomAutoStylesheetByPI(testSAXON_JAVACLI)
Command:
java -jar '/usr/local/saxon/saxon9.jar' -o:/usr/share/pear/test/XML_XSLT2Processor/tests/RESULT_TEMPgmDW4B -a -s:/usr/share/pear/test/XML_XSLT2Processor/tests/sources/XML_TEMPv8MBRU
Libxml:
XML_XSLT2Processor:
Raw error log:
<?xml version="1.0"?>
<errorLog><instance processor="SAXON" interface="JAVA-CLI">Picked up _JAVA_OPTIONS: -Xms20m -Xmx64m -XX:MinHeapFreeRatio=20 -XX:MaxHeapFreeRatio=40 -XX:NewSize=10m -XX:MaxNewSize=10m -XX:SurvivorRatio=6 -XX:TargetSurvivorRatio=80 -XX:+CMSClassUnloadingEnabled -XX:+CMSPermGenSweepingEnabled
Failed while looking for xml-stylesheet PI
<tmpFile>/usr/share/pear/test/XML_XSLT2Processor/tests/RESULT_TEMPgmDW4B</tmpFile><tmpFile>/usr/share/pear/test/XML_XSLT2Processor/tests/sources/XML_TEMPv8MBRU</tmpFile></instance></errorLog>
Failed asserting that two strings are equal.
expected string <<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><title>Untitled Document</title></head><body>This is a simple well formed XML document.</body></html>>
difference <????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????>
got string <>
/usr/share/pear/test/XML_XSLT2Processor/tests/XML_XSLT2ProcessorTest.php:293
12) testSetOptionPropertyToUnknown(testSAXON_JAVACLI)
Command:
java -jar '/usr/local/saxon/saxon9.jar' -o:/usr/share/pear/test/XML_XSLT2Processor/tests/RESULT_TEMPVra7Gd -s:/usr/share/pear/test/XML_XSLT2Processor/tests/sources/well-formed.xml -xsl:/usr/share/pear/test/XML_XSLT2Processor/tests/stylesheets/simple.xsl
Libxml:
XML_XSLT2Processor:
Array
(
[0] => XML_XSLT2Processor_Error Object
(
[code] =>
[column] =>
[file] => /usr/share/pear/test/XML_XSLT2Processor/tests/
[level] => 1
[line] => 0
[message] =>
)
[1] => XML_XSLT2Processor_Error Object
(
[code] =>
[column] =>
[file] => /usr/share/pear/test/XML_XSLT2Processor/tests/
[level] => 1
[line] => 0
[message] =>
)
)
Raw error log:
<?xml version="1.0"?>
<errorLog><instance processor="SAXON" interface="JAVA-CLI">Picked up _JAVA_OPTIONS: -Xms20m -Xmx64m -XX:MinHeapFreeRatio=20 -XX:MaxHeapFreeRatio=40 -XX:NewSize=10m -XX:MaxNewSize=10m -XX:SurvivorRatio=6 -XX:TargetSurvivorRatio=80 -XX:+CMSClassUnloadingEnabled -XX:+CMSPermGenSweepingEnabled
Warning: at xsl:stylesheet on line 2 of file:/usr/share/pear/test/XML_XSLT2Processor/tests/stylesheets/simple.xsl:
Running an XSLT 1.0 stylesheet with an XSLT 2.0 processor
Error
java.io.FileNotFoundException:
/d:/svnrepos/XML_XSLT2Processor/branches/0.5.1/XML_XSLT2Processor-0.5.1/tests/sources/sample.dtd (No such file or directory)
Transformation failed: Run-time errors were reported
<tmpFile>/usr/share/pear/test/XML_XSLT2Processor/tests/RESULT_TEMPVra7Gd</tmpFile></instance></errorLog>
Failed asserting that two strings are equal.
expected string <<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><title>Untitled Document</title></head><body>This is a simple well formed XML document.</body></html>>
difference <????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????>
got string <>
/usr/share/pear/test/XML_XSLT2Processor/tests/XML_XSLT2ProcessorTest.php:455
FAILURES!
Tests: 38, Failures: 12, Errors: 1.
OMFG! I'm so stupid!!!
The well-formed.xml test file has an absolute path to the DTD. It should have been relative.
Go to the well-formed.xml file (in "PEAR/tests/XML_XSLT2Processor/tests/sources/") and change
"file:///d:/svnrepos/XML_XSLT2Processor/branches/0.5.1/XML_XSLT2Processor-0.5.1/tests/sources/sample.dtd"
to just
"sample.dtd"
In the mean time, I'll change it, along with something else I've noticed, and will release a new release (I think I'll call it 0.5.1a).
God... how embarrassing.
OK. I've released it. To install it, you'll have to first uninstall your current version, as the PEAR installer doesn't seem to find 0.5.1a greather than 0.5.1.
Also, ensure the folder "results" doesn't already exist in the "/usr/share/pear/test/XML_XSLT2Processor/tests/" folder before starting the tests. That's where the error at the beginning comes from.
...how daft of me. I just realized that sample.dtd is missing from the pear installable's package.xml. Otherwise:
# phpunit SAXON_JAVACLI_Tests XML_XSLT2ProcessorTest.php
PHPUnit 3.2.15 by Sebastian Bergmann.
......................................
Time: 11 seconds
OK (38 tests)
Hm. I didn't noticed that part either. Oh well... I've *replaced* the 0.5.1a release with one that does include sample.dtd in the installation.
(I've had enough new releases for one day :-D)
On second though, I replaced the 0.5.1 release, and removed the 0.5.1a (and I verified it would isntall). You were the only one to see all of those goofs anyway ^_^ .
(well... you, and anyone reading this topic anyway)
That works ;]
Great! Thanks again.
One last thing. Could you try how "All_Tests" works out? All non SAXON_JAVACLI tests should be marked skipped, but since we're talking Linux here, I'm not sure how will PHP react when COM is not available. It shouldn't emit any errors, but I'd like to know if it does.
Here's the output:
# phpunit All_Tests XML_XSLT2ProcessorTest.phpPHPUnit 3.2.15 by Sebastian Bergmann.
....SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS....................... 60 / 181
..........SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSPHP Fatal error: Class 'COM' not found in /usr/share/pear/XML/XSLT2Processor.php on line 238
Fatal error: Class 'COM' not found in /usr/share/pear/XML/XSLT2Processor.php on line 238
I suspected that much.
OK. Will remove that fatal error in the next release :-)