error_message does not work with php 8.1

Please report bugs and any annoyances here. Kindly include all possible details: steps to reproduce, expected result, actual result, screenshots, ... etc.
Post Reply
AhmedBR
AppGini Super Hero
AppGini Super Hero
Posts: 327
Joined: 2013-09-19 10:23

error_message does not work with php 8.1

Post by AhmedBR » 2022-07-16 19:31

I am using the following formula in before update:

Code: Select all

$chkCer=sqlvalue("select status from freight where `id` = {$data['freight']}",$eo);
if ( $chkCer =='Canceled'){$args['error_message'] = 'Alert: Canceled!';return FALSE;};
Works perfectly on 7.4, but does nothing in 8.1, as if the formula is not there.
Any idea what I should change in the formula to make it work in 8.1?

The funny part is I have other formulas almost same as this one (just different message), work on both.
I am just having hard time with this particular one, cannot see why it is not working!
Changing php from 8.1 to 7.4 it works, if I change back it stops!

thanks
AppGini 22.14 - xampp 3.3.0 - PHP 7.4.30 - Summary reports - Calendar - Mass update - Messages - AppGiniHelper

User avatar
jsetzer
AppGini Super Hero
AppGini Super Hero
Posts: 1814
Joined: 2018-07-06 06:03
Location: Kiel, Germany
Contact:

Re: error_message does not work with php 8.1

Post by jsetzer » 2022-07-16 19:49

Capital letter "v" in sqlValue(...) missing
Kind regards,
<js />

My AppGini Blog:
https://appgini.bizzworxx.de/blog

You can help us helping you:
Please always put code fragments inside [code]...[/code] blocks for better readability

AppGini 24.10 Revision 1579 + all AppGini Helper tools

AhmedBR
AppGini Super Hero
AppGini Super Hero
Posts: 327
Joined: 2013-09-19 10:23

Re: error_message does not work with php 8.1

Post by AhmedBR » 2022-07-16 20:22

thanks for the reply, tried V, but that did not work, and the others are the same, with small v.
AppGini 22.14 - xampp 3.3.0 - PHP 7.4.30 - Summary reports - Calendar - Mass update - Messages - AppGiniHelper

User avatar
jsetzer
AppGini Super Hero
AppGini Super Hero
Posts: 1814
Joined: 2018-07-06 06:03
Location: Kiel, Germany
Contact:

Re: error_message does not work with php 8.1

Post by jsetzer » 2022-07-17 00:49

You are right, I have just learned something new: function names are not case-sensitive in PHP.
Case sensitive

variables, constants, array keys, class properties, class constants

Case insensitive

functions, class constructors, class methods, keywords and constructs (if, else, null, foreach, echo etc.)
Kind regards,
<js />

My AppGini Blog:
https://appgini.bizzworxx.de/blog

You can help us helping you:
Please always put code fragments inside [code]...[/code] blocks for better readability

AppGini 24.10 Revision 1579 + all AppGini Helper tools

User avatar
jsetzer
AppGini Super Hero
AppGini Super Hero
Posts: 1814
Joined: 2018-07-06 06:03
Location: Kiel, Germany
Contact:

Re: error_message does not work with php 8.1

Post by jsetzer » 2022-07-17 00:55

Other Ideas:
  • Can you please check value of $chkCer and $args by var-dumping before return
  • We cannot see your function. Are you passing $args by reference?
    Can you please show the whole function TABLENAME_before_update
Kind regards,
<js />

My AppGini Blog:
https://appgini.bizzworxx.de/blog

You can help us helping you:
Please always put code fragments inside [code]...[/code] blocks for better readability

AppGini 24.10 Revision 1579 + all AppGini Helper tools

AhmedBR
AppGini Super Hero
AppGini Super Hero
Posts: 327
Joined: 2013-09-19 10:23

Re: error_message does not work with php 8.1

Post by AhmedBR » 2022-07-17 12:31

It is working now!
I have no idea what happened since I did not change a single letter.

Maybe 8.1.8 solved the problem, whatever that was (server PHP updated from 8.1)

that was the full function, nothing else is there actually:

<code>
function toll_before_update(&$data, $memberInfo, &$args) {
$chkCer=sqlvalue("select status from freight where `id` = {$data['freight']}",$eo);
if ( $chkCer =='Canceled'){$args['error_message'] = 'Alert: Canceled!';return FALSE;};

return TRUE;
}
</code>

Anyway, what I learned from this: if I have a formula that worked fine and just stopped for no reason check your PHP version before and after!
That my rule number one now.

Thanks JAN and have a nice day
AppGini 22.14 - xampp 3.3.0 - PHP 7.4.30 - Summary reports - Calendar - Mass update - Messages - AppGiniHelper

Post Reply