I updated to PHP 7.2 and it created an array (no pun intended) of issues. I've been knocking them out (mostly these sizeof and count() warnings. The one error we have :
Warning: sizeof(): Parameter must be an array or an object that implements Countable in /usr/www/domain/phpmyd/includes/class_registry.php on line 236
I tried fixing it like this :
if (sizeof($this->config) < 1) {
To this:
if (!empty($this->config) &&(sizeof($this->config) < 1)) {
But it creates lots more errors shown below, However, we fixed this one in the same way and it works perfectly. Changing this:
if (0 < sizeof($this->language)) {
To this:
if (!empty($this->language) && (0 < sizeof($this->language))) {
Took away basically the same error. Now, keep in mind, the above warning is the ONLY error left. Everything else works perfectly, however, if I do "fix" the warning, I get a bunch of errors that break the site and seem irrelevant. So, if I replace that first string all these errors appear:
- Warning: Use of undefined constant ADDON_DISCOUNT_CODES - assumed 'ADDON_DISCOUNT_CODES' (this will throw an Error in a future version of PHP) in /usr/www/domainlistings/phpmyd/index.php on line 6
- Warning: Use of undefined constant ADDON_BLOG - assumed 'ADDON_BLOG' (this will throw an Error in a future version of PHP) in /usr/www/domainlistings/phpmyd/cp/template/default/admin_header.tpl on line 134
- Warning: Use of undefined constant ADDON_LINK_CHECKER - assumed 'ADDON_LINK_CHECKER' (this will throw an Error in a future version of PHP) in /usr/www/domainlistings/phpmyd/cp/template/default/admin_header.tpl on line 179
Those errors did NOT appear, and those things worked perfectly well until I changed
if (sizeof($this->config) < 1) {
How is this linked? I'm not sure what is happening here, how that one line can make or break these other (seemingly irrelevant) things. Full code of inital problem (line 236):
/**
* Get a configuration value
* @param string $key
* @return mixed
*/
public function getConfig($key) {
if (sizeof($this->config) < 1) {
$this->loadConfig();
}
return isset($this->config[$key]) ? $this->config[$key] : false;
}
Any ideas?