Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:106155 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 6691 invoked from network); 5 Jul 2019 13:32:40 -0000 Received: from unknown (HELO box.beccati.com) (176.9.123.236) by pb1.pair.com with SMTP; 5 Jul 2019 13:32:40 -0000 Received: from [192.168.7.184] (unknown [2.234.231.235]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by box.beccati.com (Postfix) with ESMTPSA id 2D4702002F5; Fri, 5 Jul 2019 12:51:17 +0200 (CEST) Authentication-Results: box.beccati.com; dmarc=fail header.from=beccati.com DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=beccati.com; s=mail; t=1562323877; bh=Rpij1fxSrxuO5HMhaMaYskNyH+gYQ9Rnq4wCq4wwqq0=; h=Subject:From:In-Reply-To:Date:Cc:References:To:From; b=Jv36IWNMiuPkUCd9kt5LCLipHqCHzS8r4iHjNcnft87IT3CYp2m+Cxy0f/tVNXot/ Z2vUqhPaDiPxq3QXbQHHmE9bFFpWsxmtnwtMWSG1i0EgdR03IOLZOFVWtvPdxMhjtJ FN5nOf1PCWFw+ZkMF2B+1FP3qocKp0Ewi9gEKjdgufDCx4Q4coGCieZHOfAUmeRbig 9BlhhqIHuYAoWdF12L/N8/u6k8M3vv9O82C4gaoBWOxi+uu0HKt9EABoTkDibf8NwG gmcUdvXrUtpEL14kdKA1neLDpMLBVTXaCfhZR1q8EQwd9VXH6YiFUrBwAImYKT13lv nX3vyJxIZNHIQ== Content-Type: multipart/alternative; boundary=Apple-Mail-A8FBC669-D474-4F50-BA9F-82EB301E16A1 Mime-Version: 1.0 (1.0) X-Mailer: iPad Mail (16F203) In-Reply-To: Date: Fri, 5 Jul 2019 12:51:16 +0200 Cc: PHP internals Content-Transfer-Encoding: 7bit Message-ID: <5E32DB49-D0E8-477D-AEE4-C4278095F9D5@beccati.com> References: To: Nikita Popov Subject: Re: [PHP-DEV] [RFC] Escape PDO "?" parameter placeholder From: php@beccati.com (Matteo Beccati) --Apple-Mail-A8FBC669-D474-4F50-BA9F-82EB301E16A1 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hi Nikita, > On 5 Jul 2019, at 12:37, Nikita Popov wrote: >=20 >> On Tue, Jul 2, 2019 at 8:22 PM Matteo Beccati wrote: >> Hi Nikita, >>=20 >> On 02/07/2019 15:07, Nikita Popov wrote: >> > Friendly reminder that this RFC needs to go into voting until Monday >> > (preferably earlier) to make it into 7.4. >>=20 >> Thanks! Without the reminder, I would probably have missed it. >>=20 >> > Here's my feedback: >> >=20 >> > * I would prefer to make escaping not driver-sensitive, as the current= >> > implementation is. Whether ?? is interpreted as a single ? or ?? should= not >> > depend on the driver. >>=20 >> Most of the feedback I had was quite the opposite (fear of desruption in >> the other drivers). In fact in the latest iteration, I went for PDO API >> setting, that lets the driver decide whether or not to enable the >> feature, which means only pdo_pgsql would be affected: >>=20 >> https://github.com/mbeccati/php-src/commit/b8a9703b805e0dffd618823656c861= 0777efdc3e >=20 > This sounds nice now -- but what if another database adds an operator usin= g ? in the future? We'd have to enable support for ? escaping at that point.= This would leave us with a mess where ? escaping is available or not availa= ble depending on the specific combination of database driver + PHP version y= ou are using. As the BC concern here seems to be purely theoretical (as far a= s I can see), it seems better to do this for all drivers at the same time.=20= Makes sense and it=E2=80=99s a very good point. >> > * I would prefer to use \? instead of ?? for escaping. The former is m= uch >> > more easily understood by a PHP developer and has less chance of clashi= ng >> > with operators (PHP itself has a ?? operator, it's not so absurd to thi= nk >> > that it also exists elsewhere). The RFC argues against this because it >> > makes writing a literal \? harder (which would be \\\\?), but I think t= hat >> > a) the need for a literal \? seems rather rare and b) double-escaping i= s >> > already a well-understood problem for anyone who ever used regular >> > expressions. >>=20 >> Fair enough. Tbh, I have no strong preference... Would "\?" require also >> implementing escape of the escape? Would that require some re2c magic? >=20 > Yeah, we'd probably need to support escape of the escape for consistency, e= ven if nobody needs it. Overall I'm okay either way here. I think \? will be= more obvious for PHP programmers, but seeing the JDBC document you linked (= https://jdbc.postgresql.org/documentation/head/statement.html) there is exis= ting precedent for using ?? and it may be worthwhile to follow it. Would it be possible or even recommended to add a second vote to decide whic= h one to use? Cheers= --Apple-Mail-A8FBC669-D474-4F50-BA9F-82EB301E16A1--