From cc1199664cd077187a83c160c8f14f884786478a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sat, 2 Mar 2024 19:19:18 +0100 Subject: [PATCH 1/2] fix default value is incompatible with type string (#28584) --- htdocs/core/lib/functions.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index ef6205953e4..0fd4bc4acc1 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -4516,7 +4516,7 @@ function getPictoForType($key) * @param int $notitle 1=Disable tag title. Use it if you add js tooltip, to avoid duplicate tooltip. * @param string $alt Force alt for bind people * @param string $morecss Add more class css on img tag (For example 'myclascss'). - * @param string $marginleftonlyshort 1 = Add a short left margin on picto, 2 = Add a larger left margin on picto, 0 = No margin left. Works for fontawesome picto only. + * @param int $marginleftonlyshort 1 = Add a short left margin on picto, 2 = Add a larger left margin on picto, 0 = No margin left. Works for fontawesome picto only. * @return string Return img tag * @see img_object(), img_picto_common() */ From eb1f6be1e21a112092ca5258f9fdf04ee18a506e Mon Sep 17 00:00:00 2001 From: MDW Date: Sat, 2 Mar 2024 19:57:59 +0100 Subject: [PATCH 2/2] Qual: Add information from backtrace when mysql request fails. (#28583) # Qual: Add information from backtrace when mysql request fails. This helps locate the line that was responsible for the SQL request --- htdocs/core/db/mysqli.class.php | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/htdocs/core/db/mysqli.class.php b/htdocs/core/db/mysqli.class.php index 53ccf8e19bf..f3c0c3cce62 100644 --- a/htdocs/core/db/mysqli.class.php +++ b/htdocs/core/db/mysqli.class.php @@ -358,7 +358,7 @@ class DoliDBMysqli extends DoliDB if (getDolGlobalInt('SYSLOG_LEVEL') < LOG_DEBUG) { dol_syslog(get_class($this)."::query SQL Error query: ".$query, LOG_ERR); // Log of request was not yet done previously } - dol_syslog(get_class($this)."::query SQL Error message: ".$this->lasterrno." ".$this->lasterror, LOG_ERR); + dol_syslog(get_class($this)."::query SQL Error message: ".$this->lasterrno." ".$this->lasterror.self::getCallerInfoString(), LOG_ERR); //var_dump(debug_print_backtrace()); } $this->lastquery = $query; @@ -368,6 +368,24 @@ class DoliDBMysqli extends DoliDB return $ret; } + /** + * Get caller info + * + * @return string + */ + final protected static function getCallerInfoString() + { + $backtrace = debug_backtrace(); + $msg = ""; + if (count($backtrace) >= 1) { + $trace = $backtrace[1]; + if (isset($trace['file'], $trace['line'])) { + $msg = " From {$trace['file']}:{$trace['line']}."; + } + } + return $msg; + } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Returns the current line (as an object) for the resultset cursor