Page Menu
Home
In-Portal Phabricator
Search
Configure Global Search
Log In
Files
F773070
D111.id337.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
Sun, Feb 2, 12:55 AM
Size
2 KB
Mime Type
text/x-diff
Expires
Mon, Feb 3, 12:55 AM (12 h, 43 m)
Engine
blob
Format
Raw Data
Handle
556333
Attached To
D111: INP-1461 - Print only first 50 elements for long arrays in Debugger
D111.id337.diff
View Options
Index: branches/5.2.x/core/kernel/utility/debugger.php
===================================================================
--- branches/5.2.x/core/kernel/utility/debugger.php
+++ branches/5.2.x/core/kernel/utility/debugger.php
@@ -698,45 +698,54 @@
}
/**
- * Advanced version of print_r (for debugger only). Don't print objects recursively
+ * Advanced version of print_r (for debugger only). Don't print objects recursively.
+ *
+ * @param mixed $p_array Value to be printed.
+ * @param boolean $return_output Return output or print it out.
+ * @param integer $tab_count Offset in tabs.
*
- * @param Array $array
- * @param bool $return_output return output or print it out
- * @param int $tab_count offset in tabs
* @return string
- * @access private
*/
- private function print_r(&$array, $return_output = false, $tab_count = -1)
+ private function print_r(&$p_array, $return_output = false, $tab_count = -1)
{
static $first_line = true;
// not an array at all
- if ( !is_array($array) ) {
- switch ( gettype($array) ) {
+ if ( !is_array($p_array) ) {
+ switch ( gettype($p_array) ) {
case 'NULL':
return 'NULL' . "\n";
break;
case 'object':
- return $this->processObject($array, $tab_count);
+ return $this->processObject($p_array, $tab_count);
break;
case 'resource':
- return (string)$array . "\n";
+ return (string)$p_array . "\n";
break;
default:
// number or string
- if ( strlen($array) > 200 ) {
- $array = substr($array, 0, 50) . ' ...';
+ if ( strlen($p_array) > 200 ) {
+ $p_array = substr($p_array, 0, 50) . ' ...';
}
- return $array . "\n";
+
+ return $p_array . "\n";
break;
}
}
$output = '';
+ if ( count($p_array) > 50 ) {
+ $array = array_slice($p_array, 0, 50);
+ $array[] = '...';
+ }
+ else {
+ $array = $p_array;
+ }
+
$tab_count++;
$output .= "Array\n" . str_repeat(' ', $tab_count) . "(\n";
Event Timeline
Log In to Comment