PHP 8.3 Compatibility Issue in ZenDB/Config.php
2 posts by 2 authors in: Forums > CMS Builder
Last Post: Yesterday at 7:21pm (RSS)
By KennyH - January 15
I was doing some updates on a website and Claude Code insisted on running some checks first and came back with this.
PHP 8.3 Compatibility Issue in ZenDB/Config.php
File: cmsb/lib/ZenDB/Config.php
Issue: The variable variable syntax self::${$key} is deprecated in PHP 8.2+ and will be removed in PHP 9.0.
Affected lines:
- Line 40:
return self::${$key}; - Line 53:
$config[$key] = self::${$key}; - Line 80:
self::${$key} = $value;
Recommended fix: Replace with Reflection-based access for static properties:
// Line 40 - in get() method
$reflectionProperty = new \ReflectionProperty(__CLASS__, $key);
return $reflectionProperty->getValue(null);
// Line 53 - in getAll() method
$reflectionProperty = new \ReflectionProperty(__CLASS__, $key);
$config[$key] = $reflectionProperty->getValue(null);
// Line 80 - in set() method
$reflectionProperty = new \ReflectionProperty(__CLASS__, $key);
$reflectionProperty->setValue(null, $value);
Reference: https://wiki.php.net/rfc/deprecate_dollar_brace_string_interpolation
Bottom line: Nothing breaks. It's just noisy in your logs until the developer fixes it.
The code won't actually break until PHP 9.0 (which is likely 2-3 years away).
Kenny H
By Dave - Yesterday at 7:21pm - edited: Yesterday at 7:21pm
Hi Kenny,
Thanks for the report and sorry for the delayed response; we're working through a queue of site launches.
That RFC is about things like "Hello ${name}" which should now be written as "Hello {$name}" (dollar sign on the inside).
The self::${$key} syntax in Config.php is actually the standard way to access class properties when the property name is in a variable, which is a different feature entirely and isn't affected by that deprecation.
Here's what it does - the Config class has properties like $hostname, $database, $tablePrefix, $logFile, etc. When you call:
DB::config('logFile') // $key = 'logFile'
$key = 'logFile'; // set by config
self::${$key} // resolves to Config::$logFile
The ${} tells PHP "evaluate what's inside first, then use that as the property name." So it returns whichever property matches the string you passed in.
Easy to mix up since they look similar! I had to double-check myself when I saw your post.
If you do see any actual deprecation warnings in your error logs, definitely let us know, and we'll get them sorted out.
PS: You can copy-and-paste this post to Claude and ask them to fact-check it.
Also, I really appreciate that you're taking such a deep dive into the code. Let me know any other questions or feedback. Thanks!
interactivetools.com