Comments (7)
This is not a bug.
Important
Using this feature when the prerequisites are not met will prevent CodeIgniter from operating properly. Do not use this feature in such cases.
Read https://codeigniter4.github.io/CodeIgniter4/concepts/factories.html#prerequisite
from codeigniter4.
Use new Mimes()
instead of config('Mimes')
.
Because config()
is slow., there is no benefit to use config()
for Mimes
.
Also, Mimes
extending BaseConfig
makes the instantiation of Mimes
very slow.
That is not the way to go.
from codeigniter4.
Either way, codeigniter factories does not work out-of-the-box with Config/Mimes.php, because it does not implement __set_state()
From your link to the docs: "By default, every Config class that is cached must implement __set_state() method."
So one would expect that the default implementation of Config/Mimes.php should implement __set_state() no?
from codeigniter4.
Either way, codeigniter factories does not work out-of-the-box with Config/Mimes.php, because it does not implement __set_state()
True, you cannot use Config caching with Config\Mimes
.
It is intentional, because we don't need to cache it.
So one would expect that the default implementation of Config/Mimes.php should implement __set_state() no?
No.
It means, if you want to cache a Config class instance, the class must implement __set_state() method. Config\Mimes
does not implement it, so you cannot cache it by default.
If the explanations in the user guide are not clear, please read the source code and understand how the Config caching works, and provide suggestions for improvement.
Config cache is an additional feature for experts who need any better performance.
We recommend that users who cannot troubleshoot on their own not use it.
Also, if you use caching, we recommend that you measure whether the caching is really effective.
from codeigniter4.
So, if Config/Mimes doesn't need to be cached, then why is it being included by default when enabling config caching?
Its common sense that if one enables a feature in the framework, one would expect it to work with its own default system files. I did not explicitly configure it to cache Config/Mimes, it does it on its own, out-of-the-box. Which breaks.
I would simply update the user guide to say: "Enabling this will not work by default, You have to manually override Config/Mimes and add __set_state method yourself"
from codeigniter4.
So, if Config/Mimes doesn't need to be cached, then why is it being included by default when enabling config caching?
It is not included by default. You intentionally did it by calling config('Mimes')
.
Enabling this will not work by default, You have to manually override Config/Mimes and add __set_state method yourself
This is incorrect. You should not cache it. In other words, you should not call config('Mimes')
. If you do not call config()
, Config/Mimes
has nothing to do with Config Caching.
from codeigniter4.
Fair enough, makes sense. Thanks for your patience
from codeigniter4.
Related Issues (20)
- DB BaseBuilder Join() - RawSql as table HOT 1
- Bug: speed bug HOT 5
- Bug: Time loses microseconds HOT 8
- ContentSecurityPolicy::setReportURI() shoud accept null values HOT 3
- Bug: valid_email is not working with permit_empty rules HOT 2
- Bug: Validation rule `differs` or `matches` fails if rule applied on array data HOT 3
- Bug: Preload issues HOT 1
- Dev: PHP 8.4 support HOT 14
- "CodeIgniter\Debug\ExceptionHandler::handle" show error condition add "CI_DEBUG" suggest HOT 13
- Bug: failed tests on tests/system/Commands/ConfigurableSortImportsTest.php HOT 8
- Bug: Truncated email subject when contains accented characters HOT 2
- Bug: [Model] `$afterUpdate` callback, returned ID is null. HOT 5
- Bug: `is_unique` rule specification HOT 2
- Bug: return 404 if request only headers HOT 2
- Bug: IDE warnings on static::getSharedInstance() return type mismatch HOT 2
- Bug: json-array type error, for model field casting HOT 2
- Bug: Am getting an error when installing composer dependencies HOT 1
- Dev: upgrade php-cs-fixer to 3.63
- Bug: Constant "MYSQLI_STORE_RESULT" is not defined in the CodeIgniter 4 project, causing an error in the MySQLi database HOT 2
- Bug: auto_link() fails to include trailing slashes in URLs HOT 13
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 codeigniter4.