Skip to content

Commit

Permalink
bugfix(zend) Deprecated: Array and string offset access syntax with c…
Browse files Browse the repository at this point in the history
…urly braces is deprecated (#1340)
  • Loading branch information
daim2k5 authored Dec 26, 2020
1 parent d316b02 commit 443863d
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion lib/Zend/Barcode/Object/Code25.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ public function getChecksum($text)
$checksum = 0;

for ($i = strlen($text); $i > 0; $i --) {
$checksum += intval($text{$i - 1}) * $factor;
$checksum += intval($text[$i - 1]) * $factor;
$factor = 4 - $factor;
}

Expand Down
4 changes: 2 additions & 2 deletions lib/Zend/Barcode/Object/Ean13.php
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ public function getChecksum($text)
$checksum = 0;

for ($i = strlen($text); $i > 0; $i --) {
$checksum += intval($text{$i - 1}) * $factor;
$checksum += intval($text[$i - 1]) * $factor;
$factor = 4 - $factor;
}

Expand Down Expand Up @@ -196,7 +196,7 @@ protected function _drawEan13Text()
$leftPosition = $this->getQuietZone() - $characterWidth;
for ($i = 0; $i < $this->_barcodeLength; $i ++) {
$this->_addText(
$text{$i},
$text[$i],
$this->_fontSize * $this->_factor,
$this->_rotate(
$leftPosition,
Expand Down
2 changes: 1 addition & 1 deletion lib/Zend/Barcode/Object/Ean5.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ public function getChecksum($text)
$checksum = 0;

for ($i = 0 ; $i < $this->_barcodeLength; $i ++) {
$checksum += intval($text{$i}) * ($i % 2 ? 9 : 3);
$checksum += intval($text[$i]) * ($i % 2 ? 9 : 3);
}

return ($checksum % 10);
Expand Down
2 changes: 1 addition & 1 deletion lib/Zend/Barcode/Object/Ean8.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ protected function _drawText()
$leftPosition = $this->getQuietZone() + (3 * $this->_barThinWidth) * $this->_factor;
for ($i = 0; $i < $this->_barcodeLength; $i ++) {
$this->_addText(
$text{$i},
$text[$i],
$this->_fontSize * $this->_factor,
$this->_rotate(
$leftPosition,
Expand Down
2 changes: 1 addition & 1 deletion lib/Zend/Barcode/Object/Identcode.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public function getChecksum($text)
$checksum = 0;

for ($i = strlen($text); $i > 0; $i --) {
$checksum += intval($text{$i - 1}) * (($i % 2) ? 4 : 9);
$checksum += intval($text[$i - 1]) * (($i % 2) ? 4 : 9);
}

$checksum = (10 - ($checksum % 10)) % 10;
Expand Down
2 changes: 1 addition & 1 deletion lib/Zend/Barcode/Object/ObjectAbstract.php
Original file line number Diff line number Diff line change
Expand Up @@ -1322,7 +1322,7 @@ protected function _drawText()
for ($i = 0; $i < $textLength; $i ++) {
$leftPosition = $this->getQuietZone() + $space * ($i + 0.5);
$this->_addText(
$text{$i},
$text[$i],
$this->_fontSize * $this->_factor,
$this->_rotate(
$leftPosition,
Expand Down
2 changes: 1 addition & 1 deletion lib/Zend/Barcode/Object/Upca.php
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ protected function _drawText()
$fontSize *= 0.8;
}
$this->_addText(
$text{$i},
$text[$i],
$fontSize * $this->_factor,
$this->_rotate(
$leftPosition,
Expand Down
10 changes: 5 additions & 5 deletions lib/Zend/Barcode/Object/Upce.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ protected function _getDefaultOptions()
public function getText()
{
$text = parent::getText();
if ($text{0} != 1) {
$text{0} = 0;
if ($text[0] != 1) {
$text[0] = 0;
}
return $text;
}
Expand Down Expand Up @@ -158,7 +158,7 @@ protected function _drawText()
$fontSize *= 0.8;
}
$this->_addText(
$text{$i},
$text[$i],
$fontSize * $this->_factor,
$this->_rotate(
$leftPosition,
Expand Down Expand Up @@ -222,8 +222,8 @@ protected function _validateText($value, $options = array())
public function getChecksum($text)
{
$text = $this->_addLeadingZeros($text, true);
if ($text{0} != 1) {
$text{0} = 0;
if ($text[0] != 1) {
$text[0] = 0;
}
return parent::getChecksum($text);
}
Expand Down

0 comments on commit 443863d

Please sign in to comment.