Skip to content

Commit 6145e76

Browse files
committed
Drop comments and split a warning case
1 parent 6310aca commit 6145e76

File tree

6 files changed

+14
-18
lines changed

6 files changed

+14
-18
lines changed

ext/dom/documentfragment.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,6 @@ PHP_METHOD(DOMDocumentFragment, appendXML) {
109109
DOM_GET_OBJ(nodep, id, xmlNodePtr, intern);
110110

111111
if (dom_node_is_read_only(nodep) == SUCCESS) {
112-
// Should always be in strict mode?
113112
php_dom_throw_error(NO_MODIFICATION_ALLOWED_ERR, dom_get_strict_error(intern->document));
114113
RETURN_FALSE;
115114
}

ext/dom/element.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,6 @@ PHP_METHOD(DOMElement, setAttribute)
268268
DOM_GET_OBJ(nodep, id, xmlNodePtr, intern);
269269

270270
if (dom_node_is_read_only(nodep) == SUCCESS) {
271-
// Todo make it always strict?
272271
php_dom_throw_error(NO_MODIFICATION_ALLOWED_ERR, dom_get_strict_error(intern->document));
273272
RETURN_FALSE;
274273
}
@@ -642,7 +641,6 @@ PHP_METHOD(DOMElement, setAttributeNS)
642641
RETURN_NULL();
643642
}
644643

645-
// Todo should always be strict?
646644
errorcode = dom_check_qname(name, &localname, &prefix, uri_len, name_len);
647645

648646
if (errorcode == 0) {

ext/dom/node.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -857,7 +857,6 @@ PHP_METHOD(DOMNode, insertBefore)
857857

858858
new_child = NULL;
859859

860-
// Todo should always be strict?
861860
stricterror = dom_get_strict_error(intern->document);
862861

863862
if (dom_node_is_read_only(parentp) == SUCCESS ||
@@ -877,7 +876,7 @@ PHP_METHOD(DOMNode, insertBefore)
877876
}
878877

879878
if (child->type == XML_DOCUMENT_FRAG_NODE && child->children == NULL) {
880-
// Todo convert to Error?
879+
/* TODO Drop Warning? */
881880
php_error_docref(NULL, E_WARNING, "Document Fragment is empty");
882881
RETURN_FALSE;
883882
}
@@ -1026,7 +1025,6 @@ PHP_METHOD(DOMNode, replaceChild)
10261025
RETURN_FALSE;
10271026
}
10281027

1029-
// Todo make alway strict?
10301028
stricterror = dom_get_strict_error(intern->document);
10311029

10321030
if (dom_node_is_read_only(nodep) == SUCCESS ||
@@ -1177,7 +1175,7 @@ PHP_METHOD(DOMNode, appendChild)
11771175
}
11781176

11791177
if (child->type == XML_DOCUMENT_FRAG_NODE && child->children == NULL) {
1180-
// Todo convert to error?
1178+
/* TODO Drop Warning? */
11811179
php_error_docref(NULL, E_WARNING, "Document Fragment is empty");
11821180
RETURN_FALSE;
11831181
}
@@ -1468,7 +1466,6 @@ PHP_METHOD(DOMNode, lookupPrefix)
14681466
}
14691467
}
14701468

1471-
// Todo return empty string?
14721469
RETURN_NULL();
14731470
}
14741471
/* }}} end dom_node_lookup_prefix */
@@ -1748,7 +1745,7 @@ PHP_METHOD(DOMNode, getNodePath)
17481745

17491746
value = (char *) xmlGetNodePath(nodep);
17501747
if (value == NULL) {
1751-
// Todo return empty string?
1748+
/* TODO Research if can return empty string */
17521749
RETURN_NULL();
17531750
} else {
17541751
RETVAL_STRING(value);

ext/dom/parentnode.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,6 @@ xmlNode* dom_zvals_to_fragment(php_libxml_ref_obj *document, xmlNode *contextNod
151151
return NULL;
152152
}
153153

154-
// Todo always strict mode?
155154
stricterror = dom_get_strict_error(document);
156155

157156
for (i = 0; i < nodesc; i++) {
@@ -379,7 +378,6 @@ void dom_child_node_remove(dom_object *context)
379378
return;
380379
}
381380

382-
// Todo always strict?
383381
stricterror = dom_get_strict_error(context->document);
384382

385383
if (dom_node_is_read_only(child) == SUCCESS ||

ext/dom/text.c

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -122,20 +122,25 @@ PHP_METHOD(DOMText, splitText)
122122
}
123123
DOM_GET_OBJ(node, id, xmlNodePtr, intern);
124124

125+
if (offset < 0) {
126+
zend_argument_value_error(1, "must be greater than or equal to 0");
127+
RETURN_THROWS();
128+
}
129+
125130
if (node->type != XML_TEXT_NODE && node->type != XML_CDATA_SECTION_NODE) {
126-
// Todo make this throw an error?
131+
/* TODO Add warning? */
127132
RETURN_FALSE;
128133
}
129134

130135
cur = xmlNodeGetContent(node);
131136
if (cur == NULL) {
132-
// Todo make this throw an error?
137+
/* TODO Add warning? */
133138
RETURN_FALSE;
134139
}
135140
length = xmlUTF8Strlen(cur);
136141

137-
if (ZEND_LONG_INT_OVFL(offset) || (int)offset > length || offset < 0) {
138-
// Todo make this throw an error?
142+
if (ZEND_LONG_INT_OVFL(offset) || (int)offset > length) {
143+
/* TODO Add warning? */
139144
xmlFree(cur);
140145
RETURN_FALSE;
141146
}
@@ -152,7 +157,7 @@ PHP_METHOD(DOMText, splitText)
152157
xmlFree(second);
153158

154159
if (nnode == NULL) {
155-
// Todo make this throw an error?
160+
/* TODO Add warning? */
156161
RETURN_FALSE;
157162
}
158163

ext/dom/xpath.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,6 @@ static void php_xpath_eval(INTERNAL_FUNCTION_PARAMETERS, int type) /* {{{ */
353353

354354
docp = (xmlDocPtr) ctxp->doc;
355355
if (docp == NULL) {
356-
// Todo convert to error?
357356
php_error_docref(NULL, E_WARNING, "Invalid XPath Document Pointer");
358357
RETURN_FALSE;
359358
}
@@ -397,7 +396,7 @@ static void php_xpath_eval(INTERNAL_FUNCTION_PARAMETERS, int type) /* {{{ */
397396
}
398397

399398
if (! xpathobjp) {
400-
// Make this an error state?
399+
/* TODO Add Warning? */
401400
RETURN_FALSE;
402401
}
403402

0 commit comments

Comments
 (0)