ion_auth library syntax error, unexpected ',' - codeigniter

i am using ion auth library in codeigniter when i integrated it and accessing from localhost it showing me error as mentioned in image.
when i opened the library code line 141 the code is:
$user = $this->where($identifier, 'ion_auth'), $identity)->where('active', 1)->users()->row(); //changed to get_user_by_identity from email
now my question is the ) symbol after 'ion_auth' is ok or wrong? when i removes this library code works fine.

This has been fixed. Please pull the latest code from github.

I am not sure what you are trying to do, assuming you are the one who modified the library.
$this->where($identifier, 'ion_auth'), $identity)
The where method call is terminated by the parenthesis that follows 'ion_auth'.
This would be legal
$this->where($identifier, 'ion_auth') ->where('active', 1)->users()->row();
Assuming that is what you want.

this issue was exist when i downloaded library but later after mentioning here Ben Edmunds has updated code and now the correct code is
$user = $this->where($identifier, $identity)->where('active', 1)->users()->row();
at line 141 which is working for me.

Related

Call to undefined function _()

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

Session return null anyway

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.

SimplePie document parse error

I am trying to implement Simplepie in my laravel application to parse feeds, but when I do, I get this error:
This XML document is invalid, likely due to invalid characters. XML
error: Not well-formed (invalid token) at line 1, column 1
The feed is this one: https://www-304.ibm.com/connections/blogs/roller-ui/rendering/feed/PSIRT/entries/atom?search=cn4093&t=entry&f=all&lang=en_us and it works great in the demo app, but fails locally.
Here what I am doing:
$feed = new SimplePie();
$feed->set_feed_url("https://www-304.ibm.com/connections/blogs/roller-ui/rendering/feed/PSIRT/entries/atom?search=cn4093&t=entry&f=all&lang=en_us");
$feed->enable_cache(true);
$feed->set_cache_location(storage_path().'/cache');
$feed->set_cache_duration(60*60*12);
$feed->set_output_encoding('utf-8');
$feed->force_feed(true)
$feed->init();
Can someone help me ?
The issue seems to be because of the SSL (https) connection you are trying to load. Please read this: https://github.com/simplepie/simplepie/issues/236
It includes the fix to download the RSS using cURL and include it's result into the SimplePie class to parse.
UPDATE:
Read the comment by manishbhatias commented on 20 Jul 2011, on: https://github.com/simplepie/simplepie/issues/82
sharing the same issue you have. He believes it had something to do with the method SimplePie uses to urlencode parameters in the URL. You could create a proxy PHP script and see if that solves the issue for you.
<?php
echo file_get_contents('https://www-304.ibm.com/connections/blogs/roller-ui/rendering/feed/PSIRT/entries/atom?search=cn4093&t=entry&f=all&lang=en_us');
?>

Laravel 4: Whoops library and set_cookie function

I updated to the latest version of Laravel 4 using composer update. Now I'm having a problem with the error handling library it uses - Whoops. When I have an error in my code, for instance an syntax error the following happens:
I reload the page
The actual exception ('Unexpected xxxx at ...') appears for less than a second
Another exception replaces it:
Cannot modify header information - headers already sent by (output started at /Users/planewalker/Sites/jean/welper/vendor/filp/whoops/src/Whoops/Run.php:204)
The code at the above line is this:
// If we're allowed to, send output generated by handlers directly
// to the output, otherwise, return it so that it may be used by
// the caller.
if($this->writeToOutput()) {
echo $output;
}
return $output;
and more specifically the echo $output; part.
Does anyone know why this happens?
UPDATE:
I've now determined that the problem is caused by the set_cookie function in combination with the Whoops library's exception output. It seems that the set_cookie function is called after the Whoops library has started outputting its view.
The only solution I found was to use a different session driver that the 'cookie' one. I've switched to using 'native' and the problem does not appear anymore.
Have you edited the start.php or path.php for echoing debug informations. In the most cases this is the problem.
Because start.php is called before the errorhandler is called and in Laravel for every output headers are sent.
Try updating your Laravel 4:
composer update
This problem should be fixed and you would receive the first exception which is thrown.

Setting up Codeigniter HMVC with tank auth

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.

Resources