From: Rob Richards Date: Thu, 22 Jan 2004 21:16:05 +0000 (+0000) Subject: update constructors so they cant be called statically X-Git-Tag: php_ibase_before_split~37 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=7e619b7f5f0e1dbae7204e6c1ae72676d69d5166;p=php update constructors so they cant be called statically --- diff --git a/ext/dom/attr.c b/ext/dom/attr.c index 90615f8a58..c5bf81897a 100644 --- a/ext/dom/attr.c +++ b/ext/dom/attr.c @@ -54,13 +54,12 @@ PHP_FUNCTION(dom_attr_attr) char *name, *value = NULL; int name_len, value_len; - id = getThis(); - intern = (dom_object *)zend_object_store_get_object(id TSRMLS_CC); - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|s", &name, &name_len, &value, &value_len) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os|s", &id, dom_attr_class_entry, &name, &name_len, &value, &value_len) == FAILURE) { return; } + intern = (dom_object *)zend_object_store_get_object(id TSRMLS_CC); + if (name_len == 0) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Attribute name is required"); RETURN_FALSE; diff --git a/ext/dom/cdatasection.c b/ext/dom/cdatasection.c index 5d6e2402a4..0daab0bfcc 100644 --- a/ext/dom/cdatasection.c +++ b/ext/dom/cdatasection.c @@ -40,7 +40,7 @@ zend_function_entry php_dom_cdatasection_class_functions[] = { {NULL, NULL, NULL} }; -/* {{{ proto domnode dom_cdatasection_cdatasection([string value]); */ +/* {{{ proto domnode dom_cdatasection_cdatasection(string value); */ PHP_FUNCTION(dom_cdatasection_cdatasection) { @@ -50,13 +50,10 @@ PHP_FUNCTION(dom_cdatasection_cdatasection) char *value = NULL; int value_len; - id = getThis(); - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &value, &value_len) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &id, dom_cdatasection_class_entry, &value, &value_len) == FAILURE) { return; } - nodep = xmlNewCDataBlock(NULL, (xmlChar *) value, value_len); if (!nodep) diff --git a/ext/dom/comment.c b/ext/dom/comment.c index 15fceb4bdd..5963ff9e73 100644 --- a/ext/dom/comment.c +++ b/ext/dom/comment.c @@ -50,9 +50,7 @@ PHP_FUNCTION(dom_comment_comment) char *value = NULL; int value_len; - id = getThis(); - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s", &value, &value_len) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O|s", &id, dom_comment_class_entry, &value, &value_len) == FAILURE) { return; } diff --git a/ext/dom/document.c b/ext/dom/document.c index 22e40e6752..a5f67e6c2a 100644 --- a/ext/dom/document.c +++ b/ext/dom/document.c @@ -1092,10 +1092,8 @@ PHP_FUNCTION(dom_document_document) dom_object *intern; char *encoding, *version = NULL; int encoding_len = 0, version_len = 0, refcount; - - id = getThis(); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|ss", &version, &version_len, &encoding, &encoding_len) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O|ss", &id, dom_document_class_entry, &version, &version_len, &encoding, &encoding_len) == FAILURE) { return; } diff --git a/ext/dom/documentfragment.c b/ext/dom/documentfragment.c index a76922720a..a51c7af5a3 100644 --- a/ext/dom/documentfragment.c +++ b/ext/dom/documentfragment.c @@ -48,7 +48,9 @@ PHP_FUNCTION(dom_documentfragment_documentfragment) xmlNodePtr nodep = NULL, oldnode = NULL; dom_object *intern; - id = getThis(); + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &id, dom_documentfragment_class_entry) == FAILURE) { + return; + } nodep = xmlNewDocFragment(NULL); diff --git a/ext/dom/element.c b/ext/dom/element.c index 68accf015c..545e58a90c 100644 --- a/ext/dom/element.c +++ b/ext/dom/element.c @@ -68,9 +68,7 @@ PHP_FUNCTION(dom_element_element) char *name, *value = NULL; int name_len, value_len = 0; - id = getThis(); - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|s", &name, &name_len, &value, &value_len) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os|s", &id, dom_element_class_entry, &name, &name_len, &value, &value_len) == FAILURE) { return; } diff --git a/ext/dom/entityreference.c b/ext/dom/entityreference.c index 283ce7bd1a..9d8039f577 100644 --- a/ext/dom/entityreference.c +++ b/ext/dom/entityreference.c @@ -50,9 +50,7 @@ PHP_FUNCTION(dom_entityreference_entityreference) char *name; int name_len; - id = getThis(); - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &name, &name_len) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &id, dom_entityreference_class_entry, &name, &name_len) == FAILURE) { return; } diff --git a/ext/dom/namednodemap.c b/ext/dom/namednodemap.c index 68a51648c1..877845fbcf 100644 --- a/ext/dom/namednodemap.c +++ b/ext/dom/namednodemap.c @@ -103,9 +103,7 @@ PHP_FUNCTION(dom_namednodemap_get_named_item) xmlNodePtr nodep; xmlNotation *notep = NULL; - id = getThis(); - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &named, &namedlen) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &id, dom_namednodemap_class_entry, &named, &namedlen) == FAILURE) { return; } @@ -172,9 +170,7 @@ PHP_FUNCTION(dom_namednodemap_item) xmlNodePtr nodep, curnode; int count; - id = getThis(); - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &index) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ol", &id, dom_namednodemap_class_entry, &index) == FAILURE) { return; } @@ -229,9 +225,7 @@ PHP_FUNCTION(dom_namednodemap_get_named_item_ns) xmlNodePtr nodep; xmlNotation *notep = NULL; - id = getThis(); - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &uri, &urilen, &named, &namedlen) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os!s", &id, dom_namednodemap_class_entry, &uri, &urilen, &named, &namedlen) == FAILURE) { return; } diff --git a/ext/dom/nodelist.c b/ext/dom/nodelist.c index a15228b376..2208322804 100644 --- a/ext/dom/nodelist.c +++ b/ext/dom/nodelist.c @@ -110,9 +110,7 @@ PHP_FUNCTION(dom_nodelist_item) HashTable *nodeht; pval **entry; - id = getThis(); - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &index) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ol", &id, dom_nodelist_class_entry, &index) == FAILURE) { return; } diff --git a/ext/dom/php_dom.c b/ext/dom/php_dom.c index aee8c69e62..770a89696f 100644 --- a/ext/dom/php_dom.c +++ b/ext/dom/php_dom.c @@ -28,7 +28,6 @@ #if HAVE_LIBXML && HAVE_DOM #include "ext/standard/php_rand.h" #include "php_dom.h" -#include "dom_ce.h" #include "dom_properties.h" #include "ext/standard/info.h" diff --git a/ext/dom/php_dom.h b/ext/dom/php_dom.h index d5e976e953..64ea2c9e64 100644 --- a/ext/dom/php_dom.h +++ b/ext/dom/php_dom.h @@ -57,6 +57,7 @@ extern zend_module_entry dom_module_entry; #include "xml_common.h" #include "ext/libxml/php_libxml.h" #include "zend_default_classes.h" +#include "dom_ce.h" /* DOM API_VERSION, please bump it up, if you change anything in the API therefore it's easier for the script-programmers to check, what's working how Can be checked with phpversion("dom"); diff --git a/ext/dom/processinginstruction.c b/ext/dom/processinginstruction.c index 13e1f79e82..3a57457122 100644 --- a/ext/dom/processinginstruction.c +++ b/ext/dom/processinginstruction.c @@ -50,9 +50,7 @@ PHP_FUNCTION(dom_processinginstruction_processinginstruction) char *name, *value = NULL; int name_len, value_len; - id = getThis(); - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|s", &name, &name_len, &value, &value_len) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os|s", &id, dom_processinginstruction_class_entry, &name, &name_len, &value, &value_len) == FAILURE) { return; } diff --git a/ext/dom/text.c b/ext/dom/text.c index b049c9cd87..d315adaff8 100644 --- a/ext/dom/text.c +++ b/ext/dom/text.c @@ -53,9 +53,7 @@ PHP_FUNCTION(dom_text_text) char *value = NULL; int value_len; - id = getThis(); - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s", &value, &value_len) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O|s", &id, dom_text_class_entry, &value, &value_len) == FAILURE) { return; } diff --git a/ext/dom/xpath.c b/ext/dom/xpath.c index 28b118e50c..4b693bb465 100644 --- a/ext/dom/xpath.c +++ b/ext/dom/xpath.c @@ -49,9 +49,7 @@ PHP_FUNCTION(dom_xpath_xpath) dom_object *docobj, *intern; xmlXPathContextPtr ctx, oldctx; - id = getThis(); - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o", &doc) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oo", &id, dom_xpath_class_entry, &doc) == FAILURE) { return; }