-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug: [QueryBuilder] join() with BETWEEN causes TypeError preg_quote(): Argument #1 ($str) must be of type string, false given #8791
Comments
How do we reproduce? |
I probably did not phrase the bug report correctly. I have two SQL queries that have worked perfectly from CI version 4.0.x all the way through 4.4.8. Both of these queries are constructed using the Query Builder Class. Here are the lines from each Query Builder that appear to be throwing the type error:
The only common thread seems to be the use of the BETWEEN SQL operator. I'm not sure that has anything to do with it. It does seem to be an issue in Query Builder because it no longer puts together the query without throwing an error. It could simply be a strict typing issue like some of the other 4.5.0 bugs, but I will do some further troubleshooting. |
Thank you for the feedback. There is no sample code with We need further investigation. |
It seems When there is a conditon array (
0 => 'units.unit_id = leases.unit_id',
1 => 'CURDATE() BETWEEN lease_start_date',
2 => 'lease_exp_date',
) but it is of course wrong. Fixing this behavior is difficult, so I sent ad hoc fix PR #8792 |
Ahh, I understand now. I replaced the This project also has many |
There is one test case. CodeIgniter4/tests/system/Database/Builder/WhereTest.php Lines 198 to 210 in d425bdf
But note that uses false in the third parameter $escape :
If |
@oakhurstmgmt If you agree to merge #8792, approve the PR. |
PHP Version
8.3
CodeIgniter4 Version
4.5.1
CodeIgniter4 Installation Method
Composer (using
codeigniter4/appstarter
)Which operating systems have you tested for this bug?
Windows, Linux
Which server did you use?
apache
Database
MariaDB 11.2.3
What happened?
After upgrading to 4.5.0 and then 4.5.1, I am now getting TypeError preg_quote(): Argument #1 ($str) must be of type string, false given at SYSTEMPATH/Database/BaseBuilder.php at line 680 with some of my SQL queries. These queries all use the BETWEEN Operator to compare dates.
These queries worked perfectly fine going all the way back to CI 4.0.x up through 4.4.8.
Below is a screenshot of the error:
Steps to Reproduce
Execute an SQL query created using the Query Builder Class utilizing the BETWEEN operator.
Expected Output
A view with the results of the SQL query.
Anything else?
No response
The text was updated successfully, but these errors were encountered: