No MySQL error message in Dolphin 7.4?

This is connect to database function in BxDolDb.php of Dolphin 7.3.5:

 

    /**

     * connect to database with appointed parameters

     */

    function connect()

    {

        $full_host = $this->host;

        $full_host .= $this->port ? ':'.$this->port : '';

        $full_host .= $this->socket ? ':'.$this->socket : '';

 

        $this->link = @mysql_pconnect($full_host, $this->user, $this->password);

        if (!$this->link)

            $this->error('Database connect failed', true);

 

        if (!$this->select_db())

            $this->error('Database select failed', true);        

 

        mysql_query("SET NAMES 'utf8'", $this->link);

        mysql_query("SET sql_mode = ''", $this->link);

 

        $GLOBALS['bx_db_link'] = $this->link;

    }

 

But, This is connect to database function in BxDolDb.php of Dolphin 7.4:

 

    /**

     * connect to database with appointed parameters

     */

    protected function connect()

    {

        $sSocketOrHost = ($this->socket) ? "unix_socket={$this->socket}" : "host={$this->host};port={$this->port}";

 

        $this->link = new PDO(

            "mysql:{$sSocketOrHost};dbname={$this->dbname};charset=utf8",

            $this->user,

            $this->password,

            [

                PDO::MYSQL_ATTR_INIT_COMMAND => 'SET sql_mode=""',

                PDO::ATTR_ERRMODE            => PDO::ERRMODE_EXCEPTION,

                PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,

                PDO::ATTR_EMULATE_PREPARES   => false,

                PDO::ATTR_PERSISTENT         => defined('DATABASE_PERSISTENT') && DATABASE_PERSISTENT ? true : false,

            ]

        );

    }

 

When MySQL is gone away, user will see an PHP error message like this in the browser:

 

Fatal error: Uncaught PDOException: SQLSTATE[HY000]......... require_once(' in /dolphin/inc/classes/BxDolDb.php on line 103


BTW, this is connect to database function in WordPress 5.1:

 

public function __construct($location, $name, $type)

{

$this->options = array(

'user' => null,

'pass' => null,

'host' => '127.0.0.1',

'port' => '3306',

'path' => '',

'extras' => array(

'prefix' => '',

),

);

$this->options = array_merge_recursive($this->options, SimplePie_Cache::parse_URL($location));

 

// Path is prefixed with a "/"

$this->options['dbname'] = substr($this->options['path'], 1);

 

try

{

$this->mysql = new PDO("mysql:dbname={$this->options['dbname']};host={$this->options['host']};port={$this->options['port']}", $this->options['user'], $this->options['pass'], array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8'));

}

catch (PDOException $e)

{

$this->mysql = null;

return;

}

https://www.insoler.com/ The first community site supports RAW photo formats !
Quote · 5 Mar 2019

We have global exception handler, we'll investigate why exception isn't caught in this case:

https://github.com/boonex/dolphin.pro/issues/679

thank you for the report.

Rules → http://www.boonex.com/terms
Quote · 5 Mar 2019

Thank you, AlexT.

https://www.insoler.com/ The first community site supports RAW photo formats !
Quote · 12 Mar 2019
 
 
Below is the legacy version of the Boonex site, maintained for Dolphin.Pro 7.x support.
The new Dolphin solution is powered by UNA Community Management System.