-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
set_value does not work with NULL as second parameter #2935
Comments
I came across this validation rule that you guys have in your documentation permit_empty | No | Allows the field to receive an empty array, empty string, null or false. |
You should cast your variables: set_value('button', (string) $item['button']); But maybe if you send a PR with changes, they will be accepted. About |
Nice bro about the cast i didn't think about this. About permit_empty yeah you can, you just don`t add the input inside the form. I am sure this is a bug. But it is a weird one. |
I don't see a bug here, sorry. |
Ok man, so it is going to be like this for set_value forever right ? I mean if there is going to be changed with what i told you. Because i'm going to make this application that uses this and i'm not going to get back to it and change this set_value if i already made checks on every controller action when i update my CI4. I have at least 100 Controllers with 5 to 10 actions in each controller. |
Please think for a moment when you want to insert into database NULL values when you add an item. And you want to schedule the banner to appear in some interval then you have Date Start and Date End in form that are disabled by default and then only if you check a button then enables the inputs. How can i insert them with NULL if the set_value escapes the input and return emtpy. I always have t o check if the input is set and then get the value with set_value. How can i do this without using this code for example ?
|
I think it would be better to start a thread on our forum because it seems to me that this is more like a request for support than a bug. |
Hello. im getting this error
Argument 2 passed to set_value() must be of the type string, null given, called in
Yes i know it needs a string but in my database i have a lot of NULL values in columns.
This worked in Codeigniter 3, if it was null it just didn't do anything.
I have to make if case for each input values just to check if it is null or not just to make it work like seriously ?
I am just asking if you guys let it like this forever or it will be changed in near future.
While $item comes from Database and it is a NULL value.
set_value('button', $item['button']);
The text was updated successfully, but these errors were encountered: