Changeset 697 for trunk/lib


Ignore:
Timestamp:
Aug 8, 2019 10:36:08 PM (5 years ago)
Author:
anonymous
Message:

Improve error display. Use \u flag on preg patterns.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/DB.inc.php

    r683 r697  
    3232class DB
    3333{
    34 
    3534    // A place to keep an object instance for the singleton pattern.
    3635    protected static $instance = null;
     
    186185            // Print helpful or pretty error?
    187186            if ($this->getParam('db_debug')) {
    188                 echo $mysql_error_msg . "\n";
     187                if (!$app->isCLI()) {
     188                    printf('<pre style="padding:1em;background:#ddd;font:0.9rem monospace;">%s</pre>', $mysql_error_msg);
     189                }
    189190            }
    190191
     
    346347        $this->_query_count++;
    347348
    348         $debugqry = preg_replace("/\n[\t ]+/", "\n", $query);
     349        $debugqry = preg_replace("/\n[\t ]+/u", "\n", $query);
    349350        if ($this->getParam('db_always_debug') || $debug) {
    350351            if ($debug > 1) {
     
    371372            if ($this->getParam('db_debug')) {
    372373                if (!$app->isCLI()) {
    373                     echo '<pre style="padding:2em; background:#ddd; font:9px monaco;">' . wordwrap(mysql_error($this->dbh)) . '<hr>' . htmlspecialchars($debugqry) . '</pre>';
     374                    echo '<pre style="padding:1em;background:#ddd;font:0.9rem monospace;">' . wordwrap(mysql_error($this->dbh)) . '<hr>' . htmlspecialchars($debugqry) . '</pre>';
    374375                }
    375376            }
Note: See TracChangeset for help on using the changeset viewer.