php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #81534 Math Functions are not working on SQLITE connection.
Submitted: 2021-10-18 06:10 UTC Modified: 2021-10-18 08:13 UTC
Votes:2
Avg. Score:4.0 ± 1.0
Reproduced:2 of 2 (100.0%)
Same Version:2 (100.0%)
Same OS:1 (50.0%)
From: iyashpal dot dev at gmail dot com Assigned:
Status: Open Package: SQLite related
PHP Version: 8.0.11 OS: Windows 11, 10
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: iyashpal dot dev at gmail dot com
New email:
PHP Version: OS:

 

 [2021-10-18 06:10 UTC] iyashpal dot dev at gmail dot com
Description:
------------
PHP Version: 8.0.11
OS Edition: Windows 11 Pro
OS Version: 21H2
OS Build: 22000.258

PHP Framework Used: Laravel 8.63
 

Test script:
---------------
Route::get('/', function () {

    $sqlite = new SQLite3(base_path('sqlite3.dbi'), SQLITE3_OPEN_READWRITE);


    dd($sqlite->query('SELECT SQRT(4)'));
    dd(DB::select("SELECT SQRT(4)"));
    return view('welcome');
});

Expected result:
----------------
Should show 2

Actual result:
--------------
ErrorException
SQLite3::query(): Unable to prepare statement: 1, no such function: SQRT

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2021-10-18 06:16 UTC] iyashpal dot dev at gmail dot com
-Operating System: Windows 11 +Operating System: Windows 11, 10
 [2021-10-18 06:16 UTC] iyashpal dot dev at gmail dot com
PHP files were downloaded from this link : https://windows.php.net/download#php-8.0

I have tested this on Windows 10 Pro and 11 Pro.
 [2021-10-18 06:17 UTC] requinix@php.net
-Package: PDO SQLite +Package: SQLite related
 [2021-10-18 08:13 UTC] cmb@php.net
-Type: Bug +Type: Feature/Change Request
 [2021-10-18 08:13 UTC] cmb@php.net
These functions need to be explicitly enabled when building
SQLite3[1], what has not been done so far.  Are these usually
available on other systems?

[1] <https://www.sqlite.org/lang_mathfunc.html>
 [2021-10-21 01:36 UTC] iyashpal dot dev at gmail dot com
On a mac, it's working fine without extra effort. On Linux, working smoothly without any extra effort.
 [2021-10-21 01:46 UTC] iyashpal dot dev at gmail dot com
The thing is I am not aware of how I can enable the sqlite3 math functions. I have tried to replace the sqlite3 extension but PHP isn't working with it. I don't know I have done this wrong way or not but it wasted my 2 days. When I am unable to fix this, I came here to find a solution but no luck. Then I posted this issue here. I don't think this is a bug but maybe there should be some guidelines on the official documentation how we can deal with such problems. I am not able to find a perfect solution on the web. You are the only hope here. I can't proceed with my Test Driven Development with php sqlite3. Please help me. And I am sorry for the late reply because I thought this issue won't get anyone's attention because this is not a bug.

Please help me with a solution. I will be very greatful for this help.

Thank You
Yash Pal
 [2021-10-21 09:58 UTC] iyashpal dot dev at gmail dot com
If I try to compile the sql php showing this error.

PHP Warning:  PHP Startup: Can't load module 'C:\Users\<user-name>\.php\8.0\ext\php_sqlite3.dll' as it's linked with 2.37, but the core is linked with 14.29 in Unknown on line 0
 [2021-10-21 10:48 UTC] iyashpal dot dev at gmail dot com
Can anyone help me here?
 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Wed Dec 08 10:03:35 2021 UTC