Skip to content

Commit

Permalink
Merge pull request #57 from Miljar/Miljar-patch-1
Browse files Browse the repository at this point in the history
No exif, no exception
  • Loading branch information
Miljar authored Jul 25, 2016
2 parents f411c27 + d59a151 commit 266c5e3
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 8 deletions.
7 changes: 2 additions & 5 deletions lib/PHPExif/Adapter/Native.php
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,7 @@ public function getSectionsAsArrays()
* Reads & parses the EXIF data from given file
*
* @param string $file
* @return \PHPExif\Exif Instance of Exif object with data
* @throws \RuntimeException If the EXIF data could not be read
* @return \PHPExif\Exif|boolean Instance of Exif object with data
*/
public function getExifFromFile($file)
{
Expand All @@ -187,9 +186,7 @@ public function getExifFromFile($file)
);

if (false === $data) {
throw new \RuntimeException(
sprintf('Could not read EXIF data from file %1$s', $file)
);
return false;
}

$xmpData = $this->getIptcData($file);
Expand Down
4 changes: 2 additions & 2 deletions tests/PHPExif/Adapter/NativeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,12 +103,12 @@ public function testAddRequiredSection()
/**
* @group native
* @covers \PHPExif\Adapter\Native::getExifFromFile
* @expectedException RuntimeException
*/
public function testGetExifFromFileNoData()
{
$file = PHPEXIF_TEST_ROOT . '/files/empty.jpg';
$this->adapter->getExifFromFile($file);
$result = $this->adapter->getExifFromFile($file);
$this->assertFalse($result);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion tests/PHPExif/ExifTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -624,7 +624,7 @@ public function testAdapterConsistency()
// find all Getter methods on the results and compare its output
foreach ($methods as $method) {
$name = $method->getName();
if (strpos($name, 'get') !== 0 || $name == 'getRawData' || $name == 'getData') {
if (strpos($name, 'get') !== 0 || $name == 'getRawData' || $name == 'getData' || $name == 'getColorSpace') {
continue;
}
$this->assertEquals(
Expand Down

0 comments on commit 266c5e3

Please sign in to comment.