Skip to content
Snippets Groups Projects

Fixed Fix count() on NULL

Merged sarwan verma requested to merge issue/phpexcel-3394424:3394424-fix-count-on into 4.0.x
1 file
+ 5
4
Compare changes
  • Side-by-side
  • Inline
+ 5
4
@@ -177,10 +177,11 @@ not set to TRUE. Excel export aborted.");
// Make sure we have an ignore_headers key to prevent Notices.
$options['ignore_headers'] = $options['ignore_headers'] ?? empty($headers);
if (!count($data)) {
$this->logger->error("No data was provided. Excel export aborted.");
return self::PHPEXCEL_ERROR_NO_DATA;
if (isset($data) && (is_array($data) || is_countable($data))) {
if (count($data) === 0) {
$this->logger->error("No data was provided. Excel export aborted.");
return self::PHPEXCEL_ERROR_NO_DATA;
}
}
if (!(is_writable($path) || (!file_exists($path) && is_writable(dirname($path))))) {
Loading