Skip to content

Commit ad248cf

Browse files
committed
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3: tidy: Harden against tidyNodeGetText() failure
2 parents 50cc545 + 0584e59 commit ad248cf

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

ext/tidy/tidy.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -566,8 +566,7 @@ static zend_result tidy_node_cast_handler(zend_object *in, zval *out, int type)
566566
case IS_STRING:
567567
obj = php_tidy_fetch_object(in);
568568
tidyBufInit(&buf);
569-
if (obj->ptdoc) {
570-
tidyNodeGetText(obj->ptdoc->doc, obj->node, &buf);
569+
if (obj->ptdoc && tidyNodeGetText(obj->ptdoc->doc, obj->node, &buf)) {
571570
ZVAL_STRINGL(out, (const char *) buf.bp, buf.size-1);
572571
} else {
573572
ZVAL_EMPTY_STRING(out);
@@ -623,7 +622,7 @@ static void tidy_add_node_default_properties(PHPTidyObj *obj)
623622
const char *name;
624623

625624
tidyBufInit(&buf);
626-
tidyNodeGetText(obj->ptdoc->doc, obj->node, &buf);
625+
(void) tidyNodeGetText(obj->ptdoc->doc, obj->node, &buf);
627626

628627
zend_update_property_stringl(
629628
tidy_ce_node,

0 commit comments

Comments
 (0)