File: scriptexec_lines_start_with_semicol.diff

package info (click to toggle)
phppgadmin 5.1%2Bds-2
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 3,916 kB
  • ctags: 4,657
  • sloc: php: 47,091; sh: 37; sql: 16; makefile: 5
file content (40 lines) | stat: -rw-r--r-- 1,574 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
Description: Stop ignoring sql queries whose ending ';' starts a line
Author: Jean-Michel Nirgal Vourgère <jmv_deb@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