Skip to content
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

PHP8.2: Deprecated: Using ${expr} (variable variables) in strings is deprecated, use {${expr}} instead #59

Open
sovking opened this issue Sep 23, 2023 · 9 comments
Labels
enhancement New feature or request

Comments

@sovking
Copy link

sovking commented Sep 23, 2023

Recently I installed another instance of 123solar in a host where is running apache and php 8.2.
In php 8.2 the use of ${expr} is deprecated, and 123solar uses frequently this syntax. In my installation I corrected it, but it would be nice if this change will be implemented also in the main branch.

@jeanmarc77
Copy link
Owner

Hi,
Thanks for notifying, i don't code much these times. How to change ${'var' . $i} for example ?

@jeanmarc77
Copy link
Owner

jeanmarc77 commented Sep 30, 2023

echo "{${'var'.$i}}"; // works

if ({${'var'.$i}}) { // don't works
echo 'y';
}

@jeanmarc77
Copy link
Owner

ok with quote
if ("{${'var'.$i}}") {
echo 'ok';
}

@speeskeek
Copy link

Recently I installed another instance of 123solar in a host where is running apache and php 8.2. In php 8.2 the use of ${expr} is deprecated, and 123solar uses frequently this syntax. In my installation I corrected it, but it would be nice if this change will be implemented also in the main branch.

I dont know if I have the same issue? did your installation run on php 8.2? or did it stop?
can I get your (altered) files?

@hmakmur
Copy link

hmakmur commented Jan 29, 2024

Recently I installed another instance of 123solar in a host where is running apache and php 8.2. In php 8.2 the use of ${expr} is deprecated, and 123solar uses frequently this syntax. In my installation I corrected it, but it would be nice if this change will be implemented also in the main branch.

Would you please share your code changes so others can use it? I have upgraded my Ubuntu20.04 to Ubuntu 22.04 and now my 123solar wont work because my php is now version 8.x.

@hmakmur
Copy link

hmakmur commented Jan 30, 2024

Just for completeness, I reinstalled my software to latest and it seems to work with php 8.1.

@jeanmarc77
Copy link
Owner

BTW i use PHP 8.3.2 and it runs.
If someone have the willing to change all variables as mentioned Nov 1, 2023 as i don't have much times to do so, that's would be kind

@jeanmarc77 jeanmarc77 added the enhancement New feature or request label Mar 5, 2024
@NevilleDavis
Copy link

Hi I decide to try and check update for this problem with the deprecated variable structure. What I have done is in php.ini enabled the error to be logged on the production value, that is you get on a single pass on the script the line numbers of the code that the error exists...then edit those as required. The text with error is appearing in the upper section of the displayed page, I make notes of the line numbers. When you again enter that page you do not see those errors (until a change in script or the next start up etc.
This is the section of php.ini
; Common Values:
; E_ALL (Show all errors, warnings and notices including coding standards.)
; E_ALL & ~E_NOTICE (Show all errors, except for notices)
; E_ALL & ~E_NOTICE & ~E_STRICT (Show all errors, except for notices and coding standards warnings.)
; E_COMPILE_ERROR|E_RECOVERABLE_ERROR|E_ERROR|E_CORE_ERROR (Show only errors)
; Default Value: E_ALL
; Development Value: E_ALL
Production Value: E_ALL & ~E_DEPRECATED & ~E_STRICT
; https://php.net/error-reporting
error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT
All this is time consuming but I have managed 123 now to be error free...now to do meterN.

This is for those trying to find a simple way of finding the line numbers....just so many lines :)

I have been using 123 since 2013 and meterN since 2014 I think still going strong ...thanks Jeanmarc

@NevilleDavis
Copy link

It turned out to be easier than I thought by doing this method. I have both 123solar and meterN no longer having PHP report errors.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

5 participants