[php-src] PR #17334: ext/pdo_sqlite: Add setAuthorizer method for custom authorization callbacks

From: Date: Fri, 03 Jan 2025 10:00:27 +0000
Subject: [php-src] PR #17334: ext/pdo_sqlite: Add setAuthorizer method for custom authorization callbacks
Groups: php.git-pulls 
Request: Send a blank email to git-pulls+get-30207@lists.php.net to get a copy of this message
Pull Request: https://github.com/php/php-src/pull/17334 Author: evrenonur This commit introduces a new method setAuthorizer to the PDO_SQLite extension, allowing users to set a custom authorization callback for SQLite operations. The implementation includes a new structure to handle the callback data and a function to process authorization requests. Additionally, the method can remove the authorizer by passing a NULL callback. This enhancement improves the flexibility and security of database interactions. Fixes: #17321 ```php $pdo = new PDO('sqlite:/path/to/database.sqlite'); $sqlite = $pdo->sqlite; // Set an authorizer callback $sqlite->setAuthorizer(function(int $actionCode, string $param1, string $param2, string $param3) { // $actionCode: SQLITE_CREATE_INDEX, SQLITE_CREATE_TABLE, etc. // $param1, $param2, $param3: Parameters specific to the action // Allow the action return true; // SQLITE_OK // Deny the action return false; // SQLITE_DENY }); // Remove the authorizer $sqlite->setAuthorizer(null);

« previous php.git-pulls (#30207) next »