v1.3.2がphp8.1でうごかなかった理由は、php8.1になって、mysqliでerrorが生じた場合、 Exceptionが発生するのがdefaultの値になったからである。 解決策は、以下にコマンドを実行することである。 ------------------------------------------------------------------------ mysqli_report(MYSQLI_REPORT_OFF); ------------------------------------------------------------------------ ------------------------------------------------------------------------ index.php $registry->set('customer', new ACustomer($registry)); customer.php $mdl->setOnline($ip, $customer_id, $url, $referer); storefront/model/tool/online_now.php $result = $this->db->query( "INSERT INTO `".$this->db->table("online_customers")."` ( `ip`, `customer_id`, `url`, `referer`, `date_added` ) VALUES ( '".$this->db->escape($ip)."', '".(int)$customer_id."', '".$this->db->escape($url)."', '".$this->db->escape($referer)."', NOW() )", true ); core/database/amysqli.php //------------------------------------------------------------------------------ // 2023-06-12 //------------------------------------------------------------------------------ // In PHP 8.1, the default is raize an exception in mysqli error // In PHP 8.0, the default is not raize an exception in mysqli error // The following line make this script compatible with PHP8,1 //------------------------------------------------------------------------------ mysqli_report(MYSQLI_REPORT_OFF); //------------------------------------------------------------------------------ ------------------------------------------------------------------------