Browse Source

PHP 8 compat

Maurits van der Schee 3 years ago
parent
commit
6c60082ab0
4 changed files with 17 additions and 3 deletions
  1. 5
    1
      api.include.php
  2. 5
    1
      api.php
  3. 2
    0
      docker-compose.yml
  4. 5
    1
      src/Tqdev/PhpCrudApi/Middleware/XmlMiddleware.php

+ 5
- 1
api.include.php View File

@@ -8746,7 +8746,11 @@ namespace Tqdev\PhpCrudApi\Middleware {
8746 8746
 
8747 8747
         private function xml2json($xml)
8748 8748
         {
8749
-            $a = @dom_import_simplexml(simplexml_load_string($xml));
8749
+            $o = @simplexml_load_string($xml);
8750
+            if ($o===false) {
8751
+                return null;
8752
+            }
8753
+            $a = @dom_import_simplexml($o);
8750 8754
             if (!$a) {
8751 8755
                 return null;
8752 8756
             }

+ 5
- 1
api.php View File

@@ -8746,7 +8746,11 @@ namespace Tqdev\PhpCrudApi\Middleware {
8746 8746
 
8747 8747
         private function xml2json($xml)
8748 8748
         {
8749
-            $a = @dom_import_simplexml(simplexml_load_string($xml));
8749
+            $o = @simplexml_load_string($xml);
8750
+            if ($o===false) {
8751
+                return null;
8752
+            }
8753
+            $a = @dom_import_simplexml($o);
8750 8754
             if (!$a) {
8751 8755
                 return null;
8752 8756
             }

+ 2
- 0
docker-compose.yml View File

@@ -29,3 +29,5 @@ services:
29 29
         - "8080:80"
30 30
         depends_on:
31 31
         - database
32
+        volumes:
33
+        - .:/php-crud-api:ro

+ 5
- 1
src/Tqdev/PhpCrudApi/Middleware/XmlMiddleware.php View File

@@ -83,7 +83,11 @@ class XmlMiddleware extends Middleware
83 83
 
84 84
     private function xml2json($xml)
85 85
     {
86
-        $a = @dom_import_simplexml(simplexml_load_string($xml));
86
+        $o = @simplexml_load_string($xml);
87
+        if ($o===false) {
88
+            return null;
89
+        }
90
+        $a = @dom_import_simplexml($o);
87 91
         if (!$a) {
88 92
             return null;
89 93
         }

Loading…
Cancel
Save