codeigniter4 / CodeIgniter4

Open Source PHP Framework (originally from EllisLab)
https://codeigniter.com/
MIT License
5.35k stars 1.9k forks source link

Events.php on method $callable parameter accepts only callable #1835

Closed d4mn closed 5 years ago

d4mn commented 5 years ago

name: Bug report about: Help us improve the framework by reporting bugs!


Describe the bug All these methods:

CodeIgniter 4 version Codeigniter 4 beta 1

Affected module(s) Events.php

Expected behavior, and steps to reproduce if appropriate method should not be strict checked in functions attribute

Context

d4mn commented 5 years ago

I tried to look deeper into this and found this article https://wiki.php.net/rfc/consistent_callables First example of problem i think is it

bangbangda commented 5 years ago

I tested it, is OK. @d4mn

$testEvent = new \App\Libraries\TestEvent();
Events::on('pre_system', [$testEvent, 'hello']);
class TestEvent
{
    public function hello()
    {
        log_message('debug', 'TestEvent hello....');
        return true;
    }
}
atishhamte commented 5 years ago

Is it working as expected?