From 4b5ba7de49d841a12791e76d55214b23ccc2ed75 Mon Sep 17 00:00:00 2001 From: lsolesen Date: Thu, 21 Apr 2016 12:58:36 +0000 Subject: [PATCH] Boolean should be compared strictly --- src/PelIfd.php | 10 +++++----- src/PelTiff.php | 4 ++-- test/Bug1730993Test.php | 2 +- test/Bug3017880Test.php | 4 ++-- test/GH16Test.php | 4 ++-- test/GH21Test.php | 2 +- 6 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/PelIfd.php b/src/PelIfd.php index 328b3f27..208db83f 100644 --- a/src/PelIfd.php +++ b/src/PelIfd.php @@ -965,7 +965,7 @@ public function getIterator() */ public function getThumbnailData() { - if ($this->thumb_data != null) { + if ($this->thumb_data !== null) { return $this->thumb_data->getBytes(); } else { return ''; @@ -1002,7 +1002,7 @@ public function getNextIfd() */ public function isLastIfd() { - return $this->next == null; + return $this->next === null; } /** @@ -1074,7 +1074,7 @@ public function getBytes($offset, $order) Pel::debug('Bytes from IDF will start at offset %d within Exif data', $offset); $n = count($this->entries) + count($this->sub); - if ($this->thumb_data != null) { + if ($this->thumb_data !== null) { /* * We need two extra entries for the thumbnail offset and * length. @@ -1119,7 +1119,7 @@ public function getBytes($offset, $order) } } - if ($this->thumb_data != null) { + if ($this->thumb_data !== null) { Pel::debug('Appending %d bytes of thumbnail data at %d', $this->thumb_data->getSize(), $end); // TODO: make PelEntry a class that can be constructed with // arguments corresponding to the newt four lines. @@ -1199,7 +1199,7 @@ public function __toString() foreach ($this->sub as $type => $ifd) { $str .= $ifd->__toString(); } - if ($this->next != null) { + if ($this->next !== null) { $str .= $this->next->__toString(); } return $str; diff --git a/src/PelTiff.php b/src/PelTiff.php index 5a54cf4a..96af4fe5 100644 --- a/src/PelTiff.php +++ b/src/PelTiff.php @@ -222,7 +222,7 @@ public function getBytes($order = PelConvert::LITTLE_ENDIAN) /* TIFF magic number --- fixed value. */ $bytes .= PelConvert::shortToBytes(self::TIFF_HEADER, $order); - if ($this->ifd != null) { + if ($this->ifd !== null) { /* * IFD 0 offset. We will always start IDF 0 at an offset of 8 * bytes (2 bytes for byte order, another 2 bytes for the TIFF @@ -254,7 +254,7 @@ public function getBytes($order = PelConvert::LITTLE_ENDIAN) public function __toString() { $str = Pel::fmt("Dumping TIFF data...\n"); - if ($this->ifd != null) { + if ($this->ifd !== null) { $str .= $this->ifd->__toString(); } diff --git a/test/Bug1730993Test.php b/test/Bug1730993Test.php index 90977e1c..bf283772 100644 --- a/test/Bug1730993Test.php +++ b/test/Bug1730993Test.php @@ -39,7 +39,7 @@ function testThisDoesNotWorkAsExpected() require_once 'PelJpeg.php'; $jpeg = new PelJpeg($tmpfile); // the error occurs here $exif = $jpeg->getExif(); - if ($exif != null) { + if ($exif !== null) { $jpeg1 = new PelJpeg($bigfile); $jpeg1->setExif($exif); file_put_contents($bigfile, $jpeg1->getBytes()); diff --git a/test/Bug3017880Test.php b/test/Bug3017880Test.php index f893ba21..0fdf9ceb 100644 --- a/test/Bug3017880Test.php +++ b/test/Bug3017880Test.php @@ -54,7 +54,7 @@ function testThisDoesNotWorkAsExpected() $tiff = $exif->getTiff(); $ifd0 = $tiff->getIfd(); - if ($ifd0 == null) { + if ($ifd0 === null) { $ifd0 = new PelIfd(PelIfd::IFD0); $tiff->setIfd($ifd0); } @@ -62,7 +62,7 @@ function testThisDoesNotWorkAsExpected() $software_name = 'Example V2'; $software = $ifd0->getEntry(PelTag::SOFTWARE); - if ($software == null) { + if ($software === null) { $software = new PelEntryAscii(PelTag::SOFTWARE, $software_name); $ifd0->addEntry($software); $resave_file = 1; diff --git a/test/GH16Test.php b/test/GH16Test.php index 4b781bff..061faa3d 100644 --- a/test/GH16Test.php +++ b/test/GH16Test.php @@ -55,7 +55,7 @@ function testThisDoesNotWorkAsExpected() $jpeg->load($data); $exif = $jpeg->getExif(); - if (null == $exif) { + if (null === $exif) { $exif = new PelExif(); $jpeg->setExif($exif); $tiff = new PelTiff(); @@ -65,7 +65,7 @@ function testThisDoesNotWorkAsExpected() $tiff = $exif->getTiff(); $ifd0 = $tiff->getIfd(); - if (null == $ifd0) { + if (null === $ifd0) { $ifd0 = new PelIfd(PelIfd::IFD0); $tiff->setIfd($ifd0); } diff --git a/test/GH21Test.php b/test/GH21Test.php index 060b9849..fd577425 100644 --- a/test/GH21Test.php +++ b/test/GH21Test.php @@ -70,7 +70,7 @@ function testThisDoesNotWorkAsExpected() $exif = $input_jpeg->getExif(); - if ($exif != null) { + if ($exif !== null) { $output_jpeg->setExif($exif); }