Ioncube encoder
I'm uising Filament 2, with php 8.1, and I'm trying to encode with ioncube. But my php dies with this code in my resource:
Forms\Components\TextInput::make('ip')
->required()
->unique(callback: function (Unique $rule, callable $get) {
return $rule
->where('ip', $get('ip'))
->where('username', $get('username'));
}, ignoreRecord: true)
->rule('ipv4')
->maxLength(255),
specifically in the unique closure.
Any idea what can I do?
thanks,
10 Replies
But my php dies with this code in my resource:What does that mean? Any error? I don't know IonCube. Does it work with Laravel/Eloquent?
Yes, it works with Laravel/Eloquent. Everything in the project with Filament is working except that closure. Sadly, it doesn't give any error, php just dies.
What is the actual exception that is thrown?
I don’t know anything about IonCube either, but seems weird to me that it would be a specific problem with Filament.
Because IonCube is being loaded as an extension in php (zend_extension), it doesn't throw any exception. The PHP process just dies. I have several Filament Resources and all of them are working good, the only problem that I'm experiencing is in the unique closure of that TextInput.
I’m still failing to see where ioncube is relevant to the php process as it relates to filament.
ioncube is encoding all php code, closures act a bit different because I think that code is being compiled at runtime.
Ok, but php is interpreted at run time. Not sure I understand the difference.
Is there any other way to do that validation without using the closure?
->unique(callback: function (Unique $rule, callable $get) {
return $rule
->where('ip', $get('ip'))
->where('username', $get('username'));
}, ignoreRecord: true)
You’re using a double unique key, so no, it has to be done that way.
Search the help thread it’s been asked before.
This problem is solved now, I had to encode with --allow-reflection-all