I have a CodeIgniter site that I just migrated from php4 to php5 and 1.7.2 => 2.0. Now I am getting this error:
Fatal error: Call to undefined function decrypt() in path_to_file/global/utility.php on line 7
Line in question:
$isAdmin = isset($login[3]) ? (decrypt($login[3])=="1" ? true : false) : false;
Any ideas?
It looks like it may be part of a helper of other library that you didn't port over. Tank_Auth and ion_auth utilize the built-in CI encryption methods so my guess is that someone created a custom decrypt function somewhere that has not been ported over or called in your new version. Perhaps there is a missing entry in your autoload config.
Also, you will likely need to re-encrypt the encrypted data as stated in the user guide encryption manual referenced by ajreal.
Related
Environment: Laravel Framework Lumen (8.2.2) (Laravel Components ^8.0)
When I run
$blogs = factory('App\Blog', 2)->create();
in BlogsControllerTest.php, it shows
Call to undefined function factory()
As Laravel's upgrade guide says the Model factory was changed.
The new way is like this App\Models\Blog::factory()->count(3)->create();
To use old version referrer to documentation.
However, to ease the upgrade process, a new laravel/legacy-factories package has been created to continue using your existing factories with Laravel 8.x
To install it use composer composer require laravel/legacy-factories
Answering my own question in case it helps somebody.
It works this way too.
$blogs = BlogFactory::new()->count(2)->create();
ref: laravel.com/docs/8.x/database-testing#connecting-factories-and-models
I am having trouble with this error,
ErrorException (E_ERROR)
Call to undefined function _() (View: C:\Codes\web-is\resources\views\layouts\client.blade.php)
and it is pointing in this code
<title><?php echo e(_('This is title')); ?></title>
I think it is in the _() of Laravel helper, but it should be working right.
I really do not know what is going on, there is a live server that working fine with the code. I just tried to clone the repo to my laptop and install necessary requirements such as PHP, IIS is my web server. I also sure that PHP extensions are installed, I can see it in phpinfo().
Any help will be appreciated. Thank you.
The default Laravel helper function to get translation string is __(), not _(). Note the two, double underscores __.
See this link; https://github.com/laravel/framework/blob/8.x/src/Illuminate/Foundation/helpers.php#L820
My project is using three different services and now I never can get sessions values, I've tried the laravel site tutorial and fallowing link question :
Laravel - Session returns null
But none of them worked!
In the first, i used this library:
use Session;
In a controller class :
$result = SocketHelper::sendRequest($req);
Session::put('uuid', $result->uuid);
Session::save();
Session::put('userId', $result->userID);
return Redirect::route('login_step_two');
In an other method :
$uuid = Session::get('uuid');
$userId = Session::get('userId');
But these are null! does I have to use cookie?
I recently upgrade to laravel 5.4
Please help me! It's made me confused!
Thanks.
Try saving Session explicitly like this, give it a try it worked for me, hope same for you.
Session::put('test_session', 'test message');
Session::save();
And retrieve it like this
echo Session::get('test_session');
And forget it like this:
Session::forget('test_session');
Session::save();
I understood the null result was becouse I was posting the value of $request to an other template and it was changed it the way :))) !
so easy to know !
Have you properly upgraded to laravel 5.4?
Laravel Docs
Sessions
Symfony Compatibility
Laravel's session handlers no longer implements Symfony's SessionInterface. Implementing this interface required us to implement extraneous features that were not needed by the framework. Instead, a new Illuminate\Contracts\Session\Session interface has been defined and may be used instead. The following code changes should also be applied:
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.
All calls to the ->getToken() method should be changed to ->token().
All calls to the $request->setSession() method should be changed to setLaravelSession().
Do you still have the rights to write session files in php session directory ?
Check the path returned by session_save_path() and check if your php user has the rights to write in it, check also if there is files in the directory and what are their creation date.
I installed Smarty in Codeigniter and it's not really working. Here is what I did:
I followed this instructions:
http://sunwebexpert.com/books/detail/PHP/integrating-smarty-and-codeigniter.html
But I also put another file in the library: parser.php which is a library to do parsing (I've used it before with smarty and worked well)
the on Codeigniter's autoload.php wrote this:
$autoload['libraries'] = array('parser','smarty');
On main controller I wrote this function to test:
public function index()
{
$this->data['d'] = 2;
$this->parser->parse('base/test.tpl', $this->data);
}
but the result is no error display and I see the variable 'd' as it is wrote in the template:
{$d}
So I have two questions:
Why can't I see the variable value if I installed smarty as I did before in other projects?
How can I enable to see errors if there are?
The problem is that in codeigniter, there is a built-in library called Parser. That's why this may cause conflict with your library name. Try to rename your library name or use built-in library.
Here is how to display error on codeigniter.
Hope it will be useful for you.
I am having trouble getting a working Codeigniter version 2.0.3 with hmvc and tank auth(set up as a module) setup properly. I have installed CI properlly and then install HMVC with these directions https://bitbucket.org/wiredesignz/codeigniter-modular-extensions-hmvc/wiki/Home
I get to my welcome controller/view as example just fine which means the HMVC is working. Next I try to add tank auth to the project by adding it to a folder in the modules folder. It has the proper controller/view/model etc.. setup within the tank auth. I even added in routes something like
$route["auth"]="auth/login";
I also extended the controller within the auth module to MX_Controller like as directed. Also in the constructor I have :
$this->load->helper(array('form', 'url'));
$this->load->library('form_validation');
$this->load->library('security'); <--failing to load this
$this->load->library('tank_auth');
$this->lang->load('tank_auth');
$this->form_validation->CI =& $this;
It seems to be redirecting fine to the module however it comes up with an error saying ::
An Error Was Encountered
Unable to load the requested class: security
What am I doing wrong? Does any one have a working CI installation with HMVC and tank auth as a module so I can see how its done? I'm new to HMVC, thanks
I found the same problem, but i solved by simple adding a comment to the
$this->load->library('security');
so it will look like this:
//$this->load->library('security');
since security its now part of the codeigniter core, i guess its already loaded by default, and everything seems to be working pretty good
it is in Helper now according to CodeIgniter 3.0 user guide
try:
$this->load->helper('security');
I fix this, by creating Security.php file in application/libraries directory with the following code:
require_once(BASEPATH.'core/Security.php');
class Security extends CI_Security { }
I found a solution, I simply took the security.php file from codeigniters system/core folder and dropped it into system/libraries.
move the file security.php from system/core to system/libraries
then edit core/codeigniter.php line number 204 from $SEC =& load_class('Security', 'core'); to $SEC =& load_class('Security', 'libraries');
Security.php is present in "codeigniter/system/core/Security.php"
so provide this path your problem gets solved easily
load->library('../core/security');
I Read CodeIgniter 3.X User Guide and I was found that "Security" is available as a 'helper' Now.
So you need to change this;
$this->load->library('security');
into
$this->load->helper('security');
XSS Filtering
The Input class has the ability to filter input automatically to prevent cross-site scripting attacks. If you want the filter to run automatically every time it encounters POST or COOKIE data you can enable it by opening your application/config/config.php file and setting this:
$config['global_xss_filtering'] = TRUE;
You need to read a CodeIgniter 3.0 User Guide there are so many changes and implementation or please Refer change log.