After updating from laravel 5.3 to 5.4, I encountered an error in vendor. The error is:
Symfony\Component\Debug\Exception\FatalThrowableError: Call to undefined method Illuminate\Session\Store::set() in /var/www/ostadbank.com/vendor/laravel/framework/src/Illuminate/Support/Manager.php:137
But when I go to my error is:
fatal error exception in Manager.php line 137:call to undefined method Illuminate\session\store::set()
I go to manager.php line 137 and I see the line below:
public function __call($method, $parameters) { return $this->driver()->$method(...$parameters); }
I am not sure where to start to modify.
See the screenshots below:
I solve it, for more information read this: https://laravel.com/docs/5.4/upgrade
All calls to the ->set() method should be changed to ->put(). Typically, Laravel applications would never call the set method since it has never been documented within the Laravel documentation. However, it is included here out of caution.
Related
I have enabled mbstring in my php.ini.It even shows in phpinfo().But still I am getting this error in yii2.
PHP Fatal Error 'yii\base\ErrorException' with message 'Call to undefined function yii\helpers\mb_strlen()
As #TomaszKane said in comment, mb_strlen() is native PHP function, so you need to call it as mbstrlen() without specifying the namespace.
Official documentation:
mb_strlen()
Also take a look at yii\helpers\StringHelper, mb_strlen() is used in several places. For example, if you are looking for byte length, there is special method byteLength(), you can call it like that:
use yii\helpers\StringHelper;
...
StringHelper::byteLength($string);
It's basically syntactic sugar of mb_strlen().
I cannot find the cause of this error.
I have a model (school profile) that has a relation to another model (fields of study).
When I try to access the related model I get the error "Cannot declare class app\models\FieldOfStudy because the name is already in use"
I am not aware of using it anywhere else.
Relation code:
public function getFieldsOfStudy()
{
return $this->hasMany(FieldOfStudy::className(), ['fieldOfStudyId' => 'fieldOfStudyId'])
->viaTable('schoolProfileFieldOfStudyXref', ['schoolProfileId' => 'schoolProfileId']);
}
I am trying to access the related model like so:
$schoolProfile->fieldsOfStudy;
The thing that is particularly frustrating is that I use these same classes in another project. I have never seen this error. The error output indicates that the error is happening in the above hasMany function when it simply tries to load the class.
Any ideas?
I had a typo in the namespace declaration in the FieldOfStudy class. I got the idea to check it from this post: symfony2 fatal error Cannot redeclare class
The exact part of the post that helped out was:
"Here is a hint: check if you have accidentally deleted or typo:ed the namespace in the file that contains the definition of the class that php claims it is trying to re-define."
I'm getting the following error when creating a new record/model:
Uncaught Error: Attempted to handle event `willSetProperty` on <App.NewsItem:ember361:null> while in state rootState.loaded.created.inFlight. Called with {reference: [object Object], store: <App.Store:ember299>, name: bodyHTML}
What does it mean?
Seems to be caused by the application updating a property (called 'bodyHTML') on an instance of a model of type App.NewsItem while it is being saved (rootState.loaded.created.inFlight). I have no idea why I'm receiving the error on creation though.
Seems like either you are modifying an existing dirty object , or you are trying setting some property to undefined
see
http://coryforsyth.com/2013/06/10/the-willsetproperty-gotcha-in-ember-data-understanding-the-state-machine/
This is the code I have in Bootstrap:
public function _initRegistry()
{
$systemConfigModel = new Application_Model_DbTable_SystemConfig();
Zend_Registry::set('config', $systemConfigModel->getSystemConfig());
}
And this an exception I am getting:
( ! ) Fatal error: Uncaught exception 'Zend_Db_Table_Exception' with message 'No adapter found for Application_Model_DbTable_SystemConfig' in /usr/share/php5/Zend/Db/Table/Abstract.php on line 755
( ! ) Zend_Db_Table_Exception: No adapter found for Application_Model_DbTable_SystemConfig in /usr/share/php5/Zend/Db/Table/Abstract.php on line 755
It works just fine if I call it within my BaseController. It just looks like the PDO adapter that I specify in application.ini has not been initialized at the time Bootstrap is executed (strange?). What should I do to make the code work in Bootstrap? Is it necessary to create and set an adapter with Zend_Db_Table::setDefaultAdapter();?
I am asking because if the code is not in Bootstrap, it needs to be duplicated in two different places and it also kind of looks like it belongs to Bootstrap.
You are correct, during bootstrap, the Zend Application resource for your database has not yet been initialized.
Try changing your bootstrap method as follows so you explicitly bootstrap the db resource.
public function _initRegistry()
{
$this->bootstrap('db'); // Bootstrap the db resource from configuration
$db = $this->getResource('db'); // get the db object here, if necessary
// now that you have initialized the db resource, you can use your dbtable object
$systemConfigModel = new Application_Model_DbTable_SystemConfig();
Zend_Registry::set('config', $systemConfigModel->getSystemConfig());
}
Further to my adventures with Erlang and ErlyDB. I am attempting to get ErlyDB working with BeepBeep
My ErlyDB setup works correctly when run outside of the BeepBeep environment (see Debugging ErlyDB and MySQL). I have basically take the working code and attempted to get it running inside BeepBeep.
I have the following code in my controller:
handle_request("index",[]) ->
erlydb:start(mysql,Database),
erlydb:code_gen(["thing.erl"],mysql),
NewThing = thing:new_with([{name, "name"},{value, "value"}]),
thing:save(NewThing),
{render,"home/index.html",[{data,"Hello World!"}]};
When I call the URL, the response outputs "Server Error".
There is no other error or exception information reported.
I have tried wrapping the call in try/catch to see if there is an underlying error - there is definitely an exception at the call to thing:new_with(), but no further information is available.
The stacktrace reports:
{thing,new,[["name","value"]]}
{home_controller,create,1}
{home_controller,handle_request,3}
{beepbeep,process_request,4}
{test_web,loop,1}
{mochiweb_http,headers,4}
{proc_lib,init_p_do_apply,3}
Use pattern matching to assert that things work up to the call to thing:new/1:
ok = erlydb:start(mysql,Database),
ok = erlydb:code_gen(["thing.erl"],mysql),
You include only the stack trace, look at the exception message as well. I suspect that the error is that you get an 'undef' exception. But check that it is so. The first line in the stack trace indicates that it is a problem with calling thing:new/1 with ["name", "value"] as argument.
It is slightly odd that you show one clause of handle_request that is not calling home_controller:create/1 as per {home_controller,create,1} in the stack-trace. What do the other clauses in your handle_request/2 function look like?