Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[1.3.0] Fix #1399 #1400

Merged
merged 2 commits into from Oct 19, 2013
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Fix #1399
(cherry picked from commit 21c5770)
  • Loading branch information
sjinks committed Oct 18, 2013
commit d516dd0aae467d995212bf164ff61d2c71bb57ee
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 @@ -351,8 +347,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 @@ -407,18 +403,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 @@ -511,4 +503,3 @@ PHP_METHOD(Phalcon_Validation, getValue){

RETURN_MM_NULL();
}