Fixed php 7.2 count() compatibility and intval cast in number_format2 parameter 2.
authorJoe Hunt <joe.hunt.consulting@gmail.com>
Thu, 29 Nov 2018 08:13:49 +0000 (09:13 +0100)
committerJoe Hunt <joe.hunt.consulting@gmail.com>
Thu, 29 Nov 2018 08:13:49 +0000 (09:13 +0100)
admin/db/maintenance_db.inc
includes/current_user.inc
includes/ui/ui_globals.inc
reporting/includes/fpdi/fpdi.php
reporting/includes/reports_classes.inc
sales/includes/sales_db.inc

index ab7334f0258a387d721a93bfe4ba729c3725b2f6..af6f577707aea8ebc5fce81357e9fe8bc75a1b70 100644 (file)
@@ -183,7 +183,7 @@ function update_extensions($extensions) {
        }
 
        // update per company files
-       $cnt = max(1, count($db_connections));
+       $cnt = max(1, count_array($db_connections));
        for($i = 0; $i < $cnt; $i++) 
        {
                $newexts = $extensions;
index 23887cb65d62d995a7bfce41ba30e2b0c2d651dd..edfae0a92b2b8b6725f0d39f32dc8109cee79d87 100644 (file)
@@ -315,7 +315,7 @@ function number_format2($number, $decimals=0)
                $dec = $decimals;
        }
 
-       $num = number_format($number, $dec, $dsep, $tsep);
+       $num = number_format($number, intval($dec), $dsep, $tsep);
 
        return $decimals==='max' ? rtrim($num, '0') : $num;
 
index 15601c9f6915d1113490dacfccdd6d89d0bc2c04..ecb3ca4eaa111f78e202621f034fa80983155f22 100644 (file)
@@ -62,7 +62,10 @@ function get_global_curr_code()
        return $_SESSION['wa_global_curr_code'];
 }
 
-
+function count_array($array)
+{
+    return (is_array($array)) ? count($array) : 0;
+}
 
 //--------------------------------------------------------------------------------------
 
index d9ab7ced482db3fc0c18b413398c101b3e693be9..097491df0266f8527dc834cf4f001613c7cf84fe 100644 (file)
@@ -486,7 +486,7 @@ class FPDI extends FPDF_TPL {
      * close all files opened by parsers
      */
     function _closeParsers() {
-        if ($this->state > 2 && count($this->parsers) > 0) {
+        if ($this->state > 2 && is_array($this->parsers) && count($this->parsers) > 0) {
                foreach ($this->parsers as $k => $_){
                $this->parsers[$k]->closeFile();
                $this->parsers[$k] = null;
index 419f69ef102fd4ba945be1665e0bce61ae7339e7..77399c3f3a663b3c08631bc5909f57a101c7e5fa 100644 (file)
@@ -34,7 +34,7 @@ class BoxReports
        function addReportClass($class_name, $class_id=null)
        {
                if (!$class_id)
-                       $class_id = is_array($this->ar_classes) ? count($this->ar_classes) : 0;
+                       $class_id = count_array($this->ar_classes);
                $this->ar_classes[$class_id] = $class_name;
 
                return $class_id;
index 465002303887c7ca2659ea5ec8aa9b34865e360c..d58d8cf76988ab7fec955717a503bf9e88e1b573 100644 (file)
@@ -368,7 +368,7 @@ function get_sales_child_documents($trans_type, $trans_no)
        // FIXME -  credit notes retrieved here should be those linked to invoices containing 
        // at least one line from related invoice
 
-       if (!count($trans_no))
+       if (!count_array($trans_no))
                return false;
        $childs = get_sales_child_numbers($trans_type, $trans_no, false);
        if (!count($childs))