-
Notifications
You must be signed in to change notification settings - Fork 122
Delegate quoteIdentifier operation to quoteIdentifierChain #233
base: master
Are you sure you want to change the base?
Changes from 1 commit
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 |
---|---|---|
@@ -1,9 +1,11 @@ | ||
<?php | ||
|
||
/** | ||
* Zend Framework (http://framework.zend.com/) | ||
* Zend Framework (http://framework.zend.com/). | ||
* | ||
* @link http://github.com/zendframework/zf2 for the canonical source repository | ||
* @copyright Copyright (c) 2005-2016 Zend Technologies USA Inc. (http://www.zend.com) | ||
* | ||
* @copyright Copyright (c) 2005-2017 Zend Technologies USA Inc. (http://www.zend.com) | ||
* @license http://framework.zend.com/license/new-bsd New BSD License | ||
*/ | ||
|
||
|
@@ -31,7 +33,7 @@ abstract class AbstractPlatform implements PlatformInterface | |
*/ | ||
public function quoteIdentifierInFragment($identifier, array $safeWords = []) | ||
{ | ||
if (! $this->quoteIdentifiers) { | ||
if (!$this->quoteIdentifiers) { | ||
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 revert, the white space was correct. |
||
return $identifier; | ||
} | ||
|
||
|
@@ -54,8 +56,8 @@ public function quoteIdentifierInFragment($identifier, array $safeWords = []) | |
$identifier .= isset($safeWordsInt[strtolower($part)]) | ||
? $part | ||
: $this->quoteIdentifier[0] | ||
. str_replace($this->quoteIdentifier[0], $this->quoteIdentifierTo, $part) | ||
. $this->quoteIdentifier[1]; | ||
.str_replace($this->quoteIdentifier[0], $this->quoteIdentifierTo, $part) | ||
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 revert, the white space was correct. |
||
.$this->quoteIdentifier[1]; | ||
} | ||
|
||
return $identifier; | ||
|
@@ -66,21 +68,29 @@ public function quoteIdentifierInFragment($identifier, array $safeWords = []) | |
*/ | ||
public function quoteIdentifier($identifier) | ||
{ | ||
if (! $this->quoteIdentifiers) { | ||
return $identifier; | ||
} | ||
|
||
return $this->quoteIdentifier[0] | ||
. str_replace($this->quoteIdentifier[0], $this->quoteIdentifierTo, $identifier) | ||
. $this->quoteIdentifier[1]; | ||
return $this->quoteIdentifierChain([$identifier]); | ||
} | ||
|
||
/** | ||
* {@inheritDoc} | ||
*/ | ||
public function quoteIdentifierChain($identifierChain) | ||
{ | ||
return '"' . implode('"."', (array) str_replace('"', '\\"', $identifierChain)) . '"'; | ||
if (is_string($identifierChain)) { | ||
$identifierChain = [$identifierChain]; | ||
} | ||
|
||
if (!$this->quoteIdentifiers) { | ||
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. White space after exclamation mark is missing. |
||
return implode($this->getIdentifierSeparator(), $identifierChain); | ||
} | ||
|
||
/** @var array $identifierChain */ | ||
foreach ($identifierChain as $key => $identifier) { | ||
$identifierChain[$key] = str_replace($this->quoteIdentifier[0], $this->quoteIdentifierTo, $identifier); | ||
} | ||
$chainGlue = $this->quoteIdentifier[1].$this->getIdentifierSeparator().$this->quoteIdentifier[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. White space before and after the dots is missing. |
||
|
||
return $this->quoteIdentifier[0].implode($chainGlue, $identifierChain).$this->quoteIdentifier[1]; | ||
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. White space before and after the dots is missing. |
||
} | ||
|
||
/** | ||
|
@@ -105,18 +115,19 @@ public function getQuoteValueSymbol() | |
public function quoteValue($value) | ||
{ | ||
trigger_error( | ||
'Attempting to quote a value in ' . get_class($this) . | ||
'Attempting to quote a value in '.get_class($this). | ||
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 revert, the white space was correct. |
||
' without extension/driver support can introduce security vulnerabilities in a production environment' | ||
); | ||
return '\'' . addcslashes((string) $value, "\x00\n\r\\'\"\x1a") . '\''; | ||
|
||
return '\''.addcslashes((string) $value, "\x00\n\r\\'\"\x1a").'\''; | ||
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 revert, the white space was correct. |
||
} | ||
|
||
/** | ||
* {@inheritDoc} | ||
*/ | ||
public function quoteTrustedValue($value) | ||
{ | ||
return '\'' . addcslashes((string) $value, "\x00\n\r\\'\"\x1a") . '\''; | ||
return '\''.addcslashes((string) $value, "\x00\n\r\\'\"\x1a").'\''; | ||
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 revert, the white space was correct. |
||
} | ||
|
||
/** | ||
|
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.
Please revert. The topic of this PR is "Delegate quoteIdentifier operation to quoteIdentifierChain" and not fixing the CS!
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.
Are you reviewing old commits by accident? I think this is before you told me not to run outdated CS fixer in another PR. I redid all my other PRs same evening, including this one.