Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:119374 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 95691 invoked from network); 20 Jan 2023 14:26:24 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 20 Jan 2023 14:26:24 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 4A3B118033A for ; Fri, 20 Jan 2023 06:26:23 -0800 (PST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-0.2 required=5.0 tests=BAYES_40,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_PDS_PRO_TLD,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS36483 23.83.216.0/22 X-Spam-Virus: No X-Envelope-From: Received: from toucan.tulip.relay.mailchannels.net (toucan.tulip.relay.mailchannels.net [23.83.218.254]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Fri, 20 Jan 2023 06:26:21 -0800 (PST) X-Sender-Id: yszpovajlk|x-authuser|juris@glaive.pro Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id D75103E21AF for ; Fri, 20 Jan 2023 14:26:17 +0000 (UTC) Received: from server42.areait.lv (unknown [127.0.0.6]) (Authenticated sender: yszpovajlk) by relay.mailchannels.net (Postfix) with ESMTPA id CFA793E21A7 for ; Fri, 20 Jan 2023 14:26:16 +0000 (UTC) ARC-Seal: i=1; s=arc-2022; d=mailchannels.net; t=1674224777; a=rsa-sha256; cv=none; b=xn/ZNf7lnBun/JPf6QSmfPhIzu3OQi58ljDpEbNOvSYPL30Dwkn7DxN1uV5KYSNkJHqC66 3viE0mZfZ7tonF62tFtqXhWXRSMvOIuzRA/anglB9Fid/3d9eEuOcNtKJykWHI6/GlQxLC wBYnkZIpESNOQSouYsa3UW+ItLSOcuKsomTSlimMk2r5O5ErZevrsujHqb6X8UTrwsCgd2 mDYmEObeRltTNVGWX5QYzF4SvtQG6oWZYpc4aiD/40xZEajjh/4i35O6no7Rnu1gSDYUXr BzeVMOBAjtRIMZqHU94ViIHByNp1REF0ids6HJ2OLhncz8V94wTRJDg9D72MWg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=mailchannels.net; s=arc-2022; t=1674224777; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding:dkim-signature; bh=LEim0vMwVNcqNqx+5CX09X/aRcocazMr8+J06t9Oa4A=; b=VpmA4vmgTtgAWNn8OElkImnEVyPQVL3+V/KbMCmsgauyF3ANwCH91gSos4PLImoIlpEvKy UlWaOH0z0uwWxi+tGPS/PZf0XyEx2YXimDLU5T05DLQxg3kmJU25Az04y28yruuQAz45Ub tRpNJl9lel35AuweORpHKE2SSZQCcMvzJby7BtsADcHYcSs/uiIWDxlmWbvY7VSS2Gfpoq GUBfpg62BRwfFaRcbiRDabXMt9UOnl9iGUcjDHqdaXt8Gl//r9LVj3XB1JkgxvkkkpAMg+ t0zcCOvy8J5IePppOjZmdgIK++WvmoqJvKptqvj4GKdh8m4AMk9AfUWCfQMzdw== ARC-Authentication-Results: i=1; rspamd-6f569fcb69-9xcnx; auth=pass smtp.auth=yszpovajlk smtp.mailfrom=juris@glaive.pro X-Sender-Id: yszpovajlk|x-authuser|juris@glaive.pro X-MC-Relay: Neutral X-MailChannels-SenderId: yszpovajlk|x-authuser|juris@glaive.pro X-MailChannels-Auth-Id: yszpovajlk X-Bitter-Rock: 3148ab3f24d799d2_1674224777449_2795479156 X-MC-Loop-Signature: 1674224777449:2566975373 X-MC-Ingress-Time: 1674224777448 Received: from server42.areait.lv (server42.areait.lv [212.7.207.88]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384) by 100.97.74.40 (trex/6.7.1); Fri, 20 Jan 2023 14:26:17 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=glaive.pro; s=default; h=Content-Transfer-Encoding:Content-Type:MIME-Version:Message-ID: Date:Subject:To:From:Sender:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=LEim0vMwVNcqNqx+5CX09X/aRcocazMr8+J06t9Oa4A=; b=LXE7P5hbV9U1fklxHfi/BDZ8dv nycKBOrv9H3GSdoZ8DOceIRVB/hDCk+B8nAuJdKbug+H2IYX7/SqAjeZVcGzfC8onrnNWBYmfAMaq RrOVromAdgT0IRDGYW9FvFDZsOHCY6B7goriPTpBZIs6yVwSYiGl32io0K6hcozEYv1icPaz/xBRj Jwgzhwrsdcxi6dPKmEpaae7pvSzmt8RqcwdABxhTklbpkYLPfMyWjm5JpcqdhDdm64TJajfGB3xkP +tcrLtAtR6gtu9AZHZqFznQnShaIdxUFce9E2yGn6fXFUqyDaU9lYzBgJkAkfN5ccSEsJjR4huptb PjZzdyog==; Received: from [213.110.64.247] (port=55929 helo=LAPTOPHKIOPCGI) by server42.areait.lv with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1pIsLO-00CX8l-PZ for internals@lists.php.net; Fri, 20 Jan 2023 16:26:14 +0200 To: Date: Fri, 20 Jan 2023 16:26:11 +0200 Message-ID: <00df01d92cdb$254948c0$6fdbda40$@glaive.pro> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Outlook 16.0 Thread-Index: Adks2xsLW5XY9MNBTmCtTH2xaPKMTQ== Content-Language: lv X-AuthUser: juris@glaive.pro Subject: Loading SQLite extensions on PDO From: juris@glaive.pro ("Juris Evertovskis") Hey, internals! As many before me, I have come accross a need to load a SQLite extension. While it is supported on the SQLite3 interface, popular frameworks (namely Laravel) use solely PDO and loading extensions is not available on PDO. I've looked into the history of this issue and it seems that - Enabling SQLite extensions via SQL queries is disabled by default and community agrees with this. - The suggested way to enable extensions is via the SQLite C API and that's how SQLite3::loadExtension() does it. - The community does not want a new driver-specific `loadExtension` method on the PDO class (there are some historical driver-specific methods). Respecting these constraints, I would like to ask if the `options` parameter of PDO might be appropriate for this need? According to docs this parameter is intended for driver-specific options: https://www.php.net/manual/en/pdo.construct.php Could it accept an extensions key with an array of extensions that the SQLite PDO driver should load? This would not require changing the PDO interface (apart from adding something like a PDO::SQLITE_LOAD_EXTENSIONS constant for the key) and it would allow using the SQLite API for loading the extension internally. For me as a user of Laravel this would seem the easiest approach as passing the options parameter to the PDO instance is already well supported while replacing PDO with another class or calling methods on every new-booted PDO instance is not that straightforward. I suspect the situation is similar on other frameworks. What do you think? References: - Bug report https://bugs.php.net/bug.php?id=64810 - Solution attempt creating PDO::sqliteCreateExtension() https://github.com/php/php-src/pull/3368 - Solution attempt extending PDO into PDOSQLite class https://github.com/php/php-src/pull/5765 - Discussion that new driver-specific methods are not welcome in PDO https://externals.io/message/100268 - Similar discussion where the PDOSQLite class was proposed https://externals.io/message/110578 - Discussion about eventually replacing SQLite3 with PDO/SQLite https://externals.io/message/108256 (pointing this out as my proposal would somewhat interfere - SQLite3 allows loading extensions at any time while the PDO options are only used while initializing it) - A workaround https://github.com/Moxio/sqlite-extended-api Thanks for your time, Juris