View Issue Details

IDProjectCategoryView StatusLast Update
0000425WackoWikiadministrationpublic2014-03-21 11:51
Reportervaraha Assigned Toadministrator  
PrioritynormalSeveritymajorReproducibilityalways
Status resolvedResolutionfixed 
PlatformCloud x64OSFedoraOS Version17
Product Version5.1.0 
Target Version5.4.0Fixed in Version5.4.0 
Summary0000425: admin panel database restore problem with PDO
DescriptionIf you use PDO driver and try restore any backup from admin panel, then content like this:

%%(anyformatter)
echo "Hellow\nAlfa\nDelta\nGamma";
%%

appears like this

%%(anyformatter)
echo "Hellow
Alfa
Delta
Gamma";
%%

Due to code in admin/common/database.php :

$row = str_replace('\\\\', "\\", $row);
$row = str_replace('\\n', "\n", $row);
$row = str_replace('\\t', "\t", $row);

This code
from \n makes NL
and from \\n it makes no \n , but also NL

Solved by patch (file in attach) like this:

- $row = str_replace('\\\\', "\\", $row);
- $row = str_replace('\\n', "\n", $row);
- $row = str_replace('\\t', "\t", $row);
+ foreach($row as &$rstr)
+ $rstr = strtr($rstr, array(
+ "\\\\" => "\\",
+ '\\n' => "\n",
+ '\\t' => "\t"
+ ));

TagsNo tags attached.
Attached Files
database.php.patch (611 bytes)   
--- database.php.orig	2012-09-04 07:58:55.062099935 +0000
+++ database.php	2012-09-04 08:00:56.003099418 +0000
@@ -569,13 +569,16 @@
 			// wipe current data row to stay in low memory boundaries
 			$data[$i++] = '';
 
 			$row = explode("\t", $row);
 			// unescape divider chars
-			$row = str_replace('\\\\', "\\", $row);
-			$row = str_replace('\\n',  "\n", $row);
-			$row = str_replace('\\t',  "\t", $row);
+			foreach($row as &$rstr)
+				$rstr = strtr($rstr, array(
+					"\\\\" => "\\",
+					'\\n' => "\n",
+					'\\t' => "\t"
+					));
 
 			// prepare data
 			$j = 0;
 
 			foreach ($row as $cell)
database.php.patch (611 bytes)   

Relationships

related to 0000426 resolvedadministrator small patch of write/read database tables structure 

Issue History

Date Modified Username Field Change
2012-09-04 09:10 varaha New Issue
2012-09-04 09:10 varaha File Added: database.php.patch
2012-09-08 05:23 administrator Assigned To => administrator
2012-09-08 05:23 administrator Status new => assigned
2012-09-08 05:23 administrator Target Version => 5.1.x
2012-09-08 05:43 administrator Note Added: 0000860
2012-09-08 05:43 administrator Status assigned => resolved
2012-09-08 05:43 administrator Resolution open => fixed
2012-09-08 05:43 administrator Fixed in Version => 5.1.x
2012-09-08 06:55 administrator Relationship added related to 0000426
2014-03-21 11:51 administrator Fixed in Version 5.1.x => 5.4.0
2014-03-21 11:51 administrator Target Version 5.1.x => 5.4.0