-
Notifications
You must be signed in to change notification settings - Fork 58
Fixes for PHP 8.1 compatibility #40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 5 commits
7284b0a
5364d08
a79c8ec
a05167f
6a01e1c
42c6276
438053d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -64,35 +64,35 @@ abstract class Zend_Db_Statement implements Zend_Db_Statement_Interface | |
* | ||
* @var array | ||
*/ | ||
protected $_attribute = array(); | ||
protected $_attribute = []; | ||
|
||
/** | ||
* Column result bindings. | ||
* | ||
* @var array | ||
*/ | ||
protected $_bindColumn = array(); | ||
protected $_bindColumn = []; | ||
|
||
/** | ||
* Query parameter bindings; covers bindParam() and bindValue(). | ||
* | ||
* @var array | ||
*/ | ||
protected $_bindParam = array(); | ||
protected $_bindParam = []; | ||
|
||
/** | ||
* SQL string split into an array at placeholders. | ||
* | ||
* @var array | ||
*/ | ||
protected $_sqlSplit = array(); | ||
protected $_sqlSplit = []; | ||
|
||
/** | ||
* Parameter placeholders in the SQL string by position in the split array. | ||
* | ||
* @var array | ||
*/ | ||
protected $_sqlParam = array(); | ||
protected $_sqlParam = []; | ||
|
||
/** | ||
* @var Zend_Db_Profiler_Query | ||
|
@@ -134,14 +134,17 @@ protected function _prepare($sql) | |
*/ | ||
protected function _parseParameters($sql) | ||
{ | ||
$sql = $this->_stripQuoted($sql); | ||
|
||
// split into text and params | ||
$this->_sqlSplit = preg_split('/(\?|\:[a-zA-Z0-9_]+)/', | ||
$sql, -1, PREG_SPLIT_DELIM_CAPTURE|PREG_SPLIT_NO_EMPTY); | ||
if ($sql !== null) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How will the following There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. fixed |
||
$this->_sqlSplit = preg_split( | ||
'/(\?|\:[a-zA-Z0-9_]+)/', | ||
$this->_stripQuoted($sql), | ||
-1, | ||
PREG_SPLIT_DELIM_CAPTURE|PREG_SPLIT_NO_EMPTY | ||
); | ||
} | ||
|
||
// map params | ||
$this->_sqlParam = array(); | ||
$this->_sqlParam = []; | ||
foreach ($this->_sqlSplit as $key => $val) { | ||
if ($val == '?') { | ||
if ($this->_adapter->supportsParameters('positional') === false) { | ||
|
@@ -164,7 +167,7 @@ protected function _parseParameters($sql) | |
} | ||
|
||
// set up for binding | ||
$this->_bindParam = array(); | ||
$this->_bindParam = []; | ||
} | ||
|
||
/** | ||
|
@@ -176,7 +179,6 @@ protected function _parseParameters($sql) | |
*/ | ||
protected function _stripQuoted($sql) | ||
{ | ||
|
||
// get the character for value quoting | ||
// this should be ' | ||
$q = $this->_adapter->quote('a'); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -245,7 +245,7 @@ public function _execute(array $params = null) | |
* @return mixed Array, object, or scalar depending on fetch mode. | ||
* @throws Zend_Db_Statement_Exception | ||
*/ | ||
public function fetch($style = null, $cursor = null, $offset = null) | ||
public function fetch($style = null, $cursor = PDO::FETCH_ORI_NEXT, $offset = 0) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please move these operations to the method code There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. hi @fascinosum , done |
||
{ | ||
if ($style === null) { | ||
$style = $this->_fetchMode; | ||
|
@@ -263,6 +263,7 @@ public function fetch($style = null, $cursor = null, $offset = null) | |
* | ||
* @return IteratorIterator | ||
*/ | ||
#[\ReturnTypeWillChange] | ||
public function getIterator() | ||
{ | ||
return new IteratorIterator($this->_stmt); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -121,9 +121,7 @@ public function setCase($case) | |
*/ | ||
public function getExtension() | ||
{ | ||
$extension = explode(',', $this->_extension); | ||
|
||
return $extension; | ||
return explode(',', $this->_extension); | ||
} | ||
|
||
/** | ||
|
@@ -134,7 +132,6 @@ public function getExtension() | |
*/ | ||
public function setExtension($extension) | ||
{ | ||
$this->_extension = null; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think
is more appropriate There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hello @fascinosum There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Only right after initialization of the object There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done |
||
$this->addExtension($extension); | ||
return $this; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I recommend leaving it as it is