Skip to content

Commit 0ec890b

Browse files
superdav42claude
andcommitted
Fix PHP 8.5 deprecation of PDO::sqliteCreateFunction()
PHP 8.5 deprecated PDO::sqliteCreateFunction() in favor of Pdo\Sqlite::createFunction(). Use the new method on PHP 8.0+ where it is available, falling back to the old method for older versions. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 5d8af6b commit 0ec890b

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/db.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,11 @@ public function __construct($pdo)
152152
wp_die('Database is not initialized.', 'Database Error');
153153
}
154154
foreach ($this->functions as $f => $t) {
155-
$pdo->sqliteCreateFunction($f, [$this, $t]);
155+
if (PHP_VERSION_ID >= 80000) {
156+
$pdo->createFunction($f, [$this, $t]);
157+
} else {
158+
$pdo->sqliteCreateFunction($f, [$this, $t]);
159+
}
156160
}
157161
}
158162

0 commit comments

Comments
 (0)