summaryrefslogtreecommitdiffstats
path: root/lib/private/legacy/image.php
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2018-01-25 22:26:47 +0100
committerMorris Jobke <hey@morrisjobke.de>2018-01-26 13:38:34 +0100
commit9ff51aafc518460e6c45996f09e9fe74e5f8d2e8 (patch)
tree7aa302bf04530f0add196f6bcd6e8636333e6be0 /lib/private/legacy/image.php
parentb9bbb894f8b01e000bb5e3a8a82db7bebad3ea00 (diff)
downloadnextcloud-server-9ff51aafc518460e6c45996f09e9fe74e5f8d2e8.tar.gz
nextcloud-server-9ff51aafc518460e6c45996f09e9fe74e5f8d2e8.zip
Use index based string access for substr with length of 1
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
Diffstat (limited to 'lib/private/legacy/image.php')
-rw-r--r--lib/private/legacy/image.php6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/private/legacy/image.php b/lib/private/legacy/image.php
index 6ad9426a717..eeee3b24073 100644
--- a/lib/private/legacy/image.php
+++ b/lib/private/legacy/image.php
@@ -784,16 +784,16 @@ class OC_Image implements \OCP\IImage {
$color[1] = (($color[1] & 0xf800) >> 8) * 65536 + (($color[1] & 0x07e0) >> 3) * 256 + (($color[1] & 0x001f) << 3);
break;
case 8:
- $color = @unpack('n', $vide . substr($data, $p, 1));
+ $color = @unpack('n', $vide . ($data[$p] ?? ''));
$color[1] = (isset($palette[$color[1] + 1])) ? $palette[$color[1] + 1] : $palette[1];
break;
case 4:
- $color = @unpack('n', $vide . substr($data, floor($p), 1));
+ $color = @unpack('n', $vide . ($data[floor($p)] ?? ''));
$color[1] = ($p * 2) % 2 == 0 ? $color[1] >> 4 : $color[1] & 0x0F;
$color[1] = (isset($palette[$color[1] + 1])) ? $palette[$color[1] + 1] : $palette[1];
break;
case 1:
- $color = @unpack('n', $vide . substr($data, floor($p), 1));
+ $color = @unpack('n', $vide . ($data[floor($p)] ?? ''));
switch (($p * 8) % 8) {
case 0:
$color[1] = $color[1] >> 7;