Skip to content

Commit 5230746

Browse files
committed
Made all constant literal non-empty, non-numeric string equality checks use strict equality.
Implemented by search & replace. All other equality checks are left untouched, as changing them may result in different behavior, whereas these ones should behave the same, while reducing the surface area for type related bugs.
1 parent 74ce53b commit 5230746

371 files changed

Lines changed: 982 additions & 982 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

library/Zend/Amf/Adobe/Introspector.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ protected function _addService(Zend_Server_Reflection_Class $refclass, DOMElemen
171171
foreach ($refclass->getMethods() as $method) {
172172
if (!$method->isPublic()
173173
|| $method->isConstructor()
174-
|| ('__' == substr((string) $method->name, 0, 2))
174+
|| ('__' === substr((string) $method->name, 0, 2))
175175
) {
176176
continue;
177177
}
@@ -189,7 +189,7 @@ protected function _addService(Zend_Server_Reflection_Class $refclass, DOMElemen
189189

190190
$type = $param->getType();
191191
if (PHP_VERSION_ID < 80000) {
192-
if ($type == 'mixed' && ($pclass = $param->getClass())) {
192+
if ($type === 'mixed' && ($pclass = $param->getClass())) {
193193
$type = $pclass->getName();
194194
}
195195
}
@@ -291,7 +291,7 @@ protected function _registerType($typename)
291291
}
292292

293293
// Arrays
294-
if ('array' == $typename) {
294+
if ('array' === $typename) {
295295
return 'Unknown[]';
296296
}
297297

library/Zend/Amf/Parse/Amf0/Serializer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ public function writeObject($object)
229229
// Loop each element and write the name of the property.
230230
foreach ($object as $key => &$value) {
231231
// skip variables starting with an _ private transient
232-
if( $key[0] == "_") continue;
232+
if( $key[0] === "_") continue;
233233
$this->_stream->writeUtf($key);
234234
$this->writeTypeMarker($value);
235235
}

library/Zend/Amf/Response/Http.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public function getResponse()
5757
protected function isIeOverSsl()
5858
{
5959
$ssl = isset($_SERVER['HTTPS']) ? $_SERVER['HTTPS'] : false;
60-
if (!$ssl || ($ssl == 'off')) {
60+
if (!$ssl || ($ssl === 'off')) {
6161
// IIS reports "off", whereas other browsers simply don't populate
6262
return false;
6363
}

library/Zend/Amf/Server.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,7 @@ protected function _dispatch($method, $params = null, $source = null)
356356
} elseif ($info instanceof Zend_Server_Reflection_Method) {
357357
// Get class
358358
$class = $info->getDeclaringClass()->getName();
359-
if ('static' == $info->isStatic()) {
359+
if ('static' === $info->isStatic()) {
360360
// for some reason, invokeArgs() does not work the same as
361361
// invoke(), and expects the first argument to be an object.
362362
// So, using a callback if the method is static.

library/Zend/Application/Bootstrap/BootstrapAbstract.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ public function setOptions(array $options)
150150

151151
if (in_array($method, $methods)) {
152152
$this->$method($value);
153-
} elseif ('resources' == $key) {
153+
} elseif ('resources' === $key) {
154154
foreach ($value as $resource => $resourceOptions) {
155155
$this->registerPluginResource($resource, $resourceOptions);
156156
}

library/Zend/Auth/Adapter/Http.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -580,7 +580,7 @@ protected function _digestAuth($header)
580580

581581
// See ZF-1052. This code was a bit too unforgiving of invalid
582582
// usernames. Now, if the username is bad, we re-challenge the client.
583-
if ('::invalid::' == $data['username']) {
583+
if ('::invalid::' === $data['username']) {
584584
return $this->_challengeClient();
585585
}
586586

@@ -606,7 +606,7 @@ protected function _digestAuth($header)
606606
// If MD5-sess is used, a1 value is made of the user's password
607607
// hash with the server and client nonce appended, separated by
608608
// colons.
609-
if ($this->_algo == 'MD5-sess') {
609+
if ($this->_algo === 'MD5-sess') {
610610
$ha1 = hash('md5', $ha1 . ':' . $data['nonce'] . ':' . $data['cnonce']);
611611
}
612612

library/Zend/Barcode/Object/Code128.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ protected function _convertToBarcodeChars($string)
284284
$code = null;
285285

286286
if (self::_isDigit($string, $pos, 4) && $currentCharset != 'C'
287-
|| self::_isDigit($string, $pos, 2) && $currentCharset == 'C') {
287+
|| self::_isDigit($string, $pos, 2) && $currentCharset === 'C') {
288288
/**
289289
* Switch to C if the next 4 chars are numeric or stay C if the next 2
290290
* chars are numeric
@@ -324,7 +324,7 @@ protected function _convertToBarcodeChars($string)
324324
$currentCharset = 'A';
325325
}
326326

327-
if ($currentCharset == 'C') {
327+
if ($currentCharset === 'C') {
328328
$code = array_search(substr($string, $pos, 2), $this->_charSets['C']);
329329
$pos++; //Two chars from input
330330
} else {

library/Zend/Barcode/Object/Ean13.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ public function getChecksum($text)
181181
*/
182182
protected function _drawText()
183183
{
184-
if (get_class($this) == 'Zend_Barcode_Object_Ean13') {
184+
if (get_class($this) === 'Zend_Barcode_Object_Ean13') {
185185
$this->_drawEan13Text();
186186
} else {
187187
parent::_drawText();

library/Zend/Barcode/Object/ObjectAbstract.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -643,7 +643,7 @@ protected function _addLeadingZeros($text, $withoutChecksum = false)
643643
$text = str_repeat('0', $length - strlen($text)) . $text;
644644
}
645645
} else {
646-
if ($this->_barcodeLength == 'even') {
646+
if ($this->_barcodeLength === 'even') {
647647
$text = ((strlen((string) $text) - $omitChecksum) % 2 ? '0' . $text : $text);
648648
}
649649
}

library/Zend/Barcode/Renderer/Image.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ public function setResource($image)
176176
*/
177177
public function setImageType($value)
178178
{
179-
if ($value == 'jpg') {
179+
if ($value === 'jpg') {
180180
$value = 'jpeg';
181181
}
182182

0 commit comments

Comments
 (0)