mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-02 19:44:25 +02:00
Fix PHP Fatal error "Method Icinga\File\Csv::__toString() must not throw an exception in /vagrant/test/php/library/Icinga/File/CsvTest.php on line 35"
This commit is contained in:
parent
1532594948
commit
0065cbe998
@ -5,6 +5,7 @@
|
|||||||
namespace Icinga\File;
|
namespace Icinga\File;
|
||||||
|
|
||||||
use Icinga\Data\Browsable;
|
use Icinga\Data\Browsable;
|
||||||
|
use Exception;
|
||||||
|
|
||||||
class Csv
|
class Csv
|
||||||
{
|
{
|
||||||
@ -27,6 +28,7 @@ class Csv
|
|||||||
|
|
||||||
public function __toString()
|
public function __toString()
|
||||||
{
|
{
|
||||||
|
try {
|
||||||
$first = true;
|
$first = true;
|
||||||
$csv = '';
|
$csv = '';
|
||||||
foreach ($this->query->getQuery()->fetchAll() as $row) {
|
foreach ($this->query->getQuery()->fetchAll() as $row) {
|
||||||
@ -42,5 +44,8 @@ class Csv
|
|||||||
}
|
}
|
||||||
|
|
||||||
return $csv;
|
return $csv;
|
||||||
|
} catch (Exception $e) {
|
||||||
|
return (string) $e;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user