View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
2899 | Composr | backup | public | 2016-10-25 16:01 | 2016-10-28 15:01 |
Reporter | bobmiers | Assigned To | Chris Graham | ||
Priority | normal | Severity | @70@ | ||
Status | resolved | Resolution | fixed | ||
Summary | 2899: restore.php error on line 197 | ||||
Description | Had a need to restore (from multiple copies of backup-all doing same thing). Getting following error: Parse error: syntax error, unexpected '', '' (T_CONSTANT_ENCAPSED_STRING) in /home/foxglo5/public_html/foxcms/restore.php on line 197 Short code example: function require_code($codename) { global $FILE_ARRAY, $REQUIRED_BEFORE; if (array_key_exists($codename, $REQUIRED_BEFORE)) { return; } $REQUIRED_BEFORE[$codename] = 1; if (@is_array($FILE_ARRAY)) { $file = file_array_get('sources/' . $codename . '.php'); $file = str_replace('<?php', '', $file); $file = str_replace('', '', $file); I use Notepad++ as my editor. It shows the text after the 1st single quote in the 2nd $file = statement as grayed out. The grayed out continues into the next function (function safe_ini_set($var,$value)) till just after the 'return false;' statement. See the attached screen capture file. | ||||
Tags | No tags attached. | ||||
Attach Tags | |||||
Attached Files | |||||
Time estimation (hours) | |||||
Sponsorship open | |||||
|
Hi, The backup restoration hasn't been tested in v10, that's an oversight. I have just found and corrected the bug here, but I'm currently overhauling the code to be tidier and implementing a unit test so we have automated testing of this in the future. Btw, the editor highlighting thing is actually a bug in your editor, but we will work around that with our update too. |
|
Chris: re your BTW note. The code editor used by InMotionHosting cPanel also shows highlights the coding error as well. I did a bunch of research on the str_replace function and concluded that your code should be correct. I discovered that the editors I checked don't like the "?" in the search argument. Please note the next line of code in restore.php. i.e. $file = str_replace('', '', $file); I think that is a 'do nothing' line of code that maybe should be addressed in the overhauling. I'm aware that it won't slow the process down much. Just a suggestion. |
|
The thing about '<?php' is the PHP parser won't parse the PHP start tag (<?php) inside quotes, but many editors will. So it looks like an error but isn't. So we break it up now like '<'.'?php' to fool the editors. That str_replace line was odd, got like that via mass search and replace across the code years ago I think, didn't cause harm but now removed. I have finished overhauling the backup system and adding the unit test. The code is now much cleaner and more robust. It will be included in the next RC. https://github.com/ocproducts/composr/commit/56c86acfae2594e23b073a06b4cfdfa5cfe6583f |
|
Thanks Chris A quick question: Once the next RC is here and installed, will I be able to run a full backup and then change to one of my older restore_data files and then run via the newly generated restore.php file? My son and I both got errors in the gallery somewhere between RC18 & RC20. (A gallery that was used on the front page as well as in the gallery section would only show an "image" icon where the full size picture should have been in the gallery. In my attempts to correct, I think that I messed up the database big time and would like to restore back to R18.) |
|
Yes that should work. I'm not following about the (still) gallery issue, but if it's a bug please report in a new issue. |
Date Modified | Username | Field | Change |
---|---|---|---|
2016-10-25 16:01 | bobmiers | New Issue | |
2016-10-25 16:01 | bobmiers | File Added: 2016-10-25_8-52-29.png | |
2016-10-26 22:34 | Chris Graham | Note Added: 0004481 | |
2016-10-27 08:45 | bobmiers | Note Added: 0004486 | |
2016-10-27 15:21 | Chris Graham | Note Added: 0004487 | |
2016-10-27 15:22 | Chris Graham | Status | Not Assigned => Resolved |
2016-10-27 15:22 | Chris Graham | Resolution | open => fixed |
2016-10-27 15:22 | Chris Graham | Assigned To | => Chris Graham |
2016-10-27 17:54 | bobmiers | Note Added: 0004488 | |
2016-10-28 15:01 | Chris Graham | Note Added: 0004497 |