diff options
author | Andrey Andreev <narf@bofh.bg> | 2012-03-02 01:02:45 +0100 |
---|---|---|
committer | Andrey Andreev <narf@bofh.bg> | 2012-03-02 01:02:45 +0100 |
commit | 376ac97d5581c23c88ad3cbbce39f3515ff5fd06 (patch) | |
tree | b92ef9fddeead0e38d16577240a22345983c77c2 | |
parent | c667a7e1555bfc6916f01c2a625814ae362a1728 (diff) | |
parent | 963386ba6072d240840b58d6dbe54287edcb04ad (diff) |
Merge upstream branch
-rw-r--r-- | system/helpers/text_helper.php | 22 | ||||
-rw-r--r-- | system/libraries/Profiler.php | 12 | ||||
-rw-r--r-- | user_guide_src/source/changelog.rst | 1 |
3 files changed, 12 insertions, 23 deletions
diff --git a/system/helpers/text_helper.php b/system/helpers/text_helper.php index 842a31d75..6e9ea570f 100644 --- a/system/helpers/text_helper.php +++ b/system/helpers/text_helper.php @@ -300,9 +300,9 @@ if ( ! function_exists('highlight_code')) // Replace any existing PHP tags to temporary markers so they don't accidentally // break the string out of PHP, and thus, thwart the highlighting. - $str = str_replace(array('<?', '?>', '<%', '%>', '\\', '</script>'), - array('phptagopen', 'phptagclose', 'asptagopen', 'asptagclose', 'backslashtmp', 'scriptclose'), $str); + array('phptagopen', 'phptagclose', 'asptagopen', 'asptagclose', 'backslashtmp', 'scriptclose'), + $str); // The highlight_string function requires that the text be surrounded // by PHP tags, which we will remove later @@ -311,25 +311,15 @@ if ( ! function_exists('highlight_code')) // All the magic happens here, baby! $str = highlight_string($str, TRUE); - // Prior to PHP 5, the highligh function used icky <font> tags - // so we'll replace them with <span> tags. - - if (abs(PHP_VERSION) < 5) - { - $str = str_replace(array('<font ', '</font>'), array('<span ', '</span>'), $str); - $str = preg_replace('#color="(.*?)"#', 'style="color: \\1"', $str); - } - // Remove our artificially added PHP, and the syntax highlighting that came with it $str = preg_replace('/<span style="color: #([A-Z0-9]+)"><\?php( | )/i', '<span style="color: #$1">', $str); $str = preg_replace('/(<span style="color: #[A-Z0-9]+">.*?)\?><\/span>\n<\/span>\n<\/code>/is', "$1</span>\n</span>\n</code>", $str); $str = preg_replace('/<span style="color: #[A-Z0-9]+"\><\/span>/i', '', $str); // Replace our markers back to PHP tags. - $str = str_replace(array('phptagopen', 'phptagclose', 'asptagopen', 'asptagclose', 'backslashtmp', 'scriptclose'), - array('<?', '?>', '<%', '%>', '\\', '</script>'), $str); - - return $str; + return str_replace(array('phptagopen', 'phptagclose', 'asptagopen', 'asptagclose', 'backslashtmp', 'scriptclose'), + array('<?', '?>', '<%', '%>', '\\', '</script>'), + $str); } } @@ -544,4 +534,4 @@ if ( ! function_exists('ellipsize')) } /* End of file text_helper.php */ -/* Location: ./system/helpers/text_helper.php */
\ No newline at end of file +/* Location: ./system/helpers/text_helper.php */ diff --git a/system/libraries/Profiler.php b/system/libraries/Profiler.php index 89c616543..04216be5d 100644 --- a/system/libraries/Profiler.php +++ b/system/libraries/Profiler.php @@ -270,7 +270,7 @@ class CI_Profiler { } $output .= "<tr><td style='width:50%;color:#000;background-color:#ddd;padding:5px'>$_GET[".$key."] </td><td style='width:50%;padding:5px;color:#cd6e00;font-weight:normal;background-color:#ddd;'>" - . (is_array($val) ? "<pre>" . htmlspecialchars(stripslashes(print_r($val, true))) . "</pre>" : htmlspecialchars(stripslashes($val))) + . ((is_array($val) OR is_object($val)) ? "<pre>" . htmlspecialchars(stripslashes(print_r($val, true))) . "</pre>" : htmlspecialchars(stripslashes($val))) . "</td></tr>\n"; } @@ -311,7 +311,7 @@ class CI_Profiler { } $output .= "<tr><td style='width:50%;padding:5px;color:#000;background-color:#ddd;'>$_POST[".$key."] </td><td style='width:50%;padding:5px;color:#009900;font-weight:normal;background-color:#ddd;'>"; - if (is_array($val)) + if (is_array($val) OR is_object($val)) { $output .= "<pre>" . htmlspecialchars(stripslashes(print_r($val, TRUE))) . "</pre>"; } @@ -426,9 +426,9 @@ class CI_Profiler { . '<legend style="color:#000;"> '.$this->CI->lang->line('profiler_config').' (<span style="cursor: pointer;" onclick="var s=document.getElementById(\'ci_profiler_config_table\').style;s.display=s.display==\'none\'?\'\':\'none\';this.innerHTML=this.innerHTML==\''.$this->CI->lang->line('profiler_section_show').'\'?\''.$this->CI->lang->line('profiler_section_hide').'\':\''.$this->CI->lang->line('profiler_section_show').'\';">'.$this->CI->lang->line('profiler_section_show').'</span>)</legend>' . "\n\n\n<table style='width:100%; display:none' id='ci_profiler_config_table'>\n"; - foreach ($this->CI->config->config as $config=>$val) + foreach ($this->CI->config->config as $config => $val) { - if (is_array($val)) + if (is_array($val) OR is_object($val)) { $val = print_r($val, TRUE); } @@ -459,7 +459,7 @@ class CI_Profiler { foreach ($this->CI->session->all_userdata() as $key => $val) { - if (is_array($val) || is_object($val)) + if (is_array($val) OR is_object($val)) { $val = print_r($val, TRUE); } @@ -501,7 +501,5 @@ class CI_Profiler { } } -// END CI_Profiler class - /* End of file Profiler.php */ /* Location: ./system/libraries/Profiler.php */ diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst index c7d377b16..1e602ad1c 100644 --- a/user_guide_src/source/changelog.rst +++ b/user_guide_src/source/changelog.rst @@ -129,6 +129,7 @@ Bug fixes for 3.0 - Fixed a bug in CUBRID's affected_rows() method where a connection resource was passed to cubrid_affected_rows() instead of a result. - Fixed a bug (#638) - db_set_charset() ignored its arguments and always used the configured charset and collation instead. - Fixed a bug (#413) - Oracle's _error_message() and _error_number() methods used to only return connection-related errors. +- Fixed a bug (#804) - Profiler library was trying to handle objects as strings in some cases, resulting in warnings being issued by htmlspecialchars(). - Fixed a bug in the Oracle (oci8) instance of :doc:`Database Forge Class <database/forge>` where create_table() would fail if used with AUTO_INCREMENT as it's not supported by Oracle. Version 2.1.1 |