1
0
mirror of https://github.com/e107inc/e107.git synced 2025-07-31 11:50:30 +02:00

Issue #5443 - PHP 8.4 deprecation error removal.

This commit is contained in:
camer0n
2025-04-29 10:03:49 -07:00
parent 85a65281b2
commit e7fec78550
2 changed files with 37 additions and 25 deletions

View File

@@ -6164,6 +6164,15 @@ class e107
*/
public function __get($name)
{
// Use a static cache to store instances
static $instances = [];
if(isset($instances[$name]))
{
return $instances[$name];
}
switch($name)
{
case 'tp':
@@ -6220,11 +6229,14 @@ class e107
default:
trigger_error('$e107->$' . $name . ' not defined', E_USER_WARNING);
return null;
break;
}
$this->$name = $ret;
// Store the result in the static cache
$instances[$name] = $ret;
return $ret;
}

View File

@@ -17,7 +17,7 @@
catch(Exception $e)
{
$this->assertTrue(false, $e->getMessage());
$this::fail($e->getMessage());
}
}
@@ -39,13 +39,13 @@
'most_enabled' => true
);
$result = $this->ad->ReadArray($string);
$this->assertSame($expected, $result);
$result = e107::unserialize($string);
$this::assertSame($expected, $result);
// legacy Prefs test.
$string = 'a:4:{s:19:"most_members_online";i:10;s:18:"most_guests_online";i:20;s:21:"most_online_datestamp";i:1534279911;s:12:"most_enabled";b:1;}';
$actual = $this->ad->ReadArray($string);
$this->assertSame($expected, $actual);
$actual = e107::unserialize($string);
$this::assertSame($expected, $actual);
}
@@ -54,12 +54,12 @@
{
// Test with addslashes enabled.
$input = array('one'=>'two', 'three'=>true);
$result = $this->ad->WriteArray($input);
$result = e107::serialize($input,true);
$expected = 'array (
\\\'one\\\' => \\\'two\\\',
\\\'three\\\' => true,
)';
$this->assertSame($expected, $result);
$this::assertSame($expected, $result);
// Test with addslashes disabled.