Skip to content
This repository
Browse code

MINOR Replaced use of deprecated split() with preg_split() and fixed …

…use of "&new Class()" which is deprecated in PHP 5.3

ENHANCEMENT E_DEPRECATED and E_USER_DEPRECATED are now handled as notice level errors in Debug.
  • Loading branch information...
commit cf014dc56d38868fda09e1466845aa8c8a3439f4 1 parent a4b668d
Sean Harvey authored March 27, 2012
8  admin/code/CMSBatchActionHandler.php
@@ -81,7 +81,7 @@ function handleAction($request) {
81 81
 		$actionHandler = new $actionClass();
82 82
 		
83 83
 		// Sanitise ID list and query the database for apges
84  
-		$ids = split(' *, *', trim($request->requestVar('csvIDs')));
  84
+		$ids = preg_split('/ *, */', trim($request->requestVar('csvIDs')));
85 85
 		foreach($ids as $k => $v) if(!is_numeric($v)) unset($ids[$k]);
86 86
 		
87 87
 		if($ids) {
@@ -135,7 +135,7 @@ function handleApplicablePages($request) {
135 135
 		$actionHandler = new $actionClass['class']();
136 136
 
137 137
 		// Sanitise ID list and query the database for apges
138  
-		$ids = split(' *, *', trim($request->requestVar('csvIDs')));
  138
+		$ids = preg_split('/ *, */', trim($request->requestVar('csvIDs')));
139 139
 		foreach($ids as $k => $id) $ids[$k] = (int)$id;
140 140
 		$ids = array_filter($ids);
141 141
 		
@@ -157,7 +157,7 @@ function handleConfirmation($request) {
157 157
 		$actionHandler = new $actionClass();
158 158
 
159 159
 		// Sanitise ID list and query the database for apges
160  
-		$ids = split(' *, *', trim($request->requestVar('csvIDs')));
  160
+		$ids = preg_split('/ *, */', trim($request->requestVar('csvIDs')));
161 161
 		foreach($ids as $k => $id) $ids[$k] = (int)$id;
162 162
 		$ids = array_filter($ids);
163 163
 		
@@ -211,4 +211,4 @@ function batchActions() {
211 211
 		return $actions;
212 212
 	}
213 213
 
214  
-}
  214
+}
2  core/Core.php
@@ -38,7 +38,7 @@
38 38
 ///////////////////////////////////////////////////////////////////////////////
39 39
 // ENVIRONMENT CONFIG
40 40
 
41  
-if(defined('E_DEPRECATED')) error_reporting(E_ALL & ~(E_DEPRECATED | E_STRICT));
  41
+if(defined('E_DEPRECATED')) error_reporting(E_ALL & ~(E_STRICT));
42 42
 else error_reporting(E_ALL);
43 43
 
44 44
 /**
2  core/Diff.php
@@ -800,7 +800,7 @@ static function getHTMLChunks($content) {
800 800
 		if(is_array($content)) $content = implode(',', $content);
801 801
 		
802 802
 		$content = str_replace(array("&nbsp;","<", ">"),array(" "," <", "> "),$content);
803  
-		$candidateChunks = split("[\t\r\n ]+", $content);
  803
+		$candidateChunks = preg_split("/[\t\r\n ]+/", $content);
804 804
 		while(list($i,$item) = each($candidateChunks)) {
805 805
 			if(isset($item[0]) && $item[0] == "<") {
806 806
 				$newChunk = $item;
1  dev/Debug.php
@@ -697,6 +697,7 @@ function errorHandler($errno, $errstr, $errfile, $errline) {
697 697
 
698 698
 		case E_NOTICE:
699 699
 		case E_USER_NOTICE:
  700
+		case E_DEPRECATED:
700 701
 		case E_USER_DEPRECATED:
701 702
 			Debug::noticeHandler($errno, $errstr, $errfile, $errline, null);
702 703
 			break;
4  dev/DebugView.php
@@ -30,6 +30,10 @@ class DebugView extends Object {
30 30
 			'title' => 'User Notice',
31 31
 			'class' => 'notice'
32 32
 		),
  33
+		E_DEPRECATED => array(
  34
+			'title' => 'Deprecation',
  35
+			'class' => 'notice'
  36
+		),
33 37
 		E_USER_DEPRECATED => array(
34 38
 			'title' => 'Deprecation',
35 39
 			'class' => 'notice'
6  thirdparty/simpletest/form.php
@@ -172,7 +172,7 @@ function _setWidget(&$tag) {
172 172
      */
173 173
     function _addRadioButton(&$tag) {
174 174
         if (! isset($this->_radios[$tag->getName()])) {
175  
-            $this->_widgets[] = &new SimpleRadioGroup();
  175
+            $this->_widgets[] = new SimpleRadioGroup();
176 176
             $this->_radios[$tag->getName()] = count($this->_widgets) - 1;
177 177
         }
178 178
         $this->_widgets[$this->_radios[$tag->getName()]]->addWidget($tag);
@@ -191,7 +191,7 @@ function _addCheckbox(&$tag) {
191 191
             $index = $this->_checkboxes[$tag->getName()];
192 192
             if (! SimpleTestCompatibility::isA($this->_widgets[$index], 'SimpleCheckboxGroup')) {
193 193
                 $previous = &$this->_widgets[$index];
194  
-                $this->_widgets[$index] = &new SimpleCheckboxGroup();
  194
+                $this->_widgets[$index] = new SimpleCheckboxGroup();
195 195
                 $this->_widgets[$index]->addWidget($previous);
196 196
             }
197 197
             $this->_widgets[$index]->addWidget($tag);
@@ -352,4 +352,4 @@ function submit() {
352 352
         return $this->_encode();
353 353
     }
354 354
 }
355  
-?>
  355
+?>
14  thirdparty/simpletest/http.php
@@ -98,9 +98,9 @@ function &createConnection($method, $timeout) {
98 98
      */
99 99
     function &_createSocket($scheme, $host, $port, $timeout) {
100 100
         if (in_array($scheme, array('https'))) {
101  
-            $socket = &new SimpleSecureSocket($host, $port, $timeout);
  101
+            $socket = new SimpleSecureSocket($host, $port, $timeout);
102 102
         } else {
103  
-            $socket = &new SimpleSocket($host, $port, $timeout);
  103
+            $socket = new SimpleSocket($host, $port, $timeout);
104 104
         }
105 105
         return $socket;
106 106
     }
@@ -279,7 +279,7 @@ function readCookiesFromJar($jar, $url) {
279 279
      *    @access protected
280 280
      */
281 281
     function &_createResponse(&$socket) {
282  
-        $response = &new SimpleHttpResponse(
  282
+        $response = new SimpleHttpResponse(
283 283
                 $socket,
284 284
                 $this->_route->getUrl(),
285 285
                 $this->_encoding);
@@ -516,13 +516,13 @@ function SimpleHttpResponse(&$socket, $url, $encoding) {
516 516
     function _parse($raw) {
517 517
         if (! $raw) {
518 518
             $this->_setError('Nothing fetched');
519  
-            $this->_headers = &new SimpleHttpHeaders('');
  519
+            $this->_headers = new SimpleHttpHeaders('');
520 520
         } elseif (! strstr($raw, "\r\n\r\n")) {
521 521
             $this->_setError('Could not split headers from content');
522  
-            $this->_headers = &new SimpleHttpHeaders($raw);
  522
+            $this->_headers = new SimpleHttpHeaders($raw);
523 523
         } else {
524 524
             list($headers, $this->_content) = split("\r\n\r\n", $raw, 2);
525  
-            $this->_headers = &new SimpleHttpHeaders($headers);
  525
+            $this->_headers = new SimpleHttpHeaders($headers);
526 526
         }
527 527
     }
528 528
     
@@ -621,4 +621,4 @@ function _isLastPacket($packet) {
621 621
         return ! $packet;
622 622
     }
623 623
 }
624  
-?>
  624
+?>
10  thirdparty/simpletest/page.php
@@ -163,7 +163,7 @@ function &parse($response) {
163 163
      *    @access protected
164 164
      */
165 165
     function &_createPage($response) {
166  
-        $page = &new SimplePage($response);
  166
+        $page = new SimplePage($response);
167 167
         return $page;
168 168
     }
169 169
 
@@ -175,7 +175,7 @@ function &_createPage($response) {
175 175
      *    @access protected
176 176
      */
177 177
     function &_createParser(&$listener) {
178  
-        $parser = &new SimpleHtmlSaxParser($listener);
  178
+        $parser = new SimpleHtmlSaxParser($listener);
179 179
         return $parser;
180 180
     }
181 181
     
@@ -188,7 +188,7 @@ function &_createParser(&$listener) {
188 188
      *    @access public
189 189
      */
190 190
     function startElement($name, $attributes) {
191  
-        $factory = &new SimpleTagBuilder();
  191
+        $factory = new SimpleTagBuilder();
192 192
         $tag = $factory->createTag($name, $attributes);
193 193
         if (! $tag) {
194 194
             return true;
@@ -641,7 +641,7 @@ function _isFormElement($name) {
641 641
      *    @access public
642 642
      */
643 643
     function acceptFormStart(&$tag) {
644  
-        $this->_open_forms[] = &new SimpleForm($tag, $this);
  644
+        $this->_open_forms[] = new SimpleForm($tag, $this);
645 645
     }
646 646
 
647 647
     /**
@@ -980,4 +980,4 @@ function getField($selector) {
980 980
         return null;
981 981
     }
982 982
 }
983  
-?>
  983
+?>
6  thirdparty/simpletest/parser.php
@@ -197,7 +197,7 @@ function SimpleLexer(&$parser, $start = "accept", $case = false) {
197 197
         $this->_case = $case;
198 198
         $this->_regexes = array();
199 199
         $this->_parser = &$parser;
200  
-        $this->_mode = &new SimpleStateStack($start);
  200
+        $this->_mode = new SimpleStateStack($start);
201 201
         $this->_mode_handlers = array($start => $start);
202 202
     }
203 203
     
@@ -579,7 +579,7 @@ function parse($raw) {
579 579
      *    @static
580 580
      */
581 581
     function &createLexer(&$parser) {
582  
-        $lexer = &new SimpleHtmlLexer($parser);
  582
+        $lexer = new SimpleHtmlLexer($parser);
583 583
         return $lexer;
584 584
     }
585 585
     
@@ -761,4 +761,4 @@ function endElement($name) {
761 761
     function addContent($text) {
762 762
     }
763 763
 }
764  
-?>
  764
+?>
8  thirdparty/simpletest/url.php
@@ -106,7 +106,7 @@ function _chompLogin(&$url) {
106 106
         }
107 107
         if (preg_match('/^([^\/]*)@(.*)/', $url, $matches)) {
108 108
             $url = $prefix . $matches[2];
109  
-            $parts = split(":", $matches[1]);
  109
+            $parts = preg_split('/:/', $matches[1]);
110 110
             return array(
111 111
                     urldecode($parts[0]),
112 112
                     isset($parts[1]) ? urldecode($parts[1]) : false);
@@ -184,7 +184,7 @@ function _chompRequest(&$url) {
184 184
     function _parseRequest($raw) {
185 185
         $this->_raw = $raw;
186 186
         $request = new SimpleGetEncoding();
187  
-        foreach (split("&", $raw) as $pair) {
  187
+        foreach (preg_split('/&/', $raw) as $pair) {
188 188
             if (preg_match('/(.*?)=(.*)/', $pair, $matches)) {
189 189
                 $request->add($matches[1], urldecode($matches[2]));
190 190
             } elseif ($pair) {
@@ -379,7 +379,7 @@ function addRequestParameters($parameters) {
379 379
      */
380 380
     function clearRequest() {
381 381
         $this->_raw = false;
382  
-        $this->_request = &new SimpleGetEncoding();
  382
+        $this->_request = new SimpleGetEncoding();
383 383
     }
384 384
     
385 385
     /**
@@ -525,4 +525,4 @@ function getAllTopLevelDomains() {
525 525
         return 'com|edu|net|org|gov|mil|int|biz|info|name|pro|aero|coop|museum';
526 526
     }
527 527
 }
528  
-?>
  528
+?>

0 notes on commit cf014dc

Please sign in to comment.
Something went wrong with that request. Please try again.