Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:52474 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 79473 invoked from network); 20 May 2011 10:36:03 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 20 May 2011 10:36:03 -0000 Authentication-Results: pb1.pair.com smtp.mail=hannes.magnusson@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=hannes.magnusson@gmail.com; sender-id=pass; domainkeys=bad Received-SPF: pass (pb1.pair.com: domain gmail.com designates 74.125.82.54 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: hannes.magnusson@gmail.com X-Host-Fingerprint: 74.125.82.54 mail-ww0-f54.google.com Received: from [74.125.82.54] ([74.125.82.54:33453] helo=mail-ww0-f54.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id FC/02-01014-11446DD4 for ; Fri, 20 May 2011 06:36:02 -0400 Received: by wwd20 with SMTP id 20so3640128wwd.11 for ; Fri, 20 May 2011 03:35:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=EGO7wI44iSDySe7toVZ8dB+B9sBDVK71GnP4j3k8YFs=; b=NBRiU0SG5GghvYPfXaNg/LCWIp2yEW//hTStqKt2D3uODQUj480x8VAhDg6vVXIfvf iRb/GkZMONhJHoelwuhNAZeyfBpiK4522uwVCiXA21lB5JAYrGhGSXOCyluaybsHwHDN Q7RwxpijUTL07p3qNdkA1o+Np+8wJJuSCUcdY= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=s/EmIalYP+mFXCRFya4tT0eGNcM/jBlaaglFzqyvFDuwd17WjKMZBeqoG+4Zq25bt6 L6pNIfyJ9ZH7a9bBEFvx8UY6ImJTQj75i1lFaUhseE5cjBTmFOgF9UzlyWKPrYNOoPzR ka+NfjUyQqrWqbqvOI7rISJxmDaVdwvVggjhQ= MIME-Version: 1.0 Received: by 10.216.237.217 with SMTP id y67mr458986weq.1.1305887756041; Fri, 20 May 2011 03:35:56 -0700 (PDT) Received: by 10.216.87.206 with HTTP; Fri, 20 May 2011 03:35:56 -0700 (PDT) In-Reply-To: References: Date: Fri, 20 May 2011 12:35:56 +0200 Message-ID: To: Yasuo Ohgaki Cc: internals@lists.php.net Content-Type: text/plain; charset=UTF-8 Subject: Re: [PHP-DEV] [PATCH] pg_escape_literal/pg_escape_identifier for pgsql From: hannes.magnusson@gmail.com (Hannes Magnusson) On Fri, May 20, 2011 at 03:24, Yasuo Ohgaki wrote: > Hi all > > Current PostgreSQL has new escape functions for literals and identifiers. > Since there is no function for that, I made patch for that. Attached patch is > for trunk and tested with PostgreSQL 8.4 and 9.0. > > This patch would also applied to 5.4 branch but how about 5.3? > It's pain not to have escape functions. > > Any comments? This won't compile if HAVE_PQESCAPE isn't declared since you only register the arginfo when it is, but use it even if it wasn't. There is also very inconsistent usage of space vs tab in the patch. + if (!tmp) { + php_error_docref(NULL TSRMLS_CC, E_WARNING,"Failed to escape"); + RETURN_FALSE; + } Won't this also trigger the error if there was no from passed? I suppose checking from_len wouldn't be stupid. Should we really provide fallback if PQescape(Literal|Identifier) isn't available? Did you copy the escaping from postgresql directly? -Hannes