Skip to content

Commit

Permalink
Fix #1399
Browse files Browse the repository at this point in the history
  • Loading branch information
sjinks committed Oct 18, 2013
1 parent 71dbb90 commit 21c5770
Showing 1 changed file with 10 additions and 19 deletions.
29 changes: 10 additions & 19 deletions ext/validation.c
Original file line number Diff line number Diff line change
Expand Up @@ -158,12 +158,8 @@ PHP_METHOD(Phalcon_Validation, validate){
}

phalcon_update_property_this(this_ptr, SL("_messages"), messages TSRMLS_CC);
if (Z_TYPE_P(data) == IS_ARRAY) {
if (Z_TYPE_P(data) == IS_ARRAY || Z_TYPE_P(data) == IS_OBJECT) {
phalcon_update_property_this(this_ptr, SL("_data"), data TSRMLS_CC);
} else {
if (Z_TYPE_P(data) == IS_OBJECT) {
phalcon_update_property_this(this_ptr, SL("_data"), data TSRMLS_CC);
}
}

PHALCON_INIT_VAR(cancel_on_fail);
Expand Down Expand Up @@ -359,8 +355,8 @@ PHP_METHOD(Phalcon_Validation, appendMessage){
* Assigns the data to an entity
* The entity is used to obtain the validation values
*
* @param string $entity
* @param string $data
* @param object $entity
* @param object|array $data
* @return Phalcon\Validation
*/
PHP_METHOD(Phalcon_Validation, bind){
Expand Down Expand Up @@ -415,18 +411,14 @@ PHP_METHOD(Phalcon_Validation, getValue){
if (phalcon_method_exists(entity, method TSRMLS_CC) == SUCCESS) {
PHALCON_INIT_VAR(value);
phalcon_call_method_zval(value, entity, method);
} else if (phalcon_method_exists_ex(entity, SS("readattribute") TSRMLS_CC) == SUCCESS) {
PHALCON_INIT_VAR(value);
phalcon_call_method_p1(value, entity, "readattribute", attribute);
} else if (phalcon_isset_property_zval(entity, attribute TSRMLS_CC)) {
PHALCON_OBS_VAR(value);
phalcon_read_property_zval(&value, entity, attribute, PH_NOISY_CC);
} else {
if (phalcon_method_exists_ex(entity, SS("readattribute") TSRMLS_CC) == SUCCESS) {
PHALCON_INIT_NVAR(value);
phalcon_call_method(value, entity, "readattribute");
} else {
if (phalcon_isset_property_zval(entity, attribute TSRMLS_CC)) {
PHALCON_OBS_NVAR(value);
phalcon_read_property_zval(&value, entity, attribute, PH_NOISY_CC);
} else {
PHALCON_INIT_NVAR(value);
}
}
PHALCON_INIT_VAR(value);
}

RETURN_CCTOR(value);
Expand Down Expand Up @@ -519,4 +511,3 @@ PHP_METHOD(Phalcon_Validation, getValue){

RETURN_MM_NULL();
}

0 comments on commit 21c5770

Please sign in to comment.