Skip to content

Commit bab41d1

Browse files
authored
Fix passing null to preg_split limit param (OpenMage#2616)
1 parent 47c8177 commit bab41d1

File tree

6 files changed

+7
-7
lines changed

6 files changed

+7
-7
lines changed

app/code/core/Mage/Core/Helper/Data.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,7 @@ public function isDevAllowed($storeId = null)
396396
$allowedIps = Mage::getStoreConfig(self::XML_PATH_DEV_ALLOW_IPS, $storeId);
397397
$remoteAddr = Mage::helper('core/http')->getRemoteAddr();
398398
if (!empty($allowedIps) && !empty($remoteAddr)) {
399-
$allowedIps = preg_split('#\s*,\s*#', $allowedIps, null, PREG_SPLIT_NO_EMPTY);
399+
$allowedIps = preg_split('#\s*,\s*#', $allowedIps, -1, PREG_SPLIT_NO_EMPTY);
400400
if (array_search($remoteAddr, $allowedIps) === false
401401
&& array_search(Mage::helper('core/http')->getHttpHost(), $allowedIps) === false) {
402402
$allow = false;

app/code/core/Mage/Core/Helper/String.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ public function str_split($str, $length = 1, $keepWords = false, $trim = false,
183183
}
184184
} // split smartly, keeping words
185185
else {
186-
$split = preg_split('/(' . $wordSeparatorRegex . '+)/siu', $str, null, PREG_SPLIT_DELIM_CAPTURE);
186+
$split = preg_split('/(' . $wordSeparatorRegex . '+)/siu', $str, -1, PREG_SPLIT_DELIM_CAPTURE);
187187
$i = 0;
188188
$space = '';
189189
$spaceLen = 0;
@@ -253,7 +253,7 @@ public function str_split($str, $length = 1, $keepWords = false, $trim = false,
253253
public function splitWords($str, $uniqueOnly = false, $maxWordLength = 0, $wordSeparatorRegexp = '\s')
254254
{
255255
$result = [];
256-
$split = preg_split('#' . $wordSeparatorRegexp . '#siu', $str, null, PREG_SPLIT_NO_EMPTY);
256+
$split = preg_split('#' . $wordSeparatorRegexp . '#siu', $str, -1, PREG_SPLIT_NO_EMPTY);
257257
foreach ($split as $word) {
258258
if ($uniqueOnly) {
259259
$result[$word] = $word;

app/code/core/Mage/Cron/Model/Schedule.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public function _construct()
6666
*/
6767
public function setCronExpr($expr)
6868
{
69-
$e = preg_split('#\s+#', $expr, null, PREG_SPLIT_NO_EMPTY);
69+
$e = preg_split('#\s+#', $expr, -1, PREG_SPLIT_NO_EMPTY);
7070
if (count($e) < 5 || count($e) > 6) {
7171
throw Mage::exception('Mage_Cron', 'Invalid cron expression: '.$expr);
7272
}

app/code/core/Mage/Rule/Model/Condition/Abstract.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ public function getValueParsed()
338338
if (!$this->hasValueParsed()) {
339339
$value = $this->getData('value');
340340
if ($this->isArrayOperatorType() && is_string($value)) {
341-
$value = preg_split('#\s*[,;]\s*#', $value, null, PREG_SPLIT_NO_EMPTY);
341+
$value = preg_split('#\s*[,;]\s*#', $value, -1, PREG_SPLIT_NO_EMPTY);
342342
}
343343
$this->setValueParsed($value);
344344
}

lib/Varien/Db/Adapter/Pdo/Mysql.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -721,7 +721,7 @@ public function multi_query($sql)
721721
*/
722722
protected function _splitMultiQuery($sql)
723723
{
724-
$parts = preg_split('#(;|\'|"|\\\\|//|--|\n|/\*|\*/)#', $sql, null,
724+
$parts = preg_split('#(;|\'|"|\\\\|//|--|\n|/\*|\*/)#', $sql, -1,
725725
PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE
726726
);
727727

lib/Varien/Event/Observer/Cron.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ class Varien_Event_Observer_Cron extends Varien_Event_Observer
4141
*/
4242
public function isValidFor(Varien_Event $event)
4343
{
44-
$e = preg_split('#\s+#', $this->getCronExpr(), null, PREG_SPLIT_NO_EMPTY);
44+
$e = preg_split('#\s+#', $this->getCronExpr(), -1, PREG_SPLIT_NO_EMPTY);
4545
if (count($e) !== 5) {
4646
return false;
4747
}

0 commit comments

Comments
 (0)