CodeIgniter Forums

Full Version: Error after upgrading from beta1 to beta2
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello to all.
I am writing a new application on CodeIgniter 4,
everything was OK.
Manually updated from beta1 to beta2.
There was an error:
http://ai.ysu.su/ci4-errors.jpg
Please tell me how to fix the error?
Thank you in advance
What were you trying to do when the error occurred? Just loading the welcome page?
Have you tried disabling the DebugToolbar (app/Config/Filters.php)?
I load the main page of my application.
If you disable DebugToolbar (app / Config / Filters.php) then everything is fine the page loads without problems.
To enable debug mode, I add a line to /public/index.php:
define ('ENVIRONMENT', 'development');
In the version of beta1, everything worked without errors
Hmm - everything works fine for me, regardless of the mode.
How did you install your CI4? (manual, composer)
In manual mode - standard folders system public app writable.
Here is the full log:
CRITICAL - 2019-04-06 07:33:20 --> preg_match() expects parameter 2 to be string, array given
#0 [internal function]: CodeIgniter\Debug\Exceptions->errorHandler(2, 'preg_match() ex...', '/home/ysu.su/h/...', 144, Array)
#1 /home/ysu.su/h/system/Debug/Toolbar.php(144): preg_match('~[^\\x20-\\x7E\\t\\...', Array)
#2 /home/ysu.su/h/system/Debug/Toolbar.php(331): CodeIgniter\Debug\Toolbar->run(1554525200.6966, 0.0864, Object(CodeIgniter\HTTP\IncomingRequest), Object(CodeIgniter\HTTP\Response))
#3 /home/ysu.su/h/system/Filters/DebugToolbar.php(74): CodeIgniter\Debug\Toolbar->prepare()
#4 /home/ysu.su/h/system/Filters/Filters.php(176): CodeIgniter\Filters\DebugToolbar->after(Object(CodeIgniter\HTTP\IncomingRequest), Object(CodeIgniter\HTTP\Response))
#5 /home/ysu.su/h/system/CodeIgniter.php(346): CodeIgniter\Filters\Filters->run('/', 'after')
#6 /home/ysu.su/h/system/CodeIgniter.php(238): CodeIgniter\CodeIgniter->handleRequest(NULL, Object(Config\Cache), false)
#7 /home/ysu.su/h/public/index.php(37): CodeIgniter\CodeIgniter->run()
#8 {main}
Same problem detected!

My tests found the problem appear when I use "with('message', 'OK')" method in "return redirect()->back()" object;

I've manual install a new clean app and only change $baseURL on App config.

'Session' service and 'form' helper are enabled on BaseController.


PHP Code:
<?php namespace App\Controllers;

class 
Home extends BaseController
{
    
    public function 
index()
    {
        return 
view('welcome_message');
    }


    public function 
test()
    {
        if (
$this->request->getMethod() === 'post')
        {
            
//return redirect()->back(); GOOD
            
return redirect()->back()->with('message''OK'); //BAD
        
}

        return 
view('test');
    }




PHP Code:
<?= form_open() ?>
    <?= form_input(['type' => 'text''name' => 'input']) ?>
    <?= form_button(['type' =>'submit''content' => 'Submit']) ?>
<?= form_close
() ?>
(04-06-2019, 07:03 AM)elephpantech Wrote: [ -> ]Same problem detected!

My tests found the problem appear when I use "with('message', 'OK')" method in "return redirect()->back()" object;

I've manual install a new clean app and only change $baseURL on App config.

'Session' service and 'form' helper are enabled on BaseController.


PHP Code:
<?php namespace App\Controllers;

class 
Home extends BaseController
{
    
    public function 
index()
    {
        return 
view('welcome_message');
    }


    public function 
test()
    {
        if (
$this->request->getMethod() === 'post')
        {
            
//return redirect()->back(); GOOD
            
return redirect()->back()->with('message''OK'); //BAD
        
}

        return 
view('test');
    }




PHP Code:
<?= form_open() ?>
    <?= form_input(['type' => 'text''name' => 'input']) ?>
    <?= form_button(['type' =>'submit''content' => 'Submit']) ?>
<?= form_close
() ?>

The same problem. If  I use "redirect()->back()" and have $sessionDriver== 'CodeIgniter\Session\Handlers\DatabaseHandler' throws error.
If session is used with FileHandler there is no error.

Any ideea how to solve that?

Thanks!
Thank you very much. Everything is fixed.