CodeIgniter 3.0 Proposed Change: NULL v FALSE |
[eluser]Aken[/eluser]
[quote author="joelkallman" date="1335549876"]Since there are a lot of people who agree with changing FALSE to NULL, I must be missing some areas of CodeIgniter (or PHP) where NULL produces an amazing benefit. If you'd all be so kind, I'd love to hear your thoughts on the functional benefits of this change. [/quote] Phil went over this in his first post. Basically it's a better coding standard - using values that SHOULD be expected.
[eluser]skunkbad[/eluser]
So, has a decision been made? I took a quick glance at the input library and session library, and the changes seem simple. It would be great if you would come back to this thread and post a link to the commit when it has been done.
[eluser]GrahamDj28[/eluser]
When creating my own functions I always look at what it does. If it is a processing function I use TRUE/FALSE as return value to see if it was successful or not. If the function must return a variable then NULL is the way to go if there is none. I look at it like this: Reading/getting --> return VALUE/NULL Writing/saving --> return TRUE/FALSE
[eluser]theshiftexchange[/eluser]
+350 on returning NULL - I've just been debugging this exact issue for the past hour - because CI didnt perform as one would expect: Code: $_POST['value1'] = "test"; gives: Code: 'value1' => string 'test' (length=4)
[eluser]Phil Sturgeon[/eluser]
I think the majority of folks in here are in agreement. Alexis, I understand your worries, but there are a million things we could do to improve CodeIgniter and break the API but this seems like a tiny one. It's the only thing I want to fix for CI 3.0 which could cause any problems. While it is minor it will clean up so much of my code and fix a lot of bugs. I'll be happy to come to your office and spend a day or two upgrading your applications to CodeIgniter 3.0 (it would be nice to hang out again) but I will of course be charging my day rate!
[eluser]kanjimaster[/eluser]
+1. And wow, just look at how quickly a thread grows with it has "Codeigniter 3.0" in the title.
[eluser]CroNiX[/eluser]
Is the database going to return NULL instead of an empty array if no results are found?
[eluser]Phil Sturgeon[/eluser]
We can add that in too, sure. empty array() is pretty weird.
[eluser]Phil Sturgeon[/eluser]
For that last bugfix take a look at this, should do the trick: https://github.com/EllisLab/CodeIgniter/...d63ae79ab2 I'll test it further later (its in a branch for now). |
Welcome Guest, Not a member yet? Register Sign In |