Welcome Guest, Not a member yet? Register   Sign In
  Updating ci with composer problem with shield's route
Posted by: pippuccio76 - 03-04-2025, 01:21 PM - Replies (8)

HI , i have this error :
Call to a member function routes() on null
at APPPATH/Config/Routes_gestionale.php:19
 this is my Route.php :

Code:
<?php

use CodeIgniter\Router\RouteCollection;

/**
* @var RouteCollection $routes
*/

require 'Routes_vetrina.php';


require 'Routes_gestionale.php';

and this is my Routes_gestionale.php

Code:
<?php






############################################################################################################
############################################################################################################
#                                      GESTIONALE
############################################################################################################
############################################################################################################

/*
    * --------------------------------------------------------------------
    * AUTH
    * --------------------------------------------------------------------
    */
service('auth')->routes($routes); //line 19
How can isolve it ?


  tool bar not showing
Posted by: arcmax98 - 03-04-2025, 07:46 AM - Replies (1)

installed codeigniter 4.6 on windows computer... using php spark ...
env file

Quote:CI_ENVIRONMENT = development
app_baseURL = 'http://localhost:8080/'
config/App.php
Quote:public string $baseURL = 'http://localhost:8080/';
the actual directory is 'http://localhost:8080/ci4/' - but for some reason this works http://localhost:8080/ takes me to my index.php -> http://localhost:8080/ci4/index.php
created the files the routes ... everything seems to work
the filters has the toolbar $globals after and $required after
i just cannot see the debug bar...
what am i doing wrong ?


  URI routing from CLI
Posted by: Fido L Dido - 03-04-2025, 06:46 AM - Replies (2)

I'm encountering an issue with a route when calling it from the CLI. I think this may very well be a feature rather than a bug!
I have a cli method which expects 3 parameters all as strings. This is the route:

PHP Code:
$routes->cli('cli/postbyid/(:segment)/(:segment)/(:any)''Cli::postbyid/$1/$2/$3'); 

By and large this works, except when the third string contains characters that normally wouldn't be permitted by ar URI. For example:
Code:
php index.php cli param1 param2 param3(b)

The brackets in the third parameter cause an exception to be thrown:
Code:
CodeIgniter\HTTP\Exceptions\BadRequestException: The URI you submitted has disallowed characters: "param3(b)"

I can see that this is correct behaviour for security reasons when specifying URIs, but a CLI parameter isn't a URI.
I've tried adding a custom placeholder permitting *any* characters at all, but this still throws the same error as I suspect it is still restricted by config/App.php. Hopefully I've explained this in a way that it can be understood. I think CI is performing as designed, but is creating an unnecessary restriction for CLI access. I suspect the solution is for CLI access to ignore character restrictions on URIs, or that any custom placeholder should not be restricted by the characters specified in the config.

Edit: I'm using CI 4.6.0


  Hard Delete when useSoftDeletes = true;
Posted by: [email protected] - 03-03-2025, 01:35 PM - Replies (1)

Is there anyway to physically delete a database record when usesoftdeletes == true?  Can usesoftdeletes be overidden temporarily?
Thank you!


  Honeypot causing error
Posted by: frocco - 03-03-2025, 12:58 PM - Replies (5)

Hello,

I enabled honeypot in config and now get this error when saving a record

Code:
if (!$record->hasChanged()) {

            return redirect()->back()
                ->with('warning', lang('App.messages.no_change'))
                ->withInput();
        }

        $record->page_url = url_title($record->page_title, '-');

        if ($this->page->protect(false)
            ->save($record)
        )

Unknown column 'honeypot' in 'field list'

I had to add unset to resolve this.

Code:
$post = $this->request->getPost();
        unset($post['honeypot']);
        $slider->fill($post);


  Update CI to last version problem with multiple db
Posted by: pippuccio76 - 03-03-2025, 01:12 AM - Replies (2)

Hi , i updated a project to last version.
In this project i use two db , but in this versione hi have this error: 

Code:
CRITICAL - 2025-03-03 07:05:15 --> CodeIgniter\Exceptions\InvalidArgumentException: "magazzinoes" is not a valid database connection group.

this is env file :

Code:
database.default.hostname = localhost
database.default.database = stampa_etichette_zebra
database.default.username = ****
database.default.password = ****
database.default.DBDriver = MySQLi
#database.default.DBPrefix =
database.default.port = 3307
//db magazzino es per i materiali
database.magazzinoes.hostname = localhost
database.magazzinoes.database = my_magazzinoes
database.magazzinoes.username = ****
database.magazzinoes.password = ****
database.magazzinoes.DBDriver = MySQLi
database.magazzinoes.port = 3307
And in my model : 
Code:
<?php

  namespace App\Models;

  use CodeIgniter\Model;


  class MaterialeModel extends Model {
   
    //SCELGO  IL DATABASE DEL MAGAZZINO PER RECUPERE I MATERIALI     
    protected $DBGroup = 'magazzinoes'; // default database group
How can i solve it ?

HI , with multiple db it's not enough to insert it into the env file but we have to add it in App\Config\Database
In my case : 
Code:
    /**
    * The default database connection.
    *
    * @var array<string, mixed>
    */
    public array $default = [
        'DSN'          => '',
        'hostname'    => 'localhost',
        'username'    => '',
        'password'    => '',
        'database'    => '',
        'DBDriver'    => 'MySQLi',
        'DBPrefix'    => '',
        'pConnect'    => false,
        'DBDebug'      => true,
        'charset'      => 'utf8mb4',
        'DBCollat'    => 'utf8mb4_general_ci',
        'swapPre'      => '',
        'encrypt'      => false,
        'compress'    => false,
        'strictOn'    => false,
        'failover'    => [],
        'port'        => 3307,
        'numberNative' => false,
        'foundRows'    => false,
        'dateFormat'  => [
            'date'    => 'Y-m-d',
            'datetime' => 'Y-m-d H:i:s',
            'time'    => 'H:i:s',
        ],
    ];
   
   
   
        /**
    * Database per revuperare i materiali dal database magazzino es.
    *
    * @var array<string, mixed>
    */
   
   
    public array $magazzinoes = [
        'DSN'          => '',
        'hostname'    => 'localhost',
        'username'    => '',
        'password'    => '',
        'database'    => '',
        'DBDriver'    => 'MySQLi',
        'DBPrefix'    => '',
        'pConnect'    => false,
        'DBDebug'      => true,
        'charset'      => 'utf8mb4',
        'DBCollat'    => 'utf8mb4_general_ci',
        'swapPre'      => '',
        'encrypt'      => false,
        'compress'    => false,
        'strictOn'    => false,
        'failover'    => [],
        'port'        => 3307,
        'numberNative' => false,
        'foundRows'    => false,
        'dateFormat'  => [
            'date'    => 'Y-m-d',
            'datetime' => 'Y-m-d H:i:s',
            'time'    => 'H:i:s',
        ],
    ];


  feat: Separate unused lists in classes
Posted by: ozornick - 03-03-2025, 12:11 AM - No Replies

Hi. Don't you think that some of the infrequently used data in classes can be optimized?
For example, in the Entity, DataCaster:

Code:
private defaultCastHandlers -> array (15)
array => string (33) "CodeIgniter\Entity\Cast\ArrayCast"
...
I think it's redundant to have 1000 copies of a list in 1000 entities. At least it affects memory. Can we put this in a separate class, enum?
I add class and replace instance DataCaster (this is not a complete solution.):
PHP Code:
class CastHandlers {
    public const array DefaultCastHandlers = [
        'array'    => ArrayCast::class,
        // ...
    ];
}

public function 
__construct(?array $data null)
{
    $this->dataCaster = new DataCaster(
        array_merge(CastHandlers::DefaultCastHandlers$this->castHandlers),
        null,
        null,
        false,
    );
    // ...


A quick test shows an improvement of 15-25% (appstarter on build-in server, opcache, PHP 8.4.4):
Before: 100ms 5.641 MB
After: 81ms  4.904 MB, 72ms  4.904 MB

The difference between 21 entities and 42 is the same:
Before: 180ms 10.300 MB
After: 156ms 8.880 MB


  integrating parcel.js
Posted by: sQg - 03-01-2025, 04:16 PM - Replies (2)

Hi,
I'm a complete newbie to CI and looking forward to using it in my first project. Just wondered if there is any support for using it with Parcel.js bundler or maybe webpack though I'd prefer parcel.


  Should CodeIgniter Shield include customizable view Tags for user access?
Posted by: datamweb - 02-28-2025, 10:37 PM - No Replies

Hey everyone!

I’m considering adding a new feature to CodeIgniter Shield that allows customizable view tags for user access and status checks. Before proceeding, I’d love to hear your thoughts!

If you have a moment, please participate in the poll to help determine whether this feature would be useful. Your feedback is greatly appreciated!

Poll link.

Thanks in advance!?


  How to fix codeigniter 4.6 run xampp with php 8.4.4
Posted by: startup - 02-28-2025, 09:36 PM - Replies (6)

today i test codeigniter 4.6 on xampp with php 8.4.4 , it show error below:

Code:
Fatal error: Uncaught Error: Call to undefined function CodeIgniter\Autoloader\mb_strpos() in E:\HELPER\SERVER\XAPP8212\htdocs\upload\landsoft\vendor\codeigniter4\framework\system\Autoloader\FileLocator.php:292 Stack trace: #0 E:\HELPER\SERVER\XAPP8212\htdocs\upload\landsoft\vendor\codeigniter4\framework\system\Config\BaseService.php(417): CodeIgniter\Autoloader\FileLocator->findQualifiedNameFromPath() #1 E:\HELPER\SERVER\XAPP8212\htdocs\upload\landsoft\vendor\codeigniter4\framework\system\Config\BaseService.php(330): CodeIgniter\Config\BaseService::buildServicesCache() #2 E:\HELPER\SERVER\XAPP8212\htdocs\upload\landsoft\vendor\codeigniter4\framework\system\Config\BaseService.php(315): CodeIgniter\Config\BaseService::serviceExists() #3 E:\HELPER\SERVER\XAPP8212\htdocs\upload\landsoft\vendor\codeigniter4\framework\system\Config\BaseService.php(202): CodeIgniter\Config\BaseService::__callStatic() #4 E:\HELPER\SERVER\XAPP8212\htdocs\upload\landsoft\vendor\codeigniter4\framework\system\Common.php(1000): CodeIgniter\Config\BaseService::get() #5 E:\HELPER\SERVER\XAPP8212\htdocs\upload\landsoft\vendor\codeigniter4\framework\system\Boot.php(263): service() #6 E:\HELPER\SERVER\XAPP8212\htdocs\upload\landsoft\vendor\codeigniter4\framework\system\Boot.php(55): CodeIgniter\Boot::setExceptionHandler() #7 E:\HELPER\SERVER\XAPP8212\htdocs\upload\landsoft\index.php(56): CodeIgniter\Boot::bootWeb() #8 {main} thrown in E:\HELPER\SERVER\XAPP8212\htdocs\upload\landsoft\vendor\codeigniter4\framework\system\Autoloader\FileLocator.php on line 292
can someone show me fix?
thank your for your helping


Welcome, Guest
You have to register before you can post on our site.

Username
  

Password
  





Latest Threads
Ajax post failing with Ty...
by vitnibel
9 hours ago
MVC vs MVCS vs CodeIgnite...
by FlavioSuar
Yesterday, 10:33 AM
CodeIgniter Shield 1.0.0 ...
by timesprayer
Yesterday, 05:22 AM
Website Traffic Drop Afte...
by InsiteFX
Yesterday, 04:23 AM
Magic login link not work...
by InsiteFX
Yesterday, 04:16 AM
Is codeigniter 5 upco...
by InsiteFX
Yesterday, 04:10 AM
CI4 Auto-Discovery not wo...
by InsiteFX
05-09-2025, 11:04 PM
Why PHP is still worth le...
by InsiteFX
05-09-2025, 10:55 PM
Any user guid or video o...
by msnisha
05-09-2025, 02:30 PM
Why Every Programmer Need...
by Yetkiliteknikservis
05-09-2025, 01:49 PM

Forum Statistics
» Members: 145,247
» Latest member: Dizihastasi
» Forum threads: 78,385
» Forum posts: 379,434

Full Statistics

Search Forums

(Advanced Search)


Theme © iAndrew 2016 - Forum software by © MyBB