Req #38595 [Com]: XSLTProcessor::registerPHPFunctions() should be able to register callbacks

From: Date: Tue, 25 Apr 2023 08:04:24 +0000
Subject: Req #38595 [Com]: XSLTProcessor::registerPHPFunctions() should be able to register callbacks
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-244265@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=38595&edit=1 ID: 38595 Comment by: officelpsts at gmail dot com Reported by: goliath dot mailinglist at gmx dot de Summary: XSLTProcessor::registerPHPFunctions() should be able to register callbacks Status: Open Type: Feature/Change Request Package: XSLT related Operating System: Linux PHP Version: 5.1.5 Block user comment: N Private report: N New Comment: Lifestyle Fashion News are sharing latest news about lifestyle, fashion,etc. More info to visit: (https://lifestylefashionnews.com)github.com Previous Comments: ------------------------------------------------------------------------ [2008-12-24 03:35:58] php at xmlnode dot com I'm not sure how important this really is. I too was disappointed at the lack of flexibility with registerPHPFunctions, but it was hard to be too upset about it because for us, the decision to use XSL as a template is an acknowledgment of standards and registerPHPFunctions is not standard... What we've done, if the value can't be passed as a parameter using XSLTProcessor::setParameter() is created a class with a bunch of static methods which are then called using something like this: php:function('XSL::<function name>',0) If objects need to be instantiated, that work is done inside of those respective methods -- not throughout the XSL. The approach here has the added benefit of being able to periodically scrutinize what others on the team are wanting access to within the XSL and make adjustments for security, performance, etc. YMMV ------------------------------------------------------------------------ [2006-08-25 17:09:21] goliath dot mailinglist at gmx dot de Description: ------------ XSLTProcessor::registerPHPFunctions() has very limited use. It is only possible to register static callable functions. Some nicer API would be: $xslt = new XSLTProcessor() $xslt->registerPHPFunctions(array( 'func1' => 'functionblah', 'func2' => array('class', 'method'), 'func3' => array($obj, 'method') // this would be the real advantage )); Or even better: $xslt->registerPHPFunction('func1', 'functionblah'); $xslt->registerPHPFunction('func2', array('class', 'method')); $xslt->registerPHPFunction('func3', array($obj, 'method')); $xslt->removePHPFunction('func1'); This would be similar to the set/get/removeParameter-API.... btw.: Your CAPCHA only works with cookies enabled, that really sucks. Reproduce code: --------------- None, not possible Expected result: ---------------- Be able to have instance-methods as callbacks for the XSLTProcessor. (Note: Not global accessibly objects) Actual result: -------------- Not possible ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=38595&edit=1

« previous php.bugs (#244265) next »