I'm recovering from a very serious break in the ZenPhoto system following a major OS upgrade(FreeBSD v10.1 to v10.2); MySQL upgrade from 5.6 to 5.7.10; and PHP to v.5.6.16. Something in the upgrades wiped out most of my *.php scripts; however, I've been able to recover from my inventory of manual backups, etc. I did mysteriously loose several but not all album contents (fortunately backed up). I finally decided to run a restore database from about a year old version and now I cannot even get past the login prompt . . .see the following:
Notice: unserialize(): Error at offset 0 of 38 bytes in /usr/local/www/zenphoto/zp-core/setup/index.php on line 431 Zenphoto Setup
<b>Warning</b>: htmlspecialchars(): charset `US-ASCII' not supported, assuming utf-8 in <b>/usr/local/www/zenphoto/zp-core/functions-common.php</b> on line <b>307</b>
`
306 function html_encode($this_string) {
307 return htmlspecialchars($this_string, ENT_FLAGS, LOCAL_CHARSET);
308 }
`
I've tweaked the code of lines 307-9 in ./zp-core/functions-common.php and the value of `$this_string` is NULL before the function call.
`
function html_encode($this_string) {
307 echo "str=<$this_string>\n...", ENT_FLAGS, "-", LOCAL_CHARSET; // ***rtw!
308 return htmlspecialchars($this_string, ENT_FLAGS, LOCAL_CHARSET);
309 }
`
. . .and this is displayed in the login user field:
str=<>...11-US-ASCII<b>Warning</b>: htmlspecialchars(): charset `US-ASCII' not supported, assuming utf-8 in <b>/usr/local/www/zenphoto/zp-core/functions-common.php</b> on line <b>308</b>
. . .so where to fix or repair this? Where can US-ASCII be identified to the system?
Where in the code (or setup table, etc.) is the character set specified?
Comments
http://php.net/manual/en/function.htmlspecialchars.php
ISO 8859-1 would probably be the one to use. But utf-8 should actually cover everything and is the default that should be used nowadays and is also the default Zenphoto sets generally.
I cannot logon and rerun the setup per displayed message, "You must be logged in to run setup."
BTW, I've added a temporary line of code to display the function arguments in /www/zenphoto/zp-core/functions-common.php
`echo "str=<$this_string>, ", ENT_FLAGS, ", ", LOCAL_CHARSET, " -- ";`
The result is the following display in the User field of the User/Password form: This is the point of failure. I understand that the htmlspecialchars function (http://php.net/manual/en/function.htmlspecialchars.php) is choking on the "US-ASCII" argument . . .somewhere in either the php code, or in a MySQL table, the value, "US-ASCII", is interjected into the mix. Can this be originating in a MySQL table element . . .following the attempted restore from backup?
Seems that somewhere? . . .I should be able manually edit something to change a value from US-ASCII back to utf-8.
Also as an afterthought, I find occasional commented code, `// force UTF-8 \xc3\x98`. Does something like this need to be enabled . . .somewhere?
Thanks again for any suggestions.
Found the following:
`
charset UTF-8
filesystem_charset US-ASCII
`
. . .changed `filesystem_charset` to `UTF-8`
but no joy :-(
Found `charset US-ASCII` in table, `zenphoto-options`
. . .changed to `UTF-8`
Problem re: `htmlspecialchars()` apparently solved; however still cannot login.
`428 $taskDisplay = array('create' => gettext("create"), 'update' => gettext("update"));
429 if ($i = getOption('zenphoto_install')) {
430 $install = unserialize($i);
431 $prevRel = $install['ZENPHOTO'];
432 } else {
433 $prevRel = '';
434 }`
I downloaded `zenphoto-zenphoto-1.4.11.tar.gz` (don't understand why it arrived named as a hyphenated "zenphoto-zenphoto" object, but I've removed that unnecessary spelling.)
Started the installation, all seemed to go as advertised until the install system prompted for a database user and password. I assumed this meant the MySQL db user, so I provided the userid and password for the same. Some processing transpired and now the system tosses me into a prompt panel (form) that instructs that At this point, no userid/password will allow me to access the system. I don't understand this. There are no tables in the `/var/db/MySQL/ZenPhoto` data base. Apparently, the install did not progress to the point where I assume that it would prompt for a target location and create the db tables.
What to do?
Are you sure you really deleted all tables? Maybe delete the whole database and re-create it. If Zenphoto request to login there is already at least a administrators table present. Otherwise it should directly run setup as a fresh install naturally doesn't have anything to login.
http://www.zenphoto.org/news/login-and-password-problems
Note that deleting the tables will cause any data entered to albums, images manually to be lost naturally.
No problem with GitHub's idiosyncrasy.
Yes, all MySQL db tables are "out of the picture" The tar backup of `ZenPhoto-1.4.8-20160115.tar.gz` should not be a problem; phpMyAdmin doesn't "see" anything other than an empty ZenPhoto and reports "No tables found in database."
I'm not clear on the purpose of the `db.opt` file.
FYI, the instructions from the documentation that I'm following are: I might ask how ARE the database schema (tables) created?