Page Menu
Home
In-Portal Phabricator
Search
Configure Global Search
Log In
Files
F776210
D113.id.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Thu, Feb 6, 9:55 PM
Size
1 KB
Mime Type
text/x-diff
Expires
Fri, Feb 7, 9:55 PM (2 h, 48 m)
Engine
blob
Format
Raw Data
Handle
558665
Attached To
D113: INP-1463 - Use "http_build_query" for file editing link building
D113.id.diff
View Options
Index: branches/5.3.x/core/kernel/utility/debugger.php
===================================================================
--- branches/5.3.x/core/kernel/utility/debugger.php
+++ branches/5.3.x/core/kernel/utility/debugger.php
@@ -383,6 +383,13 @@
private $_isAjax = false;
/**
+ * Data, parsed from the editor url.
+ *
+ * @var array
+ */
+ protected $editorUrlData = array('url' => '', 'params' => array());
+
+ /**
* Creates instance of debugger
*/
public function __construct()
@@ -489,6 +496,24 @@
foreach ($dbg_constMap as $dbg_constName => $dbg_constValue) {
DebuggerUtil::safeDefine($dbg_constName, $dbg_constValue);
}
+
+ $this->parseEditorUrl();
+ }
+
+ /**
+ * Parses editor url.
+ *
+ * @return void
+ */
+ protected function parseEditorUrl()
+ {
+ $components = parse_url(DBG_EDITOR_URL);
+
+ $this->editorUrlData['url'] = $components['scheme'] . '://' . $components['host'] . $components['path'];
+
+ if ( isset($components['query']) ) {
+ parse_str(html_entity_decode($components['query']), $this->editorUrlData['params']);
+ }
}
/**
@@ -986,8 +1011,18 @@
$title = str_replace('/', '\\', $this->getLocalFile($file));
}
- $url = str_replace('%F', $this->getLocalFile($file), DBG_EDITOR_URL);
- $url = str_replace('%L', $line_number, $url);
+ $local_file = $this->getLocalFile($file);
+ $url_params = $this->editorUrlData['params'];
+
+ foreach ( $url_params as $param_name => $param_value ) {
+ $url_params[$param_name] = str_replace(
+ array('%F', '%L'),
+ array($local_file, $line_number),
+ $param_value
+ );
+ }
+
+ $url = $this->editorUrlData['url'] . '?' . http_build_query($url_params);
return '<a href="' . $url . '">' . $title . '</a>';
}
@@ -2086,4 +2121,4 @@
if ( DebuggerUtil::constOn('DBG_USE_SHUTDOWN_FUNC') ) {
register_shutdown_function(array(&$debugger, 'printReport'), false, true, true);
}
- }
\ No newline at end of file
+ }
Event Timeline
Log In to Comment