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

[2.0.0] Model : setSnapshotData exception "The snapshot data must be an array" #2466

Closed
kevinhatry opened this issue May 25, 2014 · 0 comments

Comments

@kevinhatry
Copy link

When using $this->useDynamicUpdate(true); in a model class the exception "The snapshot data must be an array" is raised.

This is due to an inverted test in Model.zep (and the generated model.c).
Here is the patch :

index 7be257d..8cb0bbf 100644
--- a/ext/phalcon/mvc/model.c
+++ b/ext/phalcon/mvc/model.c
@@ -4615,7 +4615,7 @@ PHP_METHOD(Phalcon_Mvc_Model, setSnapshotData) {
}

  •   if (Z_TYPE_P(data) == IS_ARRAY) {
    
  •   if (Z_TYPE_P(data) != IS_ARRAY) {
            ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "The snapshot data must be an array", "phalcon/mvc/model.zep", 3617);
            return;
    }
    

    diff --git a/phalcon/mvc/model.zep b/phalcon/mvc/model.zep
    index 0defc80..f213246 100644
    --- a/phalcon/mvc/model.zep
    +++ b/phalcon/mvc/model.zep
    @@ -3613,7 +3613,7 @@ abstract class Model implements ModelInterface, ResultInterface, InjectionAwareI
    {
    var key, value, snapshot, attribute;

  •           if typeof data == "array" {
    
  •           if typeof data != "array" {
                    throw new Exception("The snapshot data must be an array");
            }
    
phalcon pushed a commit that referenced this issue May 26, 2014
fix inverted test in Model/setSnapshotData() (issue #2466)
@phalcon phalcon closed this as completed May 26, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant