mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
BUGFIX: prevented HTTPRequest->shift() throwing notices when shifting multiple elements. APICHANGE: SS_HTTPRequest->shift($multiple) no longer returns an array of size $multiple spaced with nulls, it returns an array up to the size of $multiple. (from r107090)
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@112548 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
7fb414818a
commit
fbbe0b4b39
@ -452,10 +452,25 @@ class SS_HTTPRequest implements ArrayAccess {
|
|||||||
/**
|
/**
|
||||||
* Shift one or more parts off the beginning of the URL.
|
* Shift one or more parts off the beginning of the URL.
|
||||||
* If you specify shifting more than 1 item off, then the items will be returned as an array
|
* If you specify shifting more than 1 item off, then the items will be returned as an array
|
||||||
|
*
|
||||||
|
* @param int $count Shift Count
|
||||||
|
*
|
||||||
|
* @return String|Array
|
||||||
*/
|
*/
|
||||||
function shift($count = 1) {
|
function shift($count = 1) {
|
||||||
|
$return = array();
|
||||||
|
|
||||||
if($count == 1) return array_shift($this->dirParts);
|
if($count == 1) return array_shift($this->dirParts);
|
||||||
else for($i=0;$i<$count;$i++) $return[] = array_shift($this->dirParts);
|
|
||||||
|
for($i=0;$i<$count;$i++) {
|
||||||
|
$value = array_shift($this->dirParts);
|
||||||
|
|
||||||
|
if(!$value) break;
|
||||||
|
|
||||||
|
$return[] = $value;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user