Skip to content

Commit 7aef5f4

Browse files
committed
Fix deprecation warnings on PHP 8.5
Fixes #249
1 parent ffa2386 commit 7aef5f4

File tree

5 files changed

+17
-24
lines changed

5 files changed

+17
-24
lines changed

src/Bundles/Fatdown.php

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

src/Bundles/Forum.php

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

src/Bundles/MediaPack.php

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

src/Parser.php

Lines changed: 13 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -169,36 +169,29 @@ class Parser
169169
*/
170170
public function __construct(array $config)
171171
{
172+
$this->logger = new Logger;
172173
$this->pluginsConfig = $config['plugins'];
173174
$this->registeredVars = $config['registeredVars'];
174175
$this->rootContext = $config['rootContext'];
175176
$this->tagsConfig = $config['tags'];
176-
177-
$this->__wakeup();
178177
}
179178

180-
/**
181-
* Serializer
182-
*
183-
* Returns the properties that need to persist through serialization.
184-
*
185-
* NOTE: using __sleep() is preferable to implementing Serializable because it leaves the choice
186-
* of the serializer to the user (e.g. igbinary)
187-
*
188-
* @return array
189-
*/
190-
public function __sleep()
179+
public function __serialize(): array
191180
{
192-
return ['pluginsConfig', 'registeredVars', 'rootContext', 'tagsConfig'];
181+
return [
182+
'pluginsConfig' => $this->pluginsConfig,
183+
'registeredVars' => $this->registeredVars,
184+
'rootContext' => $this->rootContext,
185+
'tagsConfig' => $this->tagsConfig
186+
];
193187
}
194188

195-
/**
196-
* Unserializer
197-
*
198-
* @return void
199-
*/
200-
public function __wakeup()
189+
public function __unserialize(array $data): void
201190
{
191+
foreach ($data as $k => $v)
192+
{
193+
$this->$k = $v;
194+
}
202195
$this->logger = new Logger;
203196
}
204197

src/Plugins/BBCodes/Configurator/BBCodeMonkey.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ function ($m)
302302

303303
// Test whether the passthrough token is used for something else, in which case we need
304304
// to unset it
305-
if (isset($tokens[$config['passthroughToken']]))
305+
if (isset($config['passthroughToken'], $tokens[$config['passthroughToken']]))
306306
{
307307
$config['passthroughToken'] = null;
308308
}

0 commit comments

Comments
 (0)