Skip to content

Add missing properties to xsl stub #12334

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Oct 6, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Address review feedback
  • Loading branch information
nielsdos committed Sep 30, 2023
commit 27198c2cf2a0d7db373868e76b1d823dafa00221
2 changes: 2 additions & 0 deletions UPGRADING
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ PHP 8.4 UPGRADE NOTES
. XSLTProcessor::setParameter() will now throw a ValueError when its arguments
contain null bytes. This never actually worked correctly in the first place,
which is why it throws an exception nowadays.
. The typed properties XSLTProcessor::$cloneDocument and
XSLTProcessor::$doXInclude are now declared.

========================================
2. New Features
Expand Down
6 changes: 2 additions & 4 deletions ext/xsl/php_xsl.stub.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,9 @@

class XSLTProcessor
{
/** @var bool */
public $doXInclude;
public bool $doXInclude = false;

/** @var bool */
public $cloneDocument;
public bool $cloneDocument = false;

/**
* @param DOMDocument|SimpleXMLElement $stylesheet
Expand Down
10 changes: 5 additions & 5 deletions ext/xsl/php_xsl_arginfo.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 4 additions & 10 deletions ext/xsl/xsltprocessor.c
Original file line number Diff line number Diff line change
Expand Up @@ -313,11 +313,8 @@ PHP_METHOD(XSLTProcessor, importStylesheet)
intern = Z_XSL_P(id);

member = ZSTR_INIT_LITERAL("cloneDocument", 0);
cloneDocu = zend_std_read_property(Z_OBJ_P(id), member, BP_VAR_IS, NULL, &rv);
if (Z_TYPE_P(cloneDocu) != IS_NULL) {
convert_to_long(cloneDocu);
clone_docu = Z_LVAL_P(cloneDocu);
}
cloneDocu = zend_std_read_property(Z_OBJ_P(id), member, BP_VAR_R, NULL, &rv);
clone_docu = zend_is_true(cloneDocu);
zend_string_release_ex(member, 0);
if (clone_docu == 0) {
/* check if the stylesheet is using xsl:key, if yes, we have to clone the document _always_ before a transformation */
Expand Down Expand Up @@ -415,11 +412,8 @@ static xmlDocPtr php_xsl_apply_stylesheet(zval *id, xsl_object *intern, xsltStyl
}

member = ZSTR_INIT_LITERAL("doXInclude", 0);
doXInclude = zend_std_read_property(Z_OBJ_P(id), member, BP_VAR_IS, NULL, &rv);
if (Z_TYPE_P(doXInclude) != IS_NULL) {
convert_to_long(doXInclude);
ctxt->xinclude = Z_LVAL_P(doXInclude);
}
doXInclude = zend_std_read_property(Z_OBJ_P(id), member, BP_VAR_R, NULL, &rv);
ctxt->xinclude = zend_is_true(doXInclude);
zend_string_release_ex(member, 0);

secPrefsValue = intern->securityPrefs;
Expand Down