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

[BUG] Custom Events Manager in Phalcon\MVC\Models throws errors. #1314

Closed
temuri416 opened this issue Sep 30, 2013 · 2 comments
Closed

[BUG] Custom Events Manager in Phalcon\MVC\Models throws errors. #1314

temuri416 opened this issue Sep 30, 2013 · 2 comments

Comments

@temuri416
Copy link
Contributor

Full story here: http://stackoverflow.com/questions/19082505/custom-events-manager-in-phalcon-mvc-models-throws-errors

I've started digging and it looks like there's a bug in Phalcon\Mvc\Model\Manager::notifyEvent():

if (phalcon_array_isset(custom_events_manager, entity_name)) {

    PHALCON_INIT_NVAR(fire_event_name);
    PHALCON_CONCAT_SV(fire_event_name, "model:", event_name);

    PHALCON_INIT_NVAR(status);

    phalcon_call_method_p2_key(status, custom_events_manager, "fire", 210712414539UL, fire_event_name, model);

    if (PHALCON_IS_FALSE(status)) {
        RETURN_CCTOR(status);
    }
}

Firing "model:beforeValidation" event crashes execution.

When calling phalcon_call_method_p2_key() method, "custom_events_manager" is not an object - it is an array, where model is indexed by array key name ("entity_name" here).

Thus, shouldn't be call made on the "custom_events_manager->entity_name" ?

Thanks!

@ghost ghost mentioned this issue Sep 30, 2013
phalcon pushed a commit that referenced this issue Sep 30, 2013
@temuri416
Copy link
Contributor Author

@sjinks

Thanks for your efforts. However, having rebuilt from the 1.3.0 branch, I am still getting same error.

Pardon my ignorance, but I saw changes to ext/mvc/model/manager.c, while build/64bits/phalcon.c, that I know for fact is being used to compile the extension, is not updated and contains old code.

I'm using build/install to compile it.

@ghost
Copy link

ghost commented Sep 30, 2013

Please run

php build/gen-build.php
cd build
./install

This should do the trick.

phalcon pushed a commit that referenced this issue Oct 1, 2013
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