Skip to content

Commit

Permalink
Removed class Phalcon\Mvc\Model\Validator\*
Browse files Browse the repository at this point in the history
  • Loading branch information
dreamsxin committed Oct 10, 2016
1 parent 6f95be9 commit 90250fe
Show file tree
Hide file tree
Showing 59 changed files with 210 additions and 3,189 deletions.
23 changes: 13 additions & 10 deletions ext/arr.c
Original file line number Diff line number Diff line change
Expand Up @@ -293,9 +293,9 @@ PHP_METHOD(Phalcon_Arr, path){
}

do {
PHALCON_MAKE_REF(&keys);
ZVAL_MAKE_REF(&keys);
PHALCON_CALL_FUNCTIONW(&key, "array_shift", &keys);
PHALCON_UNREF(&keys);
ZVAL_UNREF(&keys);

if (Z_TYPE(key) == IS_NULL) {
break;
Expand Down Expand Up @@ -383,19 +383,19 @@ PHP_METHOD(Phalcon_Arr, set_path){
while ((int) zend_hash_num_elements(Z_ARRVAL(keys)) > 1) {
zval is_digit = {}, *arr = NULL;

PHALCON_MAKE_REF(&keys);
ZVAL_MAKE_REF(&keys);
PHALCON_CALL_FUNCTIONW(&key, "array_shift", &keys);
PHALCON_UNREF(&keys);
ZVAL_UNREF(&keys);

if (PHALCON_IS_STRING(&key, "*")) {
ZEND_HASH_FOREACH_VAL(Z_ARRVAL(cpy_array), arr) {
zval is_array = {};
PHALCON_CALL_SELFW(&is_array, "is_array", arr);

if (zend_is_true(&is_array)) {
PHALCON_MAKE_REF(arr);
ZVAL_MAKE_REF(arr);
PHALCON_CALL_SELFW(NULL, "set_path", arr, &keys, value);
PHALCON_UNREF(arr);
ZVAL_UNREF(arr);
}
} ZEND_HASH_FOREACH_END();
found = 0;
Expand All @@ -417,9 +417,9 @@ PHP_METHOD(Phalcon_Arr, set_path){
}

if (found) {
PHALCON_MAKE_REF(&keys);
ZVAL_MAKE_REF(&keys);
PHALCON_CALL_FUNCTIONW(&key, "array_shift", &keys);
PHALCON_UNREF(&keys);
ZVAL_UNREF(&keys);

phalcon_array_update_zval(&cpy_array, &key, value, PH_COPY);
}
Expand Down Expand Up @@ -572,9 +572,9 @@ PHP_METHOD(Phalcon_Arr, extract){
zval value = {};
PHALCON_CALL_SELFW(&value, "path", array, path, default_value);

PHALCON_MAKE_REF(return_value);
ZVAL_MAKE_REF(return_value);
PHALCON_CALL_SELFW(NULL, "set_path", return_value, path, &value);
PHALCON_UNREF(return_value);
ZVAL_UNREF(return_value);
} ZEND_HASH_FOREACH_END();
}

Expand Down Expand Up @@ -842,7 +842,10 @@ PHP_METHOD(Phalcon_Arr, callback){

ZVAL_STRING(&pattern, "#^([^\\(]*+)\\((.*)\\)$#");

ZVAL_NULL(&matches);
ZVAL_MAKE_REF(&matches);
RETURN_ON_FAILURE(phalcon_preg_match(&ret, &pattern, str, &matches));
ZVAL_UNREF(&matches);

if (zend_is_true(&ret)) {
if (!phalcon_array_isset_fetch_long(&command, &matches, 1)) {
Expand Down
8 changes: 4 additions & 4 deletions ext/async.c
Original file line number Diff line number Diff line change
Expand Up @@ -231,13 +231,13 @@ PHP_METHOD(Phalcon_Async, recvAll){
ZVAL_NULL(&type);
ZVAL_NULL(&message);

PHALCON_MAKE_REF(&type);
PHALCON_MAKE_REF(&message);
ZVAL_MAKE_REF(&type);
ZVAL_MAKE_REF(&message);

PHALCON_CALL_FUNCTIONW(&result, "msg_receive", &seg, &pid, &type, &size, &message, &PHALCON_GLOBAL(z_true), &flag);

PHALCON_UNREF(&message);
PHALCON_UNREF(&type);
ZVAL_UNREF(&message);
ZVAL_UNREF(&type);

if (zend_is_true(&result)) {
phalcon_array_update_zval(return_value, &type, &message, PH_COPY);
Expand Down
14 changes: 0 additions & 14 deletions ext/config.m4
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,6 @@ mvc/model/metadata/redis.c \
mvc/model/metadata/mongo.c \
mvc/model/metadata/cache.c \
mvc/model/transaction.c \
mvc/model/validatorinterface.c \
mvc/model/metadata.c \
mvc/model/resultsetinterface.c \
mvc/model/managerinterface.c \
Expand All @@ -246,32 +245,19 @@ mvc/model/manager.c \
mvc/model/behaviorinterface.c \
mvc/model/relation.c \
mvc/model/exception.c \
mvc/model/message.c \
mvc/model/transaction/failed.c \
mvc/model/transaction/managerinterface.c \
mvc/model/transaction/manager.c \
mvc/model/transaction/exception.c \
mvc/model/queryinterface.c \
mvc/model/row.c \
mvc/model/criteria.c \
mvc/model/validator/email.c \
mvc/model/validator/presenceof.c \
mvc/model/validator/inclusionin.c \
mvc/model/validator/exclusionin.c \
mvc/model/validator/uniqueness.c \
mvc/model/validator/url.c \
mvc/model/validator/regex.c \
mvc/model/validator/numericality.c \
mvc/model/validator/stringlength.c \
mvc/model/validator/json.c \
mvc/model/resultset/complex.c \
mvc/model/resultset/simple.c \
mvc/model/behavior/timestampable.c \
mvc/model/behavior/softdelete.c \
mvc/model/validator.c \
mvc/model/metadatainterface.c \
mvc/model/relationinterface.c \
mvc/model/messageinterface.c \
mvc/model/transactioninterface.c \
mvc/jsonrpc.c \
mvc/jsonrpc/exception.c \
Expand Down
4 changes: 2 additions & 2 deletions ext/date.c
Original file line number Diff line number Diff line change
Expand Up @@ -779,9 +779,9 @@ PHP_METHOD(Phalcon_Date, span2){
}

if (Z_LVAL(count_output) == 1) {
PHALCON_MAKE_REF(&output_arr);
ZVAL_MAKE_REF(&output_arr);
PHALCON_CALL_FUNCTIONW(return_value, "array_pop", &output_arr);
PHALCON_UNREF(&output_arr);
ZVAL_UNREF(&output_arr);
return;
}

Expand Down
20 changes: 10 additions & 10 deletions ext/db/adapter/pdo.c
Original file line number Diff line number Diff line change
Expand Up @@ -351,20 +351,20 @@ PHP_METHOD(Phalcon_Db_Adapter_Pdo, executePrepared){
*/
if (phalcon_compare_strict_long(&type, 32)) {
phalcon_cast(&cast_value, value, IS_DOUBLE);
PHALCON_MAKE_REF(&cast_value);
ZVAL_MAKE_REF(&cast_value);
PHALCON_CALL_METHODW(NULL, statement, "bindvalue", &parameter, &cast_value);
PHALCON_UNREF(&cast_value);
ZVAL_UNREF(&cast_value);
} else {
/**
* 1024 is ignore the bind type
*/
PHALCON_MAKE_REF(value);
ZVAL_MAKE_REF(value);
if (phalcon_compare_strict_long(&type, 1024)) {
PHALCON_CALL_METHODW(NULL, statement, "bindvalue", &parameter, value);
} else {
PHALCON_CALL_METHODW(NULL, statement, "bindvalue", &parameter, value, &type);
}
PHALCON_UNREF(value);
ZVAL_UNREF(value);
}

} else {
Expand All @@ -373,14 +373,14 @@ PHP_METHOD(Phalcon_Db_Adapter_Pdo, executePrepared){
} else {
ZVAL_LONG(&type, PHALCON_DB_COLUMN_BIND_PARAM_STR);
}
PHALCON_MAKE_REF(value);
ZVAL_MAKE_REF(value);
PHALCON_CALL_METHODW(NULL, statement, "bindvalue", &parameter, value, &type);
PHALCON_UNREF(value);
ZVAL_UNREF(value);
}
} else {
PHALCON_MAKE_REF(value);
ZVAL_MAKE_REF(value);
PHALCON_CALL_METHODW(NULL, statement, "bindvalue", &parameter, value);
PHALCON_UNREF(value);
ZVAL_UNREF(value);
}
} ZEND_HASH_FOREACH_END();

Expand Down Expand Up @@ -698,9 +698,9 @@ PHP_METHOD(Phalcon_Db_Adapter_Pdo, convertBoundParams){

PHALCON_STR(&bind_pattern, "/\\?([0-9]+)|:([a-zA-Z0-9_]+):/");

PHALCON_MAKE_REF(&matches);
ZVAL_MAKE_REF(&matches);
PHALCON_CALL_FUNCTIONW(&status, "preg_match_all", &bind_pattern, sql, &matches, &set_order);
PHALCON_UNREF(&matches);
ZVAL_UNREF(&matches);

if (zend_is_true(&status)) {
ZEND_HASH_FOREACH_VAL(Z_ARRVAL(matches), place_match) {
Expand Down
5 changes: 3 additions & 2 deletions ext/db/adapter/pdo/mysql.c
Original file line number Diff line number Diff line change
Expand Up @@ -174,9 +174,10 @@ PHP_METHOD(Phalcon_Db_Adapter_Pdo_Mysql, describeColumns){
* If the column type has a parentheses we try to get the column size from it
*/
if (phalcon_memnstr_str(&column_type, SL("("))) {

ZVAL_NULL(&matches);
ZVAL_MAKE_REF(&matches);
RETURN_ON_FAILURE(phalcon_preg_match(&pos, &size_pattern, &column_type, &matches));

ZVAL_UNREF(&matches);
if (zend_is_true(&pos)) {
if (phalcon_array_isset_fetch_long(&match_one, &matches, 1)) {
convert_to_long(&match_one);
Expand Down
3 changes: 3 additions & 0 deletions ext/db/adapter/pdo/sqlite.c
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,10 @@ PHP_METHOD(Phalcon_Db_Adapter_Pdo_Sqlite, describeColumns){
phalcon_array_fetch_long(&column_type, field, 2, PH_NOISY);

if (phalcon_memnstr_str(&column_type, SL("("))) {
ZVAL_NULL(&matches);
ZVAL_MAKE_REF(&matches);
RETURN_ON_FAILURE(phalcon_preg_match(&pos, &size_pattern, &column_type, &matches));
ZVAL_UNREF(&matches);
if (zend_is_true(&pos)) {
if (phalcon_array_isset_fetch_long(&match_one, &matches, 1)) {
convert_to_long(&match_one);
Expand Down
3 changes: 3 additions & 0 deletions ext/db/result/pdo.c
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,10 @@ PHP_METHOD(Phalcon_Db_Result_Pdo, numRows){

ZVAL_STRING(&pattern, "/^SELECT\\s+(.*)$/i");

ZVAL_NULL(&matches);
ZVAL_MAKE_REF(&matches);
RETURN_ON_FAILURE(phalcon_preg_match(&match, &pattern, &sql_statement, &matches));
ZVAL_UNREF(&matches);

if (zend_is_true(&match)) {
phalcon_array_fetch_long(&else_clauses, &matches, 1, PH_NOISY);
Expand Down
4 changes: 2 additions & 2 deletions ext/di/injectable.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@ PHALCON_INIT_CLASS(Phalcon_DI_Injectable);

ZEND_BEGIN_ARG_INFO_EX(arginfo_phalcon_di_injectable_fireevent, 0, 0, 1)
ZEND_ARG_INFO(0, eventName)
ZEND_ARG_INFO(1, data)
ZEND_ARG_INFO(0, data)
ZEND_ARG_INFO(0, cancelable)
ZEND_END_ARG_INFO()

ZEND_BEGIN_ARG_INFO_EX(arginfo_phalcon_di_injectable_fireeventcancel, 0, 0, 1)
ZEND_ARG_INFO(0, eventName)
ZEND_ARG_INFO(1, data)
ZEND_ARG_INFO(0, data)
ZEND_ARG_INFO(0, cancelable)
ZEND_END_ARG_INFO()

Expand Down
2 changes: 0 additions & 2 deletions ext/dispatcher.c
Original file line number Diff line number Diff line change
Expand Up @@ -1244,10 +1244,8 @@ PHP_METHOD(Phalcon_Dispatcher, fireEvent){
/* Shortcut, save one method call */
ZVAL_STRING(&event_name, "dispatch:beforeException");

PHALCON_MAKE_REF(&exception);
zval *params[] = {&event_name, &exception};
ret2 = phalcon_call_method_with_params(&status, getThis(), phalcon_dispatcher_ce, phalcon_fcall_parent, SL("fireevent"), 2, params);
PHALCON_UNREF(&exception);
if (ret2 == SUCCESS && PHALCON_IS_FALSE(&status)) {
RETURN_FALSE;
}
Expand Down
5 changes: 2 additions & 3 deletions ext/http/request.c
Original file line number Diff line number Diff line change
Expand Up @@ -1674,7 +1674,6 @@ PHP_METHOD(Phalcon_Http_Request, getDigestAuth){

zval *_SERVER, key = {}, *value, pattern = {}, digest = {}, set_order = {}, matches = {}, ret = {}, *match;
const char *auth_digest = SG(request_info).auth_digest;
int __is_make_ref = 0;

if (unlikely(!auth_digest)) {
_SERVER = phalcon_get_global_str(SL("_SERVER"));
Expand All @@ -1693,9 +1692,9 @@ PHP_METHOD(Phalcon_Http_Request, getDigestAuth){
PHALCON_STR(&digest, auth_digest);
ZVAL_LONG(&set_order, 2);

PHALCON_MAKE_REF(&matches);
ZVAL_MAKE_REF(&matches);
PHALCON_CALL_FUNCTIONW(&ret, "preg_match_all", &pattern, &digest, &matches, &set_order);
PHALCON_UNREF(&matches);
ZVAL_UNREF(&matches);

if (zend_is_true(&ret) && Z_TYPE(matches) == IS_ARRAY) {
array_init(return_value);
Expand Down
4 changes: 2 additions & 2 deletions ext/http/uri.c
Original file line number Diff line number Diff line change
Expand Up @@ -147,9 +147,9 @@ PHP_METHOD(Phalcon_Http_Uri, __construct)
} else if (Z_TYPE_P(uri) == IS_STRING) {
PHALCON_CALL_FUNCTIONW(&parts, "parse_url", uri);
if (phalcon_array_isset_fetch_str(&query, &parts, SL("query"))) {
PHALCON_MAKE_REF(&params);
ZVAL_MAKE_REF(&params);
PHALCON_CALL_FUNCTIONW(NULL, "parse_str", &query, &params);
PHALCON_UNREF(&params);
ZVAL_UNREF(&params);
phalcon_array_update_str(&parts, SL("query"), &params, PH_COPY);
}

Expand Down
3 changes: 3 additions & 0 deletions ext/image/adapter/gd.c
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,10 @@ PHP_METHOD(Phalcon_Image_Adapter_GD, check){

if (phalcon_array_isset_fetch_str(&gd_version, &gd_info, SL("GD Version"))) {
ZVAL_STRING(&pattern, "#\\d+\\.\\d+(?:\\.\\d+)?#");
ZVAL_NULL(&matches);
ZVAL_MAKE_REF(&matches);
RETURN_ON_FAILURE(phalcon_preg_match(&ret, &pattern, &gd_version, &matches));
ZVAL_UNREF(&matches);

if (zend_is_true(&ret)) {
if (!phalcon_array_isset_fetch_long(&version, &matches, 0)) {
Expand Down
2 changes: 1 addition & 1 deletion ext/kernel/main.h
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ void phalcon_clean_and_cache_symbol_table(zend_array *symbol_table);

/** When type is the ref should also */
#define PHALCON_MAKE_REF(obj) \
if (!Z_ISREF_P(obj)) { \
if (!Z_ISREF_P(obj) && Z_TYPE_P(obj) >= IS_ARRAY) { \
__is_make_ref += 1; \
ZVAL_NEW_REF(obj, obj); \
}
Expand Down
5 changes: 1 addition & 4 deletions ext/kernel/string.c
Original file line number Diff line number Diff line change
Expand Up @@ -1497,13 +1497,10 @@ void phalcon_crc32(zval *return_value, zval *str)

int phalcon_preg_match(zval *retval, zval *regex, zval *subject, zval *matches)
{
int result, __is_make_ref = 0;
int result;

if (matches) {
ZVAL_NULL(matches);
PHALCON_MAKE_REF(matches);
PHALCON_CALL_FUNCTION_FLAG(result, retval, "preg_match", regex, subject, matches);
PHALCON_UNREF(matches);
} else {
PHALCON_CALL_FUNCTION_FLAG(result, retval, "preg_match", regex, subject);
}
Expand Down
Loading

0 comments on commit 90250fe

Please sign in to comment.