{"record":{"id":"1e7e04b6c3b44318","repo":"phalcon/cphalcon","slug":"the-source-of-event-must-be-an-object-got","errorCode":null,"errorMessage":"The source of {} event must be an object, got {}","messagePattern":"The source of (.+?) event must be an object, got (.+?)","errorType":"exception","errorClass":"InvalidEventSource","httpStatus":null,"severity":"error","filePath":"phalcon/Events/Event.zep","lineNumber":79,"sourceCode":"     * Event type\n     *\n     * @var string\n     */\n    protected type;\n\n    /**\n     * Phalcon\\Events\\Event constructor\n     *\n     * @param object source\n     */\n    public function __construct(\n        string type,\n        var source = null,\n        var data = null,\n        bool cancelable = true\n    ) {\n        if unlikely null !== source && typeof source !== \"object\" {\n            throw new InvalidEventSource(type, (typeof source));\n        }\n\n        let this->type       = type,\n            this->source     = source,\n            this->data       = data,\n            this->cancelable = cancelable;\n    }\n\n    public function getData() -> var\n    {\n        return this->data;\n    }\n\n    public function getSource() -> object | null\n    {\n        return this->source;\n    }\n","sourceCodeStart":61,"sourceCodeEnd":97,"githubUrl":"https://github.com/phalcon/cphalcon/blob/b7419de9cd0a8a3f48441ead84c9f8415d463e25/phalcon/Events/Event.zep#L61-L97","documentation":"Thrown by the Events Event constructor when source is supplied but is not an object (and not null). The event source is used to dispatch and identify the emitter, so only objects are accepted. Pass the object firing the event, or omit source.","triggerScenarios":"Thrown at phalcon/Events/Event.zep:79 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass the emitting object (e.g. the component firing the event) as source","Pass null explicitly when there is no source"],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"b7419de9cd0a8a3f48441ead84c9f8415d463e25","analyzedAt":"2026-08-21T06:21:18.811Z","contentChangedAt":"2026-08-21T06:21:18.811Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}