Difference between revisions of "Issue:Split() is deprecated"
From FollowTheScore
(Created page with "{{Issue |Type = Bug |Extension = DPL |Version = 1.8.9 |Description = Replace split() with explode() |Status = open }} == Problem == In PHP 5.3, the <code>...") |
(→Problem: diff) |
||
Line 10: | Line 10: | ||
In PHP 5.3, the <code>split()</code> function is deprecated. DPL uses this function, and as a result, PHP warnings are logged. Replace all <code>split()</code> calls in DPL code to be <code>explode()</code> instead. | In PHP 5.3, the <code>split()</code> function is deprecated. DPL uses this function, and as a result, PHP warnings are logged. Replace all <code>split()</code> calls in DPL code to be <code>explode()</code> instead. | ||
+ | === Diff against DPL 1.8.9 === | ||
+ | |||
+ | <pre> | ||
+ | Index: DPL.php | ||
+ | =================================================================== | ||
+ | --- DPL.php (revision 15950) | ||
+ | +++ DPL.php (working copy) | ||
+ | @@ -600,7 +600,7 @@ | ||
+ | $rulesText = str_replace(";",'°',$rulesText); | ||
+ | $rulesText = str_replace('\°',';',$rulesText); | ||
+ | $rulesText = str_replace("\\n","\n",$rulesText); | ||
+ | - $rules=split('°',$rulesText); | ||
+ | + $rules=explode('°',$rulesText); | ||
+ | $exec='edit'; | ||
+ | $replaceThis=''; | ||
+ | $replacement=''; | ||
+ | @@ -968,7 +968,7 @@ | ||
+ | if (($cbrackets==2 && $c=='|') || ($cbrackets==1 && $c=='}')) { | ||
+ | // parameter (name / value) found | ||
+ | |||
+ | - $token = split('=',$parm,2); | ||
+ | + $token = explode('=',$parm,2); | ||
+ | if (count($token)==2) { | ||
+ | // we need a pair of name / value | ||
+ | $parmName=trim($token[0]); | ||
+ | @@ -1054,7 +1054,7 @@ | ||
+ | $rulesText = str_replace(";",'°',$rulesText); | ||
+ | $rulesText = str_replace('\°',';',$rulesText); | ||
+ | $rulesText = str_replace("\\n","\n",$rulesText); | ||
+ | - $rules=split('°',$rulesText); | ||
+ | + $rules=explode('°',$rulesText); | ||
+ | $exec=false; | ||
+ | $message= ''; | ||
+ | $reason=''; | ||
+ | Index: DPLSetup.php | ||
+ | =================================================================== | ||
+ | --- DPLSetup.php (revision 15950) | ||
+ | +++ DPLSetup.php (working copy) | ||
+ | @@ -1332,7 +1332,7 @@ | ||
+ | |||
+ | public static function dplMatrixParserFunction(&$parser, $name, $yes, $no, $flip, $matrix ) { | ||
+ | $arg_list = func_get_args(); | ||
+ | - $lines = split("\n",$matrix); | ||
+ | + $lines = explode("\n",$matrix); | ||
+ | $m = array(); | ||
+ | $sources = array(); | ||
+ | $targets = array(); | ||
+ | Index: DPLMain.php | ||
+ | =================================================================== | ||
+ | --- DPLMain.php (revision 15950) | ||
+ | +++ DPLMain.php (working copy) | ||
+ | @@ -2981,12 +2981,12 @@ | ||
+ | foreach ($aSecLabels as $colgroup => $label) { | ||
+ | $t++; | ||
+ | $groupNr++; | ||
+ | - $cols = split('}:',$label); | ||
+ | + $cols = explode('}:',$label); | ||
+ | if (count($cols)<=1) { | ||
+ | if (array_key_exists($t,$tableRow)) $aTableRow[$groupNr]=$tableRow[$t]; | ||
+ | } | ||
+ | else { | ||
+ | - $n=count(split(':',$cols[1])); | ||
+ | + $n=count(explode(':',$cols[1])); | ||
+ | $colNr=-1; | ||
+ | $t--; | ||
+ | for ($i=1;$i<=$n;$i++) { | ||
+ | </pre> | ||
== Reply == | == Reply == |
Latest revision as of 21:45, 19 April 2011
Description: | Replace split() with explode() |
Extension / Version: | DPL / 1.8.9 |
Type / Status: | Bug / open |
Problem
In PHP 5.3, the split()
function is deprecated. DPL uses this function, and as a result, PHP warnings are logged. Replace all split()
calls in DPL code to be explode()
instead.
Diff against DPL 1.8.9
Index: DPL.php =================================================================== --- DPL.php (revision 15950) +++ DPL.php (working copy) @@ -600,7 +600,7 @@ $rulesText = str_replace(";",'°',$rulesText); $rulesText = str_replace('\°',';',$rulesText); $rulesText = str_replace("\\n","\n",$rulesText); - $rules=split('°',$rulesText); + $rules=explode('°',$rulesText); $exec='edit'; $replaceThis=''; $replacement=''; @@ -968,7 +968,7 @@ if (($cbrackets==2 && $c=='|') || ($cbrackets==1 && $c=='}')) { // parameter (name / value) found - $token = split('=',$parm,2); + $token = explode('=',$parm,2); if (count($token)==2) { // we need a pair of name / value $parmName=trim($token[0]); @@ -1054,7 +1054,7 @@ $rulesText = str_replace(";",'°',$rulesText); $rulesText = str_replace('\°',';',$rulesText); $rulesText = str_replace("\\n","\n",$rulesText); - $rules=split('°',$rulesText); + $rules=explode('°',$rulesText); $exec=false; $message= ''; $reason=''; Index: DPLSetup.php =================================================================== --- DPLSetup.php (revision 15950) +++ DPLSetup.php (working copy) @@ -1332,7 +1332,7 @@ public static function dplMatrixParserFunction(&$parser, $name, $yes, $no, $flip, $matrix ) { $arg_list = func_get_args(); - $lines = split("\n",$matrix); + $lines = explode("\n",$matrix); $m = array(); $sources = array(); $targets = array(); Index: DPLMain.php =================================================================== --- DPLMain.php (revision 15950) +++ DPLMain.php (working copy) @@ -2981,12 +2981,12 @@ foreach ($aSecLabels as $colgroup => $label) { $t++; $groupNr++; - $cols = split('}:',$label); + $cols = explode('}:',$label); if (count($cols)<=1) { if (array_key_exists($t,$tableRow)) $aTableRow[$groupNr]=$tableRow[$t]; } else { - $n=count(split(':',$cols[1])); + $n=count(explode(':',$cols[1])); $colNr=-1; $t--; for ($i=1;$i<=$n;$i++) {