Control: tags -1 patch
Description: Stop ignoring sql queries whose ending ';' is on its own line
Author: Jean-Michel Nirgal Vourgère <jmv_...@nirgal.com>
Bug: https://sourceforge.net/p/phppgadmin/bugs/448/
Bug-Debian: https://bugs.debian.org/762378
Forwarded: https://github.com/phppgadmin/phppgadmin/pull/27
Last-Update: 2015-03-24

Index: phppgadmin/classes/database/Postgres.php
===================================================================
--- phppgadmin.orig/classes/database/Postgres.php
+++ phppgadmin/classes/database/Postgres.php
@@ -7504,17 +7504,18 @@ class Postgres extends ADODB_base {
     			else if (substr($line, $i, 1) == ';' && !$bslash_count && !$paren_level)
     			{
     			    $subline = substr(substr($line, 0, $i), $query_start);
-    				/* is there anything else on the line? */
-    				if (strspn($subline, " \t\n\r") != strlen($subline))
+    				/*
+    				 * insert a cosmetic newline, if this is not the first
+    				 * line in the buffer
+					 */
+    				if (strlen($query_buf) > 0)
+    				    $query_buf .= "\n";
+    				/* append the line to the query buffer */
+    				$query_buf .= $subline;
+
+    				/* is there anything in the query_buf? */
+    				if (trim($query_buf))
     				{
-    					/*
-    					 * insert a cosmetic newline, if this is not the first
-    					 * line in the buffer
-						 */
-    					if (strlen($query_buf) > 0)
-    					    $query_buf .= "\n";
-    					/* append the line to the query buffer */
-    					$query_buf .= $subline;
     					$query_buf .= ';';
 
 						// Execute the query. PHP cannot execute

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to