Compare commits

...

5 Commits

Author SHA1 Message Date
Clemens Schwaighofer
d9d5400498 Add Test for get run times for unrun queryies 2022-12-28 11:31:39 +09:00
Clemens Schwaighofer
b1be681afb Bug fix in DB\IO for wrong array check
Did not use empty to check if query called hash entry exists
2022-12-28 11:26:56 +09:00
Clemens Schwaighofer
8ef309d479 PHP unit 8.2, cel builder br/input fix, doctype add, sync .user.ini
- do not sync .user.ini file in sync template
- add PHP 8.2 for test target phpunit
- cel/phfo builder update to not close br or img tags (besides input)
- psalm settings update
- add doctype to all base templates
2022-12-27 16:58:51 +09:00
Clemens Schwaighofer
6e59b63791 DB\IO phpdoc and phpstan fixes 2022-12-14 14:18:33 +09:00
Clemens Schwaighofer
9c7b3cea83 SQL Interface docstring fix 2022-12-14 13:53:54 +09:00
11 changed files with 32 additions and 9 deletions

View File

@@ -16,6 +16,7 @@ if [ ! -z "${1}" ]; then
"7.4") php_bin="/usr/bin/php7.4 "; ;; "7.4") php_bin="/usr/bin/php7.4 "; ;;
"8.0") php_bin="/usr/bin/php8.0 "; ;; "8.0") php_bin="/usr/bin/php8.0 "; ;;
"8.1") php_bin="/usr/bin/php8.1 "; ;; "8.1") php_bin="/usr/bin/php8.1 "; ;;
"8.2") php_bin="/usr/bin/php8.2 "; ;;
*) echo "Not support PHP: ${1}"; exit; ;; *) echo "Not support PHP: ${1}"; exit; ;;
esac; esac;
fi; fi;
@@ -25,6 +26,7 @@ if [ ! -z "${2}" ] && [ -z "${php_bin}" ]; then
"7.4") php_bin="/usr/bin/php7.4 "; ;; "7.4") php_bin="/usr/bin/php7.4 "; ;;
"8.0") php_bin="/usr/bin/php8.0 "; ;; "8.0") php_bin="/usr/bin/php8.0 "; ;;
"8.1") php_bin="/usr/bin/php8.1 "; ;; "8.1") php_bin="/usr/bin/php8.1 "; ;;
"8.2") php_bin="/usr/bin/php8.2 "; ;;
*) echo "Not support PHP: ${1}"; exit; ;; *) echo "Not support PHP: ${1}"; exit; ;;
esac; esac;
fi; fi;

View File

@@ -18,6 +18,7 @@ rm -f $tmpf_web;
echo ".*.swp" >> $tmpf_web; echo ".*.swp" >> $tmpf_web;
echo "._*" >> $tmpf_web; echo "._*" >> $tmpf_web;
echo ".DS_Store" >> $tmpf_web; echo ".DS_Store" >> $tmpf_web;
echo ".user.ini" >> $tmpf_web;
echo ".svn" >> $tmpf_web; echo ".svn" >> $tmpf_web;
echo ".svnignore" >> $tmpf_web; echo ".svnignore" >> $tmpf_web;
echo ".git" >> $tmpf_web; echo ".git" >> $tmpf_web;

View File

@@ -1576,6 +1576,13 @@ final class CoreLibsDBIOTest extends TestCase
// clear any current query // clear any current query
// $db->dbResetQuery(); // $db->dbResetQuery();
// assert never called query is 0
$this->assertEquals(
0,
$db->dbGetQueryCalled($query),
'Assert never called query is null'
);
// if expected result is not a bool // if expected result is not a bool
// for PHP 8.1 or higher it has to be an object // for PHP 8.1 or higher it has to be an object
// for anything before PHP 8.1 this has to be a resource // for anything before PHP 8.1 this has to be a resource

View File

@@ -116,6 +116,7 @@ $ADMIN_STYLESHEET = 'edit.css';
// define all needed smarty stuff for the general HTML/page building // define all needed smarty stuff for the general HTML/page building
$HEADER['CSS'] = CSS; $HEADER['CSS'] = CSS;
$HEADER['DEFAULT_ENCODING'] = DEFAULT_ENCODING; $HEADER['DEFAULT_ENCODING'] = DEFAULT_ENCODING;
/** @phpstan-ignore-next-line because ADMIN_STYLESHEET can be null */
$HEADER['STYLESHEET'] = $ADMIN_STYLESHEET ?? ADMIN_STYLESHEET; $HEADER['STYLESHEET'] = $ADMIN_STYLESHEET ?? ADMIN_STYLESHEET;
if ($form->my_page_name == 'edit_order') { if ($form->my_page_name == 'edit_order') {

View File

@@ -8,6 +8,7 @@
******************************************************************** ********************************************************************
*} *}
<!doctype html>
<html> <html>
<head> <head>
<title>{$HTML_TITLE}</title> <title>{$HTML_TITLE}</title>

View File

@@ -8,6 +8,7 @@
******************************************************************** ********************************************************************
*} *}
<!doctype html>
<html> <html>
<head> <head>
<title>{$HTML_TITLE}</title> <title>{$HTML_TITLE}</title>

View File

@@ -8,6 +8,7 @@
******************************************************************** ********************************************************************
*} *}
<!doctype html>
<html> <html>
<head> <head>
<title>{$HTML_TITLE}</title> <title>{$HTML_TITLE}</title>

View File

@@ -1014,8 +1014,12 @@ function phfo(tree)
} else if (tree.content) { } else if (tree.content) {
content.push(tree.content); content.push(tree.content);
} }
// if not input close // if not input, image or br, then close
if (tree.tag != 'input') { if (
tree.tag != 'input' ||
tree.tag != 'img' ||
tree.tag != 'br'
) {
content.push('</' + tree.tag + '>'); content.push('</' + tree.tag + '>');
} }
// combine to string // combine to string

View File

@@ -1481,7 +1481,7 @@ class IO
* @param string $string string to escape * @param string $string string to escape
* @return string escaped string * @return string escaped string
*/ */
public function dbEscapeIdentifier($string): string public function dbEscapeIdentifier(string $string): string
{ {
return $this->db_functions->__dbEscapeIdentifier($string); return $this->db_functions->__dbEscapeIdentifier($string);
} }
@@ -1489,14 +1489,19 @@ class IO
/** /**
* escape data for writing to bytea type column field * escape data for writing to bytea type column field
* @param string $data data to escape to bytea * @param string $data data to escape to bytea
* @return string escaped bytea * @return string escaped bytea string
*/ */
public function dbEscapeBytea($data) public function dbEscapeBytea(string $data): string
{ {
return $this->db_functions->__dbEscapeBytea($data); return $this->db_functions->__dbEscapeBytea($data);
} }
public function dbUnescapeBytea($bytea) /**
* unescape bytea data back to normal binrary data
* @param string $bytea bytea data stream
* @return string binary data string
*/
public function dbUnescapeBytea(string $bytea): string
{ {
return $this->db_functions->__dbUnescapeBytea($bytea); return $this->db_functions->__dbUnescapeBytea($bytea);
} }
@@ -1816,6 +1821,7 @@ class IO
// if cursor exists ... // if cursor exists ...
if ($this->cursor_ext[$query_hash]['cursor']) { if ($this->cursor_ext[$query_hash]['cursor']) {
/** @phpstan-ignore-next-line claims this is always false, but can be true */
if ($first_call === true) { if ($first_call === true) {
$this->cursor_ext[$query_hash]['log'][] = 'First call'; $this->cursor_ext[$query_hash]['log'][] = 'First call';
// count the rows returned (if select) // count the rows returned (if select)
@@ -2200,7 +2206,7 @@ class IO
public function dbGetQueryCalled(string $query): int public function dbGetQueryCalled(string $query): int
{ {
$query_hash = $this->dbGetQueryHash($query); $query_hash = $this->dbGetQueryHash($query);
if ($this->query_called[$query_hash]) { if (!empty($this->query_called[$query_hash])) {
return $this->query_called[$query_hash]; return $this->query_called[$query_hash];
} else { } else {
return 0; return 0;

View File

@@ -214,7 +214,7 @@ interface SqlFunctions
/** /**
* Undocumented function * Undocumented function
* *
* @param string $bytea * @param string $data
* @return string * @return string
*/ */
public function __dbEscapeBytea(string $data): string; public function __dbEscapeBytea(string $data): string;

View File

@@ -28,7 +28,6 @@
<directory name="lib/FileUpload" /> <directory name="lib/FileUpload" />
<directory name="lib/Smarty" /> <directory name="lib/Smarty" />
<directory name="lib/smarty-4.1.0" /> <directory name="lib/smarty-4.1.0" />
<file name="lib/smarty-4.1.0/SmartyBC.class.php" />
<file name="lib/Smarty/Smarty.class.php" /> <file name="lib/Smarty/Smarty.class.php" />
<file name="lib/CoreLibs/Template/SmartyExtend.php" /> <file name="lib/CoreLibs/Template/SmartyExtend.php" />
</ignoreFiles> </ignoreFiles>