Comments (12)
I think this should throw an exception instead than just return false. In fact it is not that provided data doesn't match validation, but it's the software that's broken since a component is missing.
I could bear with this since I'm working on form components.
from codeigniter.
I took a look into Form_validation library and current behavior is to log a debug message for non existent function without breaking execution.
It is not that desirable, actually, since this weaken validation, that should be strengthen instead. Someone from Reactor team on this?
from codeigniter.
I agree to throwing an exception. This current spec is too dangerous.
from codeigniter.
+1, throw exception.
from codeigniter.
@freewll, your hack does not throw an exception.
When this error happens, it is a bug. So I think error message for users is not required, only throwing an exception is enough. If you does not catch the exception, PHP fatal error occurs.
from codeigniter.
I don't think an exception is appropriate considering the current framework. I'm not aware of anywhere else in CI where an exception is thrown.
from codeigniter.
Actually I checked the core and exceptions are not the framework preferred instrument to raise errors. Still if I understand correctly, your fix simply logs an error message and nothing more.
It would be better to use show_error() helper, that mimic exceptions handling while remaining compatible with better error reporting tools such as Uh-Oh. As Kenjis pointed out, trying to call a non existent function should result in execution stop, both in framework and in language philosophy! :)
HTH.
from codeigniter.
FYI, here is a brief post that explains advantages of using CI's core error handling: http://www.derekallard.com/blog/post/error-handling-in-codeigniter
My bad, I thought to an Exception, but you're right: CI doesn't advocate exceptions. show_error() should be the right way to go. :)
from codeigniter.
You guys are right. But the article was written in 2007!
CI had supported PHP4 until before CI2.0, so there was no Exception, try/catch/throw.
If we throw Exception, we need to hear the policy about Exception from Reactor team and/or EllisLab.
from codeigniter.
Well, actually this is an issue with a lot of topics. Since last steering from Reactor team (all the github migration, Core and Reactor merging and various stuff) it seems a lot could change. But as far as I know there is no intention to drastically change the way CI behaves (that's one of the reasons that led to Fuel creation: they didn't feel changing the mindset of CI was right), so as far as I can tell, if coding guidelines are unavailable, the only thing to do is clone the repo and grep for "throw", "try" and "except" in system directory.
If nothing can be found, well, my bet is nothing is changed since 2007 on that side! ;)
from codeigniter.
I closed my pull request and agree with @stickgrinder that show_error() should be used instead.
from codeigniter.
I'll try to send a pull-req ASAP with a show_error() integration.
from codeigniter.
Related Issues (20)
- Deprecated Deprecations of Expected Exceptions HOT 1
- CodeIgniter + Session usage with Redis is slow HOT 4
- mysqli_driver version_compare issue CI 3.1.13
- Controller classes must exist as files (why??)
- Drop support for PHP < 8.1 HOT 10
- Crazy error, php-api/system/database/DB_driver.php --------> function escape($str) error HOT 4
- Email library does not send email through SMTP on PHP 8.2
- Upcoming deprecations in PHP 8.3 HOT 2
- Codeigniter 3.1.4 and PHP 8.1 HOT 4
- mysqli num_rows always return 0 HOT 1
- Session Lost for CI 3.1.13 on Page Refresh HOT 4
- Misleading docblock of the file_get_info function
- xss_clean % error HOT 1
- Bug: inconsistent behavior of Query Builder limit 0 HOT 8
- bug: codeigniter3 db->or_where_not_in(...) HOT 1
- Are there plans for CodeIgniter 3.1.14? HOT 2
- XSS when data is passed on to the web application via an API HOT 3
- only laravel HOT 1
- Upcoming deprecation of mt_rand()
- BUG: session_write_close(): Failed to write session data using user defined save handler. Localised with suggested fix HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from codeigniter.