Ticket #169 (reopened defect)

Opened 7 months ago

Last modified 1 month ago

Spurious PHP Error from XSLT Filter

Reported by: padraic.brady@yahoo.com Assigned to: hans
Priority: minor Milestone: 2.3.1
Component: phing-core Version: 2.3.0
Keywords: xslt, filter, buildexception Cc:

Description

On generating HTML output from a tree of DocBook files using DocBook-XSL html/chunk.xsl I keep getting a long series of "PHP Errors" related to the BuildException being thrown from the XsltFilter class with message "XSLT Error" (see lines 208+).

Despite the continuous Exception throws, the html is correctly generated into chunked HTML documents. The main problem is the error causing the Build to register as a failure, when it's anything but. Not really certain why the $result variable is triggering this - all the output is working perfectly well :).

Note: The code this is running on is a simple DocBook skeleton setup available (open source; and we're just getting docs off the ground) from http://code.google.com/p/phpspec/source The relevant build file is in ./trunk/build, and the Phing target call is "docs". Running "docs" once produces the list of errors. A second run (if no "clean") runs without errors.

If you need any other details, let me know ;).

Attachments

Change History

10/31/07 22:48:18 changed by hans

  • status changed from new to assigned.

10/31/07 22:57:27 changed by hans

I can't reproduce this. Here's my verbatim output. I had a couple errors related to needing allow_url_fopen=On, but then it build & I ran phing clean and built again to make sure.

My environment is:

  • Gentoo
  • Phing 2.3.0RC2
  • PHP 5.2.4
hans@rubidium /opt/projects/phpspec/build $ phing clean
Buildfile: /opt/projects/phpspec/build/build.xml
      [php] Evaluating PHP expression: date('Y-m-d')
 [property] Loading /opt/projects/phpspec/build/build.properties

PHPSpec > clean:

   [delete] Deleting directory /opt/projects/phpspec/build/dist
   [delete] Deleting directory /opt/projects/phpspec/build/stage-manual

BUILD FINISHED

Total time: 0.2619 seconds

hans@rubidium /opt/projects/phpspec/build $ phing
Buildfile: /opt/projects/phpspec/build/build.xml
      [php] Evaluating PHP expression: date('Y-m-d')
 [property] Loading /opt/projects/phpspec/build/build.properties

PHPSpec > src.check:


PHPSpec > prepare.dist:

     [echo] Making Distribution Files directory /opt/projects/phpspec/build/dist
    [mkdir] Created dir: /opt/projects/phpspec/build/dist
    [mkdir] Created dir: /opt/projects/phpspec/build/dist/PEAR

PHPSpec > prepare:

     [echo] Making directory /opt/projects/phpspec/build/stage
    [mkdir] Created dir: /opt/projects/phpspec/build/stage
     [echo] Making directory /opt/projects/phpspec/build/stage/PHPSpec-0.2.0devel
    [mkdir] Created dir: /opt/projects/phpspec/build/stage/PHPSpec-0.2.0devel

PHPSpec > prepare.pear:

     [echo] Making directory /opt/projects/phpspec/build/stage-pear
    [mkdir] Created dir: /opt/projects/phpspec/build/stage-pear
     [echo] Making directory /opt/projects/phpspec/build/stage-pear/PHPSpec-0.2.0devel
    [mkdir] Created dir: /opt/projects/phpspec/build/stage-pear/PHPSpec-0.2.0devel

PHPSpec > svn.export:


PHPSpec > stage:

     [echo] Staging files from /opt/projects/phpspec/build/.. to /opt/projects/phpspec/build/stage/PHPSpec-0.2.0devel
     [copy] Copying 175 files to /opt/projects/phpspec/build/stage/PHPSpec-0.2.0devel
     [copy] Copied 11 empty directories to /opt/projects/phpspec/build/stage/PHPSpec-0.2.0devel

PHPSpec > stage.pear:

     [echo] Staging files from /opt/projects/phpspec/build/.. to /opt/projects/phpspec/build/stage-pear/PHPSpec-0.2.0devel for PEAR Packaging
     [copy] Copying 143 files to /opt/projects/phpspec/build/stage-pear/PHPSpec-0.2.0devel
     [copy] Copied 11 empty directories to /opt/projects/phpspec/build/stage-pear/PHPSpec-0.2.0devel
     [copy] Copying 32 files to /opt/projects/phpspec/build/stage-pear/PHPSpec-0.2.0devel

PHPSpec > build:


PHPSpec > build.pear:


PHPSpec > pearify:

[d51pearpkg2] Using explicit PHP minimum version: 5.2.0
[d51pearpkg2] setting minimum PEAR version: 1.6.0
[d51pearpkg2] adding maintainer [padraic/Pádraic Brady] with role [lead]
[d51pearpkg2] adding maintainer [tswicegood/Travis Swicegood] with role [lead]
[d51pearpkg2] adding dependencies
[d51pearpkg2] adding changelog for prior release [0.2.0devel]
[d51pearpkg2] no package notes specified, using changelog entry
[d51pearpkg2] adding replace from [@php_bin@] to [php_bin]
[d51pearpkg2] adding replace from [@php_bin@] to [php_bin]
[d51pearpkg2] adding replace from [@php_dir@] to [php_dir]
[d51pearpkg2] adding new release
[d51pearpkg2] installing [scripts/phpspec] as [phpspec]
[d51pearpkg2] installing [scripts/phpspec.bat] as [phpspec.bat]
[d51pearpkg2] Analyzing PHPSpec/Context.php
[d51pearpkg2] Analyzing PHPSpec/Exception.php
[d51pearpkg2] Analyzing PHPSpec/Expectation.php
[d51pearpkg2] Analyzing PHPSpec/Framework.php
[d51pearpkg2] Analyzing PHPSpec/Specification.php
[d51pearpkg2] Analyzing PHPSpec/Console/Command.php
[d51pearpkg2] Analyzing PHPSpec/Console/Getopt.php
[d51pearpkg2] Analyzing PHPSpec/Matcher/Be.php
[d51pearpkg2] Analyzing PHPSpec/Matcher/BeAnInstanceOf.php
[d51pearpkg2] Analyzing PHPSpec/Matcher/BeEmpty.php
[d51pearpkg2] Analyzing PHPSpec/Matcher/BeEqualTo.php
[d51pearpkg2] Analyzing PHPSpec/Matcher/BeFalse.php
[d51pearpkg2] Analyzing PHPSpec/Matcher/BeGreaterThan.php
[d51pearpkg2] Analyzing PHPSpec/Matcher/BeTrue.php
[d51pearpkg2] Analyzing PHPSpec/Matcher/Equal.php
[d51pearpkg2] Analyzing PHPSpec/Matcher/Exception.php
[d51pearpkg2] Analyzing PHPSpec/Matcher/Interface.php
[d51pearpkg2] Analyzing PHPSpec/Object/Interrogator.php
[d51pearpkg2] Analyzing PHPSpec/Runner/Base.php
[d51pearpkg2] Analyzing PHPSpec/Runner/Collection.php
[d51pearpkg2] Analyzing PHPSpec/Runner/ErrorException.php
[d51pearpkg2] Analyzing PHPSpec/Runner/Example.php
[d51pearpkg2] Analyzing PHPSpec/Runner/FailedMatcherException.php
[d51pearpkg2] Analyzing PHPSpec/Runner/Phpt.php
[d51pearpkg2] Analyzing PHPSpec/Runner/Reporter.php
[d51pearpkg2] Analyzing PHPSpec/Runner/Result.php
[d51pearpkg2] Analyzing PHPSpec/Runner/Filter/Standard.php
[d51pearpkg2] Analyzing PHPSpec/Runner/Loader/Classname.php
[d51pearpkg2] Analyzing PHPSpec/Runner/Loader/DirectoryRecursive.php
[d51pearpkg2] Analyzing PHPSpec/Runner/Reporter/Text.php
[d51pearpkg2] Analyzing PHPSpec/Specification/Object.php
[d51pearpkg2] Analyzing PHPSpec/Specification/Scalar.php

PHPSpec > dist:

     [echo] Creating tar and zip archives...
      [tar] Building tar: /opt/projects/phpspec/build/stage/PHPSpec-0.2.0devel.tar.gz
     [move] Moving 1 files to /opt/projects/phpspec/build/dist
     [echo] ZIP archive creation is disabled in build.xml file
     [echo] Creating PEAR Package...
     [exec] Executing command: pear package 2>&1
     [move] Moving 1 files to /opt/projects/phpspec/build/dist/PEAR

BUILD FINISHED

11/02/07 09:32:08 changed by hans

  • status changed from assigned to closed.
  • resolution set to worksforme.

I'm going to mark this "worksforme" and assume it is a platform-specific PHP issue -- or perhaps something that is fixed with a PHP upgrade (?)

Please re-open if there is in fact a Phing issue at the core of this.

11/05/07 21:41:35 changed by padraic.brady@yahoo.com

  • status changed from closed to reopened.
  • resolution deleted.

Okay, found some time to look into this again. I tested on a few systems - the problem seems to be specific to Windows (both XP and Vista reported them on two independent systems). Tested against PHP 5.2.4 installed using XAMPP For Windows (will later test a non-XAMPP distribution since I know it has one other weird extension problem with mysqli when using MS-DOS PHP CLI on Vista).

Same build file as before for PHPSpec with more docbook this time since I've started to write the PHPSpec manual - here's the relevant output:

PHPSpec > docs:

[echo] Rendering manual... [copy] Copying 1 file to F:\xampp\htdocs\projects\PHPSpec\build\dist\manual

[PHP Error] Illegal offset type [line 238 of F:\xampp\php\PEAR\phing\tasks\system\CopyTask.php]

[copy] Copying 1 file to F:\xampp\htdocs\projects\PHPSpec\build\dist\manual

[PHP Error] XSLTProcessor::transformToXml(): Computing chunks... [line 208 of F:\xampp\php\PEAR\phing\filters\ XsltFilter.php] [PHP Error] XSLTProcessor::transformToXml(): Writing F:\xampp\htdocs\projects\PHPSpec\build/dist/manual/instal ling.phpspec.html for chapter(installing.phpspec) [line 208 of F:\xampp\php\PEAR\phing\filters\XsltFilter.php]

[PHP Error] XSLTProcessor::transformToXml(): Writing F:\xampp\htdocs\projects\PHPSpec\build/dist/manual/gettin g.started.html for chapter(getting.started) [line 208 of F:\xampp\php\PEAR\phing\filters\XsltFilter.php] [PHP Error] XSLTProcessor::transformToXml(): Writing F:\xampp\htdocs\projects\PHPSpec\build/dist/manual/copyri ghts.html for appendix(copyrights) [line 208 of F:\xampp\php\PEAR\phing\filters\XsltFilter.php] [PHP Error] XSLTProcessor::transformToXml(): Writing F:\xampp\htdocs\projects\PHPSpec\build/dist/manual/the.in dex.html for index(the.index) [line 208 of F:\xampp\php\PEAR\phing\filters\XsltFilter.php] [PHP Error] XSLTProcessor::transformToXml(): Writing F:\xampp\htdocs\projects\PHPSpec\build/dist/manual/index. html for book(manual) [line 208 of F:\xampp\php\PEAR\phing\filters\XsltFilter.php] [PHP Error] XSLTProcessor::transformToXml(): Writing HTML.manifest [line 208 of F:\xampp\php\PEAR\phing\filter s\XsltFilter.php] Execution of target "docs" failed for the following reason: F:\xampp\htdocs\projects\PHPSpec\build\build.xml:2 59:14: XSLT Error

BUILD FAILED F:\xampp\htdocs\projects\PHPSpec\build\build.xml:259:14: XSLT Error Total time: 12.8477 seconds

As before all HTML is correctly output as expected, so XSLT transformation is successful despite the reported error. I validated all the docbook xml using xmllint separately just to be sure.

The error does not get reported on any Linux system I tried.

11/05/07 21:44:17 changed by padraic.brady@yahoo.com

I forgot to mention I've checked against the all new 2.3.0 release previously - I just grabbed this output on the previous RC (no difference from 2.3.0 final) so ignore the copy task errors which only occur with the RC.

Thanks!

11/06/07 08:05:11 changed by hans

  • version changed from 2.3.0RC1 to 2.3.0.
  • milestone changed from 2.3.0 to 2.3.1.

11/08/07 20:49:57 changed by hans

I wonder if this is just "normal" output for the XSLT transformation -- and for some reason it only shows up on the Windows version. (Maybe a log level?) It looks like those are just status messages and not actual errors. The solution here may be to better track the error level and not actually fail the task if we encounter E_NOTICE (or whatever those are) as that may be expected output ...

01/26/08 19:54:52 changed by mrook

It seems the error handler used in the XSL extension throws E_WARNING errors for default status messages. Adding a '@' in front of the $processor->transformToXML() statement seems to get rid of them, but would probably get rid of real errors too. Any thoughts?


Add/Change #169 (Spurious PHP Error from XSLT Filter)