You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a personal project that I have been building in a web environment for a long time. The project is using Javascript and Livewire for the "frontend" and PHP 8.4 for the backend. Also, I am using the AdminLTE template with Vite. Recently, I decided to implement Native PHP in my project.
My project have installed the following libraries using composer:
public function register(): void
{
Event::listen('*', function (string $eventName, array $data) {
$event = $data[0] ?? (object) null;
if (! method_exists($event, 'broadcastOn')) {
return;
}
$channels = $event->broadcastOn();
// Only events dispatched on the nativephp channel
if (! in_array('nativephp', $channels)) {
return;
}
// Only post custom events to broadcasting endpoint
How to reproduce the bug
Make a small project with Livewire with AdminLTE where you dispatch an event using Livewire and run the command: "php artisan native:serve"
Package Versions
{
"installed": [
{
"name": "nativephp/electron",
"direct-dependency": true,
"homepage": "https://github.com/nativephp/electron",
"source": "https://github.com/NativePHP/electron/tree/0.9.0",
"version": "0.9.0",
"description": "Electron wrapper for the NativePHP framework.",
"abandoned": false
},
{
"name": "nativephp/laravel",
"direct-dependency": false,
"homepage": "https://github.com/nativephp/laravel",
"source": "https://github.com/NativePHP/laravel/tree/0.7.0",
"version": "0.7.0",
"description": "Laravel wrapper for the NativePHP framework.",
"abandoned": false
},
{
"name": "nativephp/php-bin",
"direct-dependency": false,
"homepage": "https://nativephp.com",
"source": "https://github.com/NativePHP/php-bin/tree/0.5.6",
"version": "0.5.6",
"description": "PHP binaries used by the NativePHP framework",
"abandoned": false
}
]
}
PHP Version
8.4.5
Laravel Version
11.44.2
Node Version
20.12.0
Which operating systems have you seen this occur on?
Windows
OS version
Microsoft Windows 10 Pro, 10.0.19045 N/A Build 19045
Notes
As a WorkAround, i replaced the following line in the file vendor/nativephp/laravel/src/Events/EventWatcher.php:
When I did that, the exception was not thrown anymore.
The text was updated successfully, but these errors were encountered:
So, the event is being dispatched by the library Darryldecode\Cart\Cart. I guess that the way of the library Darryldecode\Cart\Cart works is dispatching events as arrays. Not sure, though.
What were you trying to do?
I have a personal project that I have been building in a web environment for a long time. The project is using Javascript and Livewire for the "frontend" and PHP 8.4 for the backend. Also, I am using the AdminLTE template with Vite. Recently, I decided to implement Native PHP in my project.
My project have installed the following libraries using composer:
What happened?
When I run the command "php artisan native:serve" everything works fine. But, when my webpage is opened I get the following error:
TypeError
"method_exists(): Argument #1 ($object_or_class) must be of type object|string, array given"
MyProject\vendor\nativephp\laravel\src\Events\EventWatcher.php :17
How to reproduce the bug
Make a small project with Livewire with AdminLTE where you dispatch an event using Livewire and run the command: "php artisan native:serve"
Package Versions
{
"installed": [
{
"name": "nativephp/electron",
"direct-dependency": true,
"homepage": "https://github.com/nativephp/electron",
"source": "https://github.com/NativePHP/electron/tree/0.9.0",
"version": "0.9.0",
"description": "Electron wrapper for the NativePHP framework.",
"abandoned": false
},
{
"name": "nativephp/laravel",
"direct-dependency": false,
"homepage": "https://github.com/nativephp/laravel",
"source": "https://github.com/NativePHP/laravel/tree/0.7.0",
"version": "0.7.0",
"description": "Laravel wrapper for the NativePHP framework.",
"abandoned": false
},
{
"name": "nativephp/php-bin",
"direct-dependency": false,
"homepage": "https://nativephp.com",
"source": "https://github.com/NativePHP/php-bin/tree/0.5.6",
"version": "0.5.6",
"description": "PHP binaries used by the NativePHP framework",
"abandoned": false
}
]
}
PHP Version
8.4.5
Laravel Version
11.44.2
Node Version
20.12.0
Which operating systems have you seen this occur on?
Windows
OS version
Microsoft Windows 10 Pro, 10.0.19045 N/A Build 19045
Notes
As a WorkAround, i replaced the following line in the file vendor/nativephp/laravel/src/Events/EventWatcher.php:
When I did that, the exception was not thrown anymore.
The text was updated successfully, but these errors were encountered: