Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 0.2.2

Bug #1026 XSLT_ext raises error in constructor when testing for extension
Submitted: 2004-03-16 21:39 UTC
From: Aaron dot Hawley at uvm dot edu Assigned:
Status: Suspended Package: XML_XSLT_Wrapper
PHP Version: 4.3.4 OS: Solaris
Roadmaps: (Not assigned)    
Subscription  


 [2004-03-16 21:39 UTC] Aaron dot Hawley at uvm dot edu
Description: ------------ When the extension 'xslt' is not loaded into PHP, and the XSLT_ext constructor tries to raise an error in the constructor for this situation, the error is not returned (because it is a constructor). This is illegal behavior <http://bugs.php.net/bug.php?id=21380>. By the way error messages with periods is usually frowned upon. I have a patch with this fix, bug 907, and other typos and documenation bugs. Available upon request. Reproduce code: --------------- require_once 'XML/XSLT/Wrapper/XSLT_Wrapper.php'; $xslt =& XML_XSLT_Wrapper::factory(XML_XSLT_XSLT_EXT); if (!$xslt->process()) { print $xslt->error->getMessage(); } Expected result: ---------------- The xslt extension can not be found Actual result: -------------- Fatal error: Call to undefined function: xslt_create() in ./XML/XSLT/Wrapper/Backend/XSLT_ext.php on line 115

Comments

 [2004-03-16 22:20 UTC] pajoye
In php4 you have to check if the object returned by the factory is an error or not. A factory is allowed to return an error. That said, it is still silly to return it from a constructor. Can you post a link to your patch here? thanks for your report, pierre
 [2004-03-22 22:08 UTC] Aaron dot Hawley at uvm dot edu
Well, errors are thrown from constructors in a lot (all?) of the XSLT engine backends. So there needs to be some reworking done throughout this package. Factories are indeed able to pass errors (they're static member functions) but no errors can be collected from a backend's constructor. What's the point of a factory that just simply checks if a backend was include-ed or not. See pear/DB for better use of a factory (DB::connect()). Regardless, I've fixed the error raised in the XML_ext backend. The patch is linked below. I didn't test this patch thoroughly (I'm having sablotron-PHP problems), but the "code path" that it's fixing is tested here: http://www.uvm.edu/~ashawley/webteam/aes/staff.php Patch against CVS: http://www.uvm.edu/~ashawley/php/XML_XSL_Wrapper-exeception-comment-typo.diff-u
 [2004-03-22 22:27 UTC] aaron dot hawley at uvm dot edu
 [2004-06-13 14:03 UTC] pierre at dotgeek dot org
Assigned to Arnaud, he got the hand of this package now.
 [2006-02-21 15:39 UTC] pajoye
test new comment
 [2006-03-20 21:35 UTC] arnaud (Arnaud Limbourg)
Until somebody takes over.