r31331 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r31330‎ | r31331 | r31332 >
Date:22:53, 26 February 2008
Author:brion
Status:old
Tags:
Comment:
Merge fixes from trunk:
* (bug 13139, 13074) Fix request data for parameters with numeric names
* (bug 13086) Trackbacks were returning invalid XML (extra whitespace)
Modified paths:
  • /branches/REL1_12/phase3/RELEASE-NOTES (modified) (history)
  • /branches/REL1_12/phase3/includes/GlobalFunctions.php (modified) (history)
  • /branches/REL1_12/phase3/includes/WebRequest.php (modified) (history)
  • /branches/REL1_12/phase3/trackback.php (modified) (history)

Diff [purge]

Index: branches/REL1_12/phase3/includes/GlobalFunctions.php
@@ -1952,6 +1952,28 @@
19531953 }
19541954
19551955 /**
 1956+ * array_merge() does awful things with "numeric" indexes, including
 1957+ * string indexes when happen to look like integers. When we want
 1958+ * to merge arrays with arbitrary string indexes, we don't want our
 1959+ * arrays to be randomly corrupted just because some of them consist
 1960+ * of numbers.
 1961+ *
 1962+ * Fuck you, PHP. Fuck you in the ear!
 1963+ *
 1964+ * @param array $array1, [$array2, [...]]
 1965+ * @return array
 1966+ */
 1967+function wfArrayMerge( $array1/* ... */ ) {
 1968+ $out = $array1;
 1969+ for( $i = 1; $i < func_num_args(); $i++ ) {
 1970+ foreach( func_get_arg( $i ) as $key => $value ) {
 1971+ $out[$key] = $value;
 1972+ }
 1973+ }
 1974+ return $out;
 1975+}
 1976+
 1977+/**
19561978 * Make a URL index, appropriate for the el_index field of externallinks.
19571979 */
19581980 function wfMakeUrlIndex( $url ) {
Index: branches/REL1_12/phase3/includes/WebRequest.php
@@ -52,7 +52,7 @@
5353
5454 // POST overrides GET data
5555 // We don't use $_REQUEST here to avoid interference from cookies...
56 - $this->data = array_merge( $_GET, $_POST );
 56+ $this->data = wfArrayMerge( $_GET, $_POST );
5757 }
5858
5959 /**
Index: branches/REL1_12/phase3/trackback.php
@@ -11,8 +11,7 @@
1212 */
1313 function XMLsuccess() {
1414 header("Content-Type: application/xml; charset=utf-8");
15 - echo "
16 -<?xml version=\"1.0\" encoding=\"utf-8\"?>
 15+ echo "<?xml version=\"1.0\" encoding=\"utf-8\"?>
1716 <response>
1817 <error>0</error>
1918 </response>
@@ -23,8 +22,7 @@
2423 function XMLerror($err = "Invalid request.") {
2524 header("HTTP/1.0 400 Bad Request");
2625 header("Content-Type: application/xml; charset=utf-8");
27 - echo "
28 -<?xml version=\"1.0\" encoding=\"utf-8\"?>
 26+ echo "<?xml version=\"1.0\" encoding=\"utf-8\"?>
2927 <response>
3028 <error>1</error>
3129 <message>Invalid request: $err</message>
Index: branches/REL1_12/phase3/RELEASE-NOTES
@@ -397,6 +397,8 @@
398398 * (bug 13005) DISPLAYTITLE does not work on preview
399399 * (bug 13004) Fix error on Postgres searches that return too many results.
400400 * (bug 13022) Fix upload from URL on PHP 5.0.x
 401+* (bug 13139, 13074) Fix request data for parameters with numeric names
 402+* (bug 13086) Trackbacks were returning invalid XML (extra whitespace)
401403
402404 == Parser changes in 1.12 ==
403405

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r31327* (bug 13139, 13074) Fix request data for parameters with numeric namesbrion22:33, 26 February 2008
r31330* (bug 13086) Trackbacks were returning invalid XML (extra whitespace)brion22:47, 26 February 2008

Status & tagging log