plugins icon indicating copy to clipboard operation
plugins copied to clipboard

acme: small depreciation fix

Open sopex opened this issue 3 months ago • 10 comments

Creation of dynamic properties and the ${var} syntax have been deprecated since PHP 8.2

sopex avatar Sep 14 '25 21:09 sopex

I was going to put in an issue for this, but found this pull request.

It seems that if you have a version long enough and update enough times, a CRON job config may fail. This fix alleviates an error in SettingsController.php that actually prevents the settings UI elements from loading correctly and/or being saved if you change them... all because it couldn't call a warning that the CRON job was misconfigured. Below are how this affects the UI if you happen to have a CRON job misconfiguration

I already tested and confirmed that fixing this error corrects the UI failure. opnsense-acme01 opnsense-acme02 opnsense-acme03 opnsense-acme04

Glad this will be fixed sooner rather than later! Cheers!

james8675309 avatar Oct 27 '25 08:10 james8675309

@james8675309 Thank you James!

@fraenki Any blockers here?

sopex avatar Oct 27 '25 08:10 sopex

@sopex Aside from the ${var} syntax change, what problem are you trying to solve here?

fraenki avatar Nov 19 '25 11:11 fraenki

@fraenki From what I remember, nothing.

I was trying to fix the depreciation error from showing up on the UI and the error log. But apparently the "update schedule" fails to show up without fixing it, and enabling the plugin fails (at least for some users).

sopex avatar Nov 19 '25 12:11 sopex

protected vars are not usable for deriving classes (locked in parent class scope) so if you use them you need to set them again which was done here correctly, but they are different copies. Maybe private would have been a better choice for these variables in LeCommon.

fichtner avatar Nov 19 '25 13:11 fichtner

protected vars are not usable for deriving classes (locked in parent class scope) so if you use them you need to set them again which was done here correctly, but they are different copies. Maybe private would have been a better choice for these variables in LeCommon.

My understanding of PHP is that these will override the others, no? Anyway, feel free to make any changes you deem necessary, but this must be merged. ACME is rather important and currently exibits very unstable behavior.

(Maybe you are correct, I haven't seen the code for 2+ months. In my mind, private would necessarily create a different copy)

sopex avatar Nov 19 '25 13:11 sopex

My understanding of PHP is that these will override the others, no?

No, protected does not overlap across classes even if derived. It's actually "private" to each Class/File. ;)

currently exibits very unstable behavior

This may be due to deplyoment mode set to "development". I think these are all warnings only, no?

fichtner avatar Nov 19 '25 16:11 fichtner

My understanding of PHP is that these will override the others, no?

No, protected does not overlap across classes even if derived. It's actually "private" to each Class/File. ;)

currently exibits very unstable behavior

This may be due to deplyoment mode set to "development". I think these are all warnings only, no?

Assuming @james8675309 was not in development mode (see above) these depreciation warnings, at least under specific circumstances, prevent the plugin from saving settings and activating properly.

On my limited testing what James reports above is at least partly observed on non development deployment mode, but I don't have a 100% vannila vm available for testing.

sopex avatar Nov 19 '25 17:11 sopex

The API is more allergic to this it seems, but I haven’t seen this to be a widespread issue. Either way happy to move this forward with @fraenki’s approval

fichtner avatar Nov 19 '25 18:11 fichtner

The PHP deprecation warnings were already addressed in another PR (#4824).

fraenki avatar Nov 30 '25 22:11 fraenki

The PHP deprecation warnings were already addressed in another PR ok, let's close then

AdSchellevis avatar Dec 17 '25 09:12 AdSchellevis