phalcon/cphalcon · error · InvalidEventHandler

Event handler must be an Object or Callable

Error message

Event handler must be an Object or Callable

What it means

Error "Event handler must be an Object or Callable" thrown in phalcon/cphalcon.

Source

Thrown at phalcon/Events/Manager.zep:243

                // Invokable object - generic callable.
                let type = 3;
            } else {
                // Plain object - method named after the event. Capture
                // the class name once at attach time so fireQueue() can
                // skip get_class() per fire (type=2 tuples carry it).
                this->insertHandlerEntry(
                    eventType,
                    handler,
                    2,
                    priority,
                    get_class(handler)
                );
                return;
            }
        } elseif is_callable(handler) {
            let type = 3;
        } else {
            throw new InvalidEventHandler();
        }

        this->insertHandlerEntry(eventType, handler, type, priority);
    }

    /**
     * Returns if priorities are enabled
     */
    public function arePrioritiesEnabled() -> bool
    {
        return this->enablePriorities;
    }

    /**
     * Removes every registered subscriber and detaches each listener they
     * contributed. Listeners attached via attach() are untouched.
     *
     * Iterates a snapshot of `subscribers` so removeSubscriber() can safely

View on GitHub (pinned to b7419de9cd)

When it happens

Trigger: Thrown at phalcon/Events/Manager.zep:243 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of phalcon/cphalcon@b7419de9cd (2026-08-21). Data as JSON: /api/errors/a6d5f23cda77d75a. Report an issue: GitHub.