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

pecl-event incompatible with Laravel #103

Open
TKr opened this issue May 23, 2022 · 2 comments
Open

pecl-event incompatible with Laravel #103

TKr opened this issue May 23, 2022 · 2 comments

Comments

@TKr
Copy link

TKr commented May 23, 2022

Bug ? Notice ?

pecl-event registers class Event::class
laravel has own "Facade" system and register Event as Illuminate\Support\Facades\Event::class
but can not, pecl-event has already done this

Laravel's Event::dispatch(something) ends with error.

@fquffio
Copy link
Collaborator

fquffio commented May 23, 2022

Hi @TKr, sorry for the issue. Can you help me reproduce? Can you please write which libraries are you installing and their versions? Maybe try attaching your composer.json redacting anything that you don't want to share…?

@TKr
Copy link
Author

TKr commented May 23, 2022

I show this on php7.4 and laravel 6.X (but wersion do not matter in this case)

  1. docker run -it chialab/php:7.4 bash
  2. composer create-project --prefer-dist laravel/laravel test "6.*"
  3. cd test
  4. ./artisan tinker
  5. Event::dispatch()
    PHP Error: Call to undefined method Event::dispatch() in Psy Shell code on line 1
    should return
    TypeError: Too few arguments to function Illuminate\Events\Dispatcher::dispatch(), 0 passed in ....
  6. class_parents(Event::class)
    => []
    should return
    => [ "Illuminate\Support\Facades\Facade" => "Illuminate\Support\Facades\Facade", ]

Zrzut ekranu 2022-05-23 o 17 58 31
Instead of returning Laravel Facade Event class comes from extension
https://www.php.net/manual/en/class.event.php
I know. Facade is "invented" for laravel and good practice is to not use them. But unfortunately there is many projects which use it that way.

Example 2: event package removed from Dockerfile (mine local build):

Zrzut ekranu 2022-05-23 o 17 57 10

Event comes from Laravel as expected

I don know is this a bug, which should be fixed, and event extension removed. I just noticing that some frameworks with event enabled my not working correctly.

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

2 participants