Skip to content

Commit 4114b42

Browse files
committed
Perform some maintenance work in XSL
1 parent 534c343 commit 4114b42

File tree

5 files changed

+192
-135
lines changed

5 files changed

+192
-135
lines changed

ext/xsl/php_xsl.stub.php

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
<?php
2+
3+
class XSLTProcessor
4+
{
5+
/** @return bool */
6+
public function importStylesheet(object $stylesheet) {}
7+
8+
/** @return DOMDocument|false */
9+
public function transformToDoc(DOMNode $document, ?string $return_class = null) {}
10+
11+
/**
12+
* @param DOMDocument|SimpleXMLElement $document
13+
* @return int
14+
*/
15+
public function transformToUri($document, string $uri) {}
16+
17+
/**
18+
* @param DOMDocument|SimpleXMLElement $document
19+
* @return string|false|null
20+
*/
21+
public function transformToXml(object $document) {}
22+
23+
/**
24+
* @param string|array $name
25+
* @return bool|null
26+
*/
27+
public function setParameter(string $namespace, $name, string $value = UNKNOWN) {}
28+
29+
/** @return string|false */
30+
public function getParameter(string $namespace, string $name) {}
31+
32+
/** @return bool */
33+
public function removeParameter(string $namespace, string $name) {}
34+
35+
/** @return bool */
36+
public function hasExsltSupport() {}
37+
38+
/**
39+
* @param string|array $restrict
40+
* @return void
41+
*/
42+
public function registerPHPFunctions($restrict = UNKNOWN) {}
43+
44+
/** @return bool */
45+
public function setProfiling(?string $filename) {}
46+
47+
/** @return int */
48+
public function setSecurityPrefs(int $securityPrefs) {}
49+
50+
/** @return int */
51+
public function getSecurityPrefs() {}
52+
}

ext/xsl/php_xsl_arginfo.h

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
/* This is a generated file, edit the .stub.php file instead. */
2+
3+
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_XSLTProcessor_importStylesheet, 0, 0, 1)
4+
ZEND_ARG_TYPE_INFO(0, stylesheet, IS_OBJECT, 0)
5+
ZEND_END_ARG_INFO()
6+
7+
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_XSLTProcessor_transformToDoc, 0, 0, 1)
8+
ZEND_ARG_OBJ_INFO(0, document, DOMNode, 0)
9+
ZEND_ARG_TYPE_INFO(0, return_class, IS_STRING, 1)
10+
ZEND_END_ARG_INFO()
11+
12+
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_XSLTProcessor_transformToUri, 0, 0, 2)
13+
ZEND_ARG_INFO(0, document)
14+
ZEND_ARG_TYPE_INFO(0, uri, IS_STRING, 0)
15+
ZEND_END_ARG_INFO()
16+
17+
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_XSLTProcessor_transformToXml, 0, 0, 1)
18+
ZEND_ARG_TYPE_INFO(0, document, IS_OBJECT, 0)
19+
ZEND_END_ARG_INFO()
20+
21+
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_XSLTProcessor_setParameter, 0, 0, 2)
22+
ZEND_ARG_TYPE_INFO(0, namespace, IS_STRING, 0)
23+
ZEND_ARG_INFO(0, name)
24+
ZEND_ARG_TYPE_INFO(0, value, IS_STRING, 0)
25+
ZEND_END_ARG_INFO()
26+
27+
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_XSLTProcessor_getParameter, 0, 0, 2)
28+
ZEND_ARG_TYPE_INFO(0, namespace, IS_STRING, 0)
29+
ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0)
30+
ZEND_END_ARG_INFO()
31+
32+
#define arginfo_class_XSLTProcessor_removeParameter arginfo_class_XSLTProcessor_getParameter
33+
34+
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_XSLTProcessor_hasExsltSupport, 0, 0, 0)
35+
ZEND_END_ARG_INFO()
36+
37+
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_XSLTProcessor_registerPHPFunctions, 0, 0, 0)
38+
ZEND_ARG_INFO(0, restrict)
39+
ZEND_END_ARG_INFO()
40+
41+
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_XSLTProcessor_setProfiling, 0, 0, 1)
42+
ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 1)
43+
ZEND_END_ARG_INFO()
44+
45+
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_XSLTProcessor_setSecurityPrefs, 0, 0, 1)
46+
ZEND_ARG_TYPE_INFO(0, securityPrefs, IS_LONG, 0)
47+
ZEND_END_ARG_INFO()
48+
49+
#define arginfo_class_XSLTProcessor_getSecurityPrefs arginfo_class_XSLTProcessor_hasExsltSupport

ext/xsl/tests/xsltprocessor_hasExsltSupport_wrongparam_001.phpt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,11 @@ Rodrigo Prado de Jesus <royopa [at] gmail [dot] com>
77
--FILE--
88
<?php
99
$proc = new XSLTProcessor();
10-
var_dump($proc->hasExsltSupport('stringValue'));
10+
try {
11+
$proc->hasExsltSupport('stringValue');
12+
} catch (ArgumentCountError $exception) {
13+
echo $exception->getMessage() . "\n";
14+
}
1115
?>
1216
--EXPECT--
13-
bool(true)
17+
XSLTProcessor::hasExsltSupport() expects exactly 0 parameters, 1 given

ext/xsl/xsl_fe.h

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,17 @@
2020
extern const zend_function_entry php_xsl_xsltprocessor_class_functions[];
2121
extern zend_class_entry *xsl_xsltprocessor_class_entry;
2222

23-
PHP_FUNCTION(xsl_xsltprocessor_import_stylesheet);
24-
PHP_FUNCTION(xsl_xsltprocessor_transform_to_doc);
25-
PHP_FUNCTION(xsl_xsltprocessor_transform_to_uri);
26-
PHP_FUNCTION(xsl_xsltprocessor_transform_to_xml);
27-
PHP_FUNCTION(xsl_xsltprocessor_set_parameter);
28-
PHP_FUNCTION(xsl_xsltprocessor_get_parameter);
29-
PHP_FUNCTION(xsl_xsltprocessor_remove_parameter);
30-
PHP_FUNCTION(xsl_xsltprocessor_has_exslt_support);
31-
PHP_FUNCTION(xsl_xsltprocessor_register_php_functions);
32-
PHP_FUNCTION(xsl_xsltprocessor_set_profiling);
33-
PHP_FUNCTION(xsl_xsltprocessor_set_security_prefs);
34-
PHP_FUNCTION(xsl_xsltprocessor_get_security_prefs);
23+
PHP_METHOD(XSLTProcessor, importStylesheet);
24+
PHP_METHOD(XSLTProcessor, transformToDoc);
25+
PHP_METHOD(XSLTProcessor, transformToUri);
26+
PHP_METHOD(XSLTProcessor, transformToXml);
27+
PHP_METHOD(XSLTProcessor, setParameter);
28+
PHP_METHOD(XSLTProcessor, getParameter);
29+
PHP_METHOD(XSLTProcessor, removeParameter);
30+
PHP_METHOD(XSLTProcessor, hasExsltSupport);
31+
PHP_METHOD(XSLTProcessor, registerPHPFunctions);
32+
PHP_METHOD(XSLTProcessor, setProfiling);
33+
PHP_METHOD(XSLTProcessor, setSecurityPrefs);
34+
PHP_METHOD(XSLTProcessor, getSecurityPrefs);
3535

3636
#endif

0 commit comments

Comments
 (0)