Author Topic: Install of 1.8 failed - undefined function safe_htmlspecialchars()  (Read 2483 times)

0 Members and 1 Guest are viewing this topic.

Offline Ebby

  • Pre-Newbie
  • Posts: 2
    • View Profile
I'm trying to install a fresh copy of 1.8 on Ubuntu 16.10.

Apache/2.4.18 (Ubuntu) OpenSSL/1.0.2g
PHP Version 7.0.8-3ubuntu3
MySQL Version 5.7.16

Install Error:
PHP Fatal error: Uncaught Error: Call to undefined function safe_htmlspecialchars() in /var/www/html/4images/includes/db_myssqli.php:73
Stack trace:
#0 /var/www/html/4images/install.php(253): Db->query('CREATE TABLE ca...')
#1 {main} thrown in /var/html/4images/includes/db_mysqli.php on line 73

Stating the obvious, the safe_htmlspecialchars() function that is defined in functions.php and included by global.php is not working in the mysqli class Db.  I have no idea why it doesn't think it's defined.  PHP 7 thing with a class?

Offline Sumale.my

  • Addicted member
  • ******
  • Posts: 1.790
  • I ♥ 4I
    • View Profile
Re: Install of 1.8 failed - undefined function safe_htmlspecialchars()
« Reply #1 on: August 23, 2019, 11:25:06 AM »
4images is dead...

But....

search in install.php
function addslashes_array($array) {
  foreach (
$array as $key => $val) {
    
$array[$key] = (is_array($val)) ? addslashes_array($val) : addslashes($val);
  }
  return 
$array;
}


add after

function safe_htmlspecialchars($chars) {
  
// Translate all non-unicode entities
  
$chars preg_replace(
    
'/&(?!(#[0-9]+|[a-z]+);)/si',
    
'&',
    
$chars
  
);

  
$chars str_replace(">"">",   $chars);
  
$chars str_replace("<""&lt;",   $chars);
  
$chars str_replace('"'"&quot;"$chars);
  return 
$chars;
}


LG
Beste Gre
Sumale.my