diff --git a/src/ShapeFile.php b/src/ShapeFile.php
index <HASH>..<HASH> 100644
--- a/src/ShapeFile.php
+++ b/src/ShapeFile.php
@@ -525,7 +525,7 @@ class ShapeFile
      */
     private function _createDBFFile()
     {
-        if (!self::supports_dbase() || count($this->DBFHeader) == 0) {
+        if (!self::supports_dbase() || !is_array($this->DBFHeader) || count($this->DBFHeader) == 0) {
             $this->DBFFile = null;
 
             return true;
Check whether header is array prior to counting it