For example :
version 22.14 is compatible with php versions 7 or higher
version 5.95 is compatible with php versions 5
Where find that's info ?

Best Regards
AhmedBR wrote: ↑2022-08-26 15:11I do not think there is topic or link mentioning exactly what you need, BUT there is Change Log, and usually PHP version is mentioned when a specific version is required:
https://bigprof.com/appgini/release-log
[code]...[/code]
blocks for better readabilityCode: Select all
session_name("test_session");
session_start();
echo "<pre>\n";
echo "Session super global before saving now:\n";
print_r($_SESSION);
$_SESSION['now'] = date("Y-m-d H:i:s");
echo "Session super global after saving now:\n";
print_r($_SESSION);
echo "<\pre>\n";
sqlValue
, require a second, mandatory parameter now, which, when missing, did not break the application in the past but breaks it since PHP 8.WHATEVER. At least that is what I have seen.sqlValue
function calls.sqlValue
function calls already have that 2nd parameter. But in my own older code I've missed it several times.Code: Select all
$result = sqlValue('YOUR QUERY');
Code: Select all
$o = [];
$result = sqlValue('YOUR QUERY', $o);
SELECT
statements sqlValue
-function works fine but not for INSERT
, UPDATE
, DELETE
. For those I'm using sql('COMMMAND', $o);
[code]...[/code]
blocks for better readabilityYou're correct in the sense of the appgini auto generated code, but if there are any custom php files in your system you may need to adjust those as well, the workaround is to use an IDE like VScode to carefully search and inspect each occurrence, but that would require a lot of focus and functionality testing along the way.maryann-weekes wrote: ↑2024-02-29 16:33I do see some sqlvalue function calls without the second parameter in our 5.94 generated application. I will try the Appgini upgrade and hope that helps since it sounds like the newer Appgini generated code will have that second parameter.
Thank you for the help.
Mary Ann
Hmm ... interesting point. The second parameter tojsetzer wrote: ↑2024-02-29 12:11I just want to note that certain PHP functions, especially functionsqlValue
, require a second, mandatory parameter now, which, when missing, did not break the application in the past but breaks it since PHP 8.WHATEVER. At least that is what I have seen.
Most of the times a migrated, broken project works fine for me after updating allsqlValue
function calls.
In generated AppGini code allsqlValue
function calls already have that 2nd parameter. But in my own older code I've missed it several times.
May break:
Should work:Code: Select all
$result = sqlValue('YOUR QUERY');
Additionally, I have seen that forCode: Select all
$o = []; $result = sqlValue('YOUR QUERY', $o);
SELECT
statementssqlValue
-function works fine but not forINSERT
,UPDATE
,DELETE
. For those I'm usingsql('COMMMAND', $o);
sqlValue()
is an optional parameter that is populated by any error message resulting from the query. But it's optional, so if you don't pass that parameter, the function should work fine. The function is defined as follows in admin/incFunctions.php
:
Code: Select all
function sqlValue($statement, &$error = NULL) {
SELECT
query that should return a single row with a single column, and it returns the value from that single row/single column result. If you'd like to execute a non-SELECT
query, the sql()
function is more suited for this purpose.I've never seen or used a default value for a function argument that is passed by reference before. What would actually happen when that variable is assigned a new value? Is this defined by PHP explicitly?a.gneady wrote: ↑2024-03-05 20:22
Hmm ... interesting point. The second parameter tosqlValue()
is an optional parameter that is populated by any error message resulting from the query. But it's optional, so if you don't pass that parameter, the function should work fine. The function is defined as follows inadmin/incFunctions.php
:The main purpose of this function is to run aCode: Select all
function sqlValue($statement, &$error = NULL) {
SELECT
query that should return a single row with a single column, and it returns the value from that single row/single column result. If you'd like to execute a non-SELECT
query, thesql()
function is more suited for this purpose.
sqlValue('...')
lines as syntax errors.[code]...[/code]
blocks for better readabilityI tested the function under various versions of PHP and it worked without issues, but I'll re-investigate the case when the provided query causes an error. Thanks for the detailed feedback!dkano wrote: ↑2024-03-06 18:42I've never seen or used a default value for a function argument that is passed by reference before. What would actually happen when that variable is assigned a new value? Is this defined by PHP explicitly?
Maybe some versions of PHP 8.x don't handle the way you use the second parameter, when it isn't supplied? It looks like you assign to it without first checking if the optional parameter was supplied or not. Maybe it would be better to do something like:
if ($error != NULL) {
$error = whatever;
}
in an error condition, and drop the error return on the floor if the second parameter wasn't supplied.
In the PHP manual, it states:
"Note: Arguments that are passed by reference may have a default value."
But I don't see anywhere a definition of what happens if you assign to one. Before the above quote, they say they must be contants. But they can be non-scalar:
"Default parameter values may be scalar values, arrays, the special type null, and as of PHP 8.1.0, objects using the new ClassName() syntax."
Anyway, I'm going to add the second parameter to my calls, to be safe. I appreciate the heads up on that change jsetzer!
sqlValue()
under PHP 8.0, 8.1, 8.2 and 8.3 with the following scenarios and all of them passed without errors:
sqlValue('select 1') == 1
=> workssqlValue('select 1 from non_existent_table') === false
=> works$error = ''; sqlValue('select 1 from non_existent_table', $error); !empty($error)
=> workssqlValue('select 1 from non_existent_table', $error); !empty($error)
=> works$error
(2nd param) is defined or not, and whether the query causes an error or not, it's working fine. If I'm missing a use case not covered in above tests, please let me know.