Welcome Guest, Not a member yet? Register   Sign In
  Like with Json field
Posted by: motoroller - 1 hour ago - Replies (1)

I can use where $builder->where("c.Owner->>'$.id'='$owner'", null, false);

how do same with like?


  Package for generating API Documentation
Posted by: vimkaf - 2 hours ago - Replies (2)

Hello Everyone,
I want to ask if there is a package to generate API documentation directly from code using docparams, annotations or attributes. A similar package would be https://scribe.knuckles.wtf/laravel for the laravel framework. It would be nice to do this in CI.
Thanks.


  Querybuilder select() parsing problems
Posted by: objecttothis - 2 hours ago - Replies (1)

CodeIgniter 4.5.1
PHP 8.2

PHP Code:
$builder $this->db->table('sales_items');
$builder->select("name, CONCAT(IFNULL(ROUND(percent, 2), 0), '%') AS percent, sales.sale_id AS sale_id, sales.foo AS subtotal");
$sub_query $builder->getCompiledSelect(false); 

Generates
Code:
SELECT `name`, CONCAT(IFNULL(ROUND(percent, 2), 0), '%') AS percent, `ospos_sales`.`ospos_``sale_id` AS `sale_id`, `ospos_sales`.`foo` AS `subtotal`
FROM `ospos_sales_items`

The QueryBuilder parser is incorrectly appending the database prefix to the column name sale_id and it's escaping the column moniker after the 'AS' keyword in the second and third column names.

If I add `false` as the 2nd parameter in the select() call

PHP Code:
$builder $this->db->table('sales_items');
$builder->select("name, CONCAT(IFNULL(ROUND(percent, 2), 0), '%') AS percent, sales.sale_id AS sale_id, sales.foo AS subtotal"false);
$sub_query $builder->getCompiledSelect(false); 

It generates
Code:
SELECT name, CONCAT(IFNULL(ROUND(percent, 2), 0), '%') AS percent, `sales`.`ospos_sale_id` AS `sale_id`, sales.foo AS subtotal
FROM `ospos_sales_items`

For some reason it didn't get the memo about not escaping because it still escaped part of the query and it's now adding the database prefix to the column name but NOT adding it to the table name.

I tried removing the aliasing from the query, but that had no effect on the problems.

Removing the CONCAT SQL function call gets rid of the problems with prepending the prefix to the column but not the escaping problem

PHP Code:
$builder $this->db->table('sales_items');
$builder->select("name, sales.sale_id AS sale_id, sales.foo AS subtotal"false);
$sub_query $builder->getCompiledSelect(false); 

yields

Code:
SELECT name, `sales`.`ospos_sale_id` AS `sale_id`, sales.foo AS subtotal
FROM `ospos_sales_items`

Why is QueryBuilder->select() escaping these column and table names when the 2nd parameter of select is false?

Even wrapping the contents of the select() in a RawSql() instance still has it prepending the prefix in the wrong places.


  As experienced web developer what is the cause of this issue?
Posted by: luckmoshy - 6 hours ago - Replies (1)

In a browser experiment, I found this space
been looking for a way to ammend it from the app. of course app works well but if I experiment and see this space, I can't figure out how to solve this :

[Image: BwPfuO.jpg]


  Pagination is slow?
Posted by: xsPurX - Yesterday, 01:01 PM - Replies (1)

Hi,
I ran the pagination system and there is a 1-2 second delay to load my page now. Even though there is only a few records. Where without pagination it loads fast. The development debugger doesn't even show the delay.
Below is the debugger, but there is a delay in loading the page. So any ideas what could cause that? Clearly it;'s loading the data and everything quickly, so,not sure why there is a 1-2 second pause before the page loads.

Code:
Bootstrap Timer 54.04 ms
Routing Timer 1.74 ms
Before Filters Timer 0.07 ms
Controller Timer 54.75 ms
Controller Constructor Timer 38.81 ms
Query Database 0.26 ms
Event: dbquery Events 0.01 ms
Query Database 0.18 ms
Event: dbquery Events 0.01 ms
View: /themes/admin/layouts/layout.php Views 15.01 ms
After Filters Timer 0.94 ms

In contrast I have another sytem using codeigniter 2, and its loading 130,000 records in less than a second. Using pagination from CI2. So there has to be something wrong about the new pagination?


  Integrating Bootstrap 5 into a CodeIgniter 4 Application
Posted by: tarcisiodev1 - 04-26-2024, 05:17 PM - Replies (3)

What is the best way to integrate Bootstrap 5 into a version controlled Ci 4 Application? How can I integrate Sass and Bootstrap to compile new classes and variables in the best way?


  Modify users data as an admin
Posted by: padam - 04-26-2024, 01:51 PM - Replies (4)

I have installed Shield in my project. As an admin in the backoffice I would like to be able to modify user data if necessary. Can anyone give me an example of how this can be done? I used to write the Validation Rules in the model for every table, but for users there are two tables


  Asset Minification Packages for CodeIgniter
Posted by: tarcisiodev1 - 04-26-2024, 01:30 PM - Replies (2)

What is the most recommended asset minification package for use in CodeIgniter projects? I'm looking for a reliable and easy-to-use solution to minify my CSS and JS files.


  Error / Shield 1.0.3 + Ci 4.5.1
Posted by: kcs - 04-26-2024, 07:34 AM - Replies (6)

Hi everyone,

I followed the documentation proceeding to the installation running the composer command and the php spark setup. I can see the expected files and routes have been added to my application, but when I access /register or /login, I get this error:

Code:
Call to undefined function CodeIgniter\Shield\Authentication\Authenticators\setting()
VENDORPATH/codeigniter4/shield/src/Authentication/Authenticators/Session.php at line 685

Am I missing something? or running into a bug?

@kenjis I know you are working actively on this, thanks Smile I don't want to immediately raise an issue if that's not one, but rather a dumb thing on my end, but let me know if I should


Question Validation | trim causes 500: Internal Server Error
Posted by: Gary - 04-26-2024, 05:09 AM - Replies (2)

Having recently upgraded from v4.4.4 to v4.5.1, I'm finding that the trim "rule" in Validation is behaving differently.

The particular problem I've experienced is, under certain conditions (when Validation is used on POST data), it is now throwing the following 500 error when the particular parameter isn't - for any number of reasons, including malicious - in the POST data... and appears to now being considered null (vs ''):


Code:
 type    "TypeError"
 code    500
 message    "trim(): Argument #1 ($string) must be of type string, null given"
 file    ".../system/Validation/Validation.php"
 
 
Having had a brief scratch around in the system files... this new behaviour is likely fallout from strict_types=1 being liberally scatted throughout the v4.5.1 code.  Although a I'd agree that (generally) a null is likely a better description of a variable that hasn't been declared, if it's a given/known requirement that this "information" has to be passed as a string from $_REQUEST (it appears that most of the Validation is/has been based on strings types, likely for this same reason), then an empty string ('') makes better sense... however, I digress.

Given that strict_types=1 now, looking at the system code, it would appear that the trim function is done automatically/implicit and applied to all data being passed to Validation, which appears to check for and handle null as an argument (though I'm not sure this is applicable to ALL rules and/or arguments being passed to Validation and am therefore reluctant to simply remove every "trim" from all my encyclopedia of rules).

Another reason I suspect that trim is done implicitly is that I don't see "trim" listed under the Available Rules in the documentation any more (if it ever was?).  To be fair, I don't recall where I initially picked up the "trim" rule from, but it's been in my rules since CI was still a .rc, and has never given any problems (and maybe it's been a waste of time, if it was already happening implicitly?).

I'm setting the particular rules as follows (in .../Config/Validation.php):


Code:
 public $rule = [
         'range' => [
             'label' => 'Validation.search.range.label',
             'rules' => 'trim|max_length[...',
             'errors' => [
                 'max_length' => 'Vali...
 
 
Given that it's particularly easy for users to tamper with the POST data... or remove arguments or default empty (but not null) variables... is it now necessary to check every argument for existence PRIOR to invoking Validation?... or can one simply remove the trim "rule" and hope for the best?


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

Username
  

Password
  





Latest Threads
Package for generating AP...
by vimkaf
2 minutes ago
As experienced web develo...
by InsiteFX
16 minutes ago
Integrating Bootstrap 5 i...
by InsiteFX
23 minutes ago
Like with Json field
by Bosborne
36 minutes ago
Bug with sessions CI 4.5....
by Bosborne
42 minutes ago
Querybuilder select() par...
by kenjis
1 hour ago
Pagination is slow?
by InsiteFX
6 hours ago
Error / Shield 1.0.3 + Ci...
by kcs
Yesterday, 12:51 AM
Defining extra constants ...
by InsiteFX
04-27-2024, 10:57 PM
Validation | trim causes ...
by Gary
04-27-2024, 03:24 PM

Forum Statistics
» Members: 85,713
» Latest member: animationiconic
» Forum threads: 77,592
» Forum posts: 376,056

Full Statistics

Search Forums

(Advanced Search)


Theme © iAndrew 2016 - Forum software by © MyBB