Skip to content

Commit 72bc347

Browse files
committed
Fixes to launch Magento with PHP 8.1
1 parent 7284b0a commit 72bc347

File tree

6 files changed

+89
-16
lines changed

6 files changed

+89
-16
lines changed

library/Zend/Db/Adapter/Abstract.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -928,7 +928,8 @@ public function quote($value, $type = null)
928928
public function quoteInto($text, $value, $type = null, $count = null)
929929
{
930930
if ($count === null) {
931-
return str_replace('?', $this->quote($value, $type) ?? '', $text);
931+
$quote = $this->quote($value, $type) ?? '""';
932+
return str_replace('?', $quote, $text);
932933
} else {
933934
return implode($this->quote($value, $type), explode('?', $text, $count + 1));
934935
}

library/Zend/Db/Adapter/Pdo/Abstract.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ protected function _quote($value)
293293
return $value;
294294
}
295295
$this->_connect();
296-
return $this->_connection->quote($value);
296+
return $this->_connection->quote($value ?? '');
297297
}
298298

299299
/**

library/Zend/Db/Statement/Pdo.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,7 @@ public function fetch($style = null, $cursor = PDO::FETCH_ORI_NEXT, $offset = 0)
263263
*
264264
* @return IteratorIterator
265265
*/
266+
#[\ReturnTypeWillChange]
266267
public function getIterator()
267268
{
268269
return new IteratorIterator($this->_stmt);

library/Zend/Http/Response.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -258,9 +258,10 @@ public function isRedirect()
258258
public function getBody()
259259
{
260260
$body = '';
261+
$transferEncoding = $this->getHeader('transfer-encoding');
261262

262263
// Decode the body if it was transfer-encoded
263-
switch (strtolower($this->getHeader('transfer-encoding'))) {
264+
switch ($transferEncoding ? strtolower($transferEncoding) : '') {
264265

265266
// Handle chunked body
266267
case 'chunked':
@@ -274,8 +275,10 @@ public function getBody()
274275
break;
275276
}
276277

278+
$contentEncoding = $this->getHeader('content-encoding');
279+
277280
// Decode any content-encoding (gzip or deflate) if needed
278-
switch (strtolower($this->getHeader('content-encoding'))) {
281+
switch ($contentEncoding ? strtolower($contentEncoding) : '') {
279282

280283
// Handle gzip encoding
281284
case 'gzip':
@@ -603,7 +606,7 @@ public static function decodeChunkedBody($body)
603606
// If mbstring overloads substr and strlen functions, we have to
604607
// override it's internal encoding
605608
if (function_exists('mb_internal_encoding') &&
606-
((int) ini_get('mbstring.func_overload')) & 2) {
609+
((int) ini_get('mbstring.func_overload')) & 2) {
607610

608611
$mbIntEnc = mb_internal_encoding();
609612
mb_internal_encoding('ASCII');

library/Zend/Pdf/RecursivelyIteratableObjectsContainer.php

Lines changed: 78 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,17 +29,85 @@
2929
*/
3030
class Zend_Pdf_RecursivelyIteratableObjectsContainer implements RecursiveIterator, Countable
3131
{
32-
protected $_objects = array();
32+
protected $_objects = [];
3333

34-
public function __construct(array $objects) { $this->_objects = $objects; }
34+
/**
35+
* @param array $objects
36+
*/
37+
public function __construct(array $objects)
38+
{
39+
$this->_objects = $objects;
40+
}
3541

36-
public function current() { return current($this->_objects); }
37-
public function key() { return key($this->_objects); }
38-
public function next() { return next($this->_objects); }
39-
public function rewind() { return reset($this->_objects); }
40-
public function valid() { return current($this->_objects) !== false; }
41-
public function getChildren() { return current($this->_objects); }
42-
public function hasChildren() { return count($this->_objects) > 0; }
42+
/**
43+
* @inheritDoc
44+
*/
45+
#[\ReturnTypeWillChange]
46+
public function current()
47+
{
48+
return current($this->_objects);
49+
}
4350

44-
public function count() { return count($this->_objects); }
51+
/**
52+
* @inheritDoc
53+
*/
54+
#[\ReturnTypeWillChange]
55+
public function key()
56+
{
57+
return key($this->_objects);
58+
}
59+
60+
/**
61+
* @inheritDoc
62+
*/
63+
#[\ReturnTypeWillChange]
64+
public function next()
65+
{
66+
return next($this->_objects);
67+
}
68+
69+
/**
70+
* @inheritDoc
71+
*/
72+
#[\ReturnTypeWillChange]
73+
public function rewind()
74+
{
75+
return reset($this->_objects);
76+
}
77+
78+
/**
79+
* @inheritDoc
80+
*/
81+
#[\ReturnTypeWillChange]
82+
public function valid()
83+
{
84+
return current($this->_objects) !== false;
85+
}
86+
87+
/**
88+
* @inheritDoc
89+
*/
90+
#[\ReturnTypeWillChange]
91+
public function getChildren()
92+
{
93+
return current($this->_objects);
94+
}
95+
96+
/**
97+
* @inheritDoc
98+
*/
99+
#[\ReturnTypeWillChange]
100+
public function hasChildren()
101+
{
102+
return count($this->_objects) > 0;
103+
}
104+
105+
/**
106+
* @inheritDoc
107+
*/
108+
#[\ReturnTypeWillChange]
109+
public function count()
110+
{
111+
return count($this->_objects);
112+
}
45113
}

library/Zend/Registry.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,9 +201,9 @@ public function __construct($array = array(), $flags = parent::ARRAY_AS_PROPS)
201201
*
202202
* Workaround for http://bugs.php.net/bug.php?id=40442 (ZF-960).
203203
*/
204+
#[\ReturnTypeWillChange]
204205
public function offsetExists($index)
205206
{
206207
return array_key_exists($index, $this);
207208
}
208-
209209
}

0 commit comments

Comments
 (0)