GithubHelp home page GithubHelp logo

ccampbell / chromephp Goto Github PK

View Code? Open in Web Editor NEW
1.4K 76.0 451.0 327 KB

class for logging PHP variables to Google Chrome console

Home Page: http://www.chromelogger.com

PHP 100.00%
logging php console

chromephp's Introduction

Overview

ChromePhp is a PHP library for the Chrome Logger Google Chrome extension.

This library allows you to log variables to the Chrome console.

Requirements

  • PHP 5 or later

Installation

  1. Install the Chrome extension from: https://chrome.google.com/extensions/detail/noaneddfkdjfnfdakjjmocngnfkfehhd

  2. Click the extension icon in the browser to enable it for the current tab's domain

  3. Put ChromePhp.php somewhere in your PHP include path

  4. Log some data

    include 'ChromePhp.php';
    ChromePhp::log('Hello console!');
    ChromePhp::log($_SERVER);
    ChromePhp::warn('something went wrong!');

More information can be found here: http://www.chromelogger.com

chromephp's People

Contributors

ccampbell avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

chromephp's Issues

Make the constructor public

Is there any particular reason for changing the constructor method type from public to private? This class doesn't work in codeigniter unless I make the constructor public...

Warning: Cannot modify header information

Warning: Cannot modify header information - headers already sent by (output started at /Volumes/Backup/Sites/test/chromelogger/index.php:1) in /Volumes/Backup/Sites/test/chromelogger/ChromePhp.php on line 394

just put this

<?php
   require 'ChromePhp.php';
   ChromePhp::log('Hello console!');
?>

Example for ChromePhp::table()

Could you add an example of how to use the table type? Not really understanding how to use it properly... like... what do I pass in there? 🤔

Tried looking in the techspecs and in ChromePhp.php, but yeah... not feeling any wiser 😕

Only the first message written to console.log

Hi. I'm relatively new to php/web design in general so apols if this is is numpty question.

I've performed the install step including the Chrome Extension (and numerous reboots etc) as described in the ChromePhp page and attempted to run the code on my local server using the simple hello world example you provided:

include 'ChromePhp.php';
ChromePhp::log('Hello console!');
ChromePhp::log($_SERVER);
ChromePhp::warn('something went wrong!');

However, no matter what I do only the first message appears in the console.log.

Any ideas what I am doing wrong?

Cheers.

a lot of logs throws 502 in nginx

Error in nginx log:
2011/12/16 11:02:57 [error] 13912#0: *5 upstream sent too big header while reading response header from upstream,...
Client received HTTP/1.0 502 ...

fix:

@@ -602,6 +602,12 @@
*/
protected function _writeToFile($json)
{

  •    static $setCookie;
    
  •    if (!empty($setCookie)) {
    
  •        return $setCookie;
    
  •    }
    
    • // if the log path is not setup then create it
      if (!is_dir($this->getSetting(self::LOG_PATH))) {
      mkdir($this->getSetting(self::LOG_PATH));
    and
  •     return $this->_setCookie($data);
    
  •    return $setCookie = $this->_setCookie($data);
    

Auto include on every page

In php.ini there is a config option called auto_prepend_file.

http://www.php.net/manual/en/ini.core.php#ini.auto-prepend-file

If you set that option to something like

auto_prepend_file = /var/www/ChromePhp.php

Then the script will be automatically be included on every page. It's great for when you're working on a team project and not everyone is using the same environment as you. You don't have to commit ChromePhp to your version control system or leave include statements all over the place. It also just saves time in general.

Perhaps you could add this information to the Readme? I'm sure a lot of people would benefit from this knowledge.

Premature end of script headers

Just as #10 I get problem with the headers. My stack: apache2, mod_proxy_fcgi, php-fpm.
The application crashes with a white screen and in the logs I see "Premature end of script headers". When disabling chromelogger, everything works fine.

Does anyone know which setting I should change in my setup (apache 2, mod_proxy_fcgi, php-fpm) to allow the bigger http headers?

Thanks!

Logging binary data

I stumbled upon that adding binary data to the log makes the header added be completely blank. Turns out it dies on the json_encode of binary data. The easy fix was to utf8_encode it:
`
protected static function _log($type, array $args)
{
// nothing passed in, don't do anything
if (count($args) == 0 && $type != self::GROUP_END) {
return;
}

    $logger = self::getInstance();

    $logger->_processed = array();

    $logs = array();
    foreach ($args as $arg) {
        $logs[] = $logger->_convert(utf8_encode($arg)); //added to fix logging binary data
    }
    
    $backtrace = debug_backtrace(false);
    $level = $logger->getSetting(self::BACKTRACE_LEVEL);

    $backtrace_message = 'unknown';
    if (isset($backtrace[$level]['file']) && isset($backtrace[$level]['line'])) {
        $backtrace_message = $backtrace[$level]['file'] . ' : ' . $backtrace[$level]['line'];
    }

    $logger->_addRow($logs, $backtrace_message, $type);
}

`

Should probably be done for the other logging alias methods (error, warn, etc).
Should I do a pull request with this? Seems very minor. Thanks!

json_encode returns empty string if logged object property is a Resource or has some "weird" chars.

I'm trying to log a object representing a AD user (using Adldap2 library) and x-chromelogger-data header contains empty string. After some digging I've found (I think) that these properties are causing problems for json_encode:

object(Adldap\Connections\Ldap)#5 (4) { ["connection":protected]=> resource(1) of type (ldap link) ["bound":protected]=> bool(true) ["useSSL":protected]=> bool(false) ["useTLS":protected]=> bool(true) }

["objectguid"]=> array(1) { [0]=> string(16) "4�ǘ=��F�Q9�����" }

["objectsid"]=> array(1) { [0]=> string(28) "����9aS��g^��p�f3 " }

whole object looks like this:

object(Adldap\Models\User)#9 (9) { ["exists"]=> bool(true) ["dateFormat"]=> string(11) "Y-m-d H:i:s" ["dn":protected]=> string(58) "CN=Lena Oronowicz,OU=Tarnobrzeg,OU=Pracownicy,DC=PUW,DC=RZ" ["query":protected]=> object(Adldap\Query\Builder)#11 (15) { ["columns"]=> array(0) { } ["filters"]=> array(3) { ["and"]=> array(3) { [0]=> array(3) { ["field"]=> string(11) "objectclass" ["operator"]=> string(1) "=" ["value"]=> string(18) "\70\65\72\73\6f\6e" } [1]=> array(3) { ["field"]=> string(14) "objectcategory" ["operator"]=> string(1) "=" ["value"]=> string(18) "\70\65\72\73\6f\6e" } [2]=> array(3) { ["field"]=> string(3) "anr" ["operator"]=> string(1) "=" ["value"]=> string(30) "\6c\6f\72\6f\6e\6f\77\69\63\7a" } } ["or"]=> array(0) { } ["raw"]=> array(0) { } } ["limit"]=> int(1) ["paginated"]=> bool(false) ["sortByField":protected]=> string(0) "" ["sortByDirection":protected]=> string(0) "" ["sortByFlags":protected]=> NULL ["dn":protected]=> string(12) "dc=PUW,dc=RZ" ["recursive":protected]=> bool(true) ["read":protected]=> bool(false) ["raw":protected]=> bool(false) ["nested":protected]=> bool(false) ["connection":protected]=> object(Adldap\Connections\Ldap)#5 (4) { ["connection":protected]=> resource(2) of type (ldap link) ["bound":protected]=> bool(true) ["useSSL":protected]=> bool(false) ["useTLS":protected]=> bool(true) } ["grammar":protected]=> object(Adldap\Query\Grammar)#10 (0) { } ["schema":protected]=> object(Adldap\Schemas\ActiveDirectory)#6 (0) { } } ["schema":protected]=> object(Adldap\Schemas\ActiveDirectory)#6 (0) { } ["attributes":protected]=> array(79) { ["objectclass"]=> array(4) { [0]=> string(3) "top" [1]=> string(6) "person" [2]=> string(20) "organizationalPerson" [3]=> string(4) "user" } [0]=> string(11) "objectclass" ["cn"]=> array(1) { [0]=> string(14) "Lena Oronowicz" } [1]=> string(2) "cn" ["sn"]=> array(1) { [0]=> string(9) "Oronowicz" } [2]=> string(2) "sn" ["description"]=> array(1) { [0]=> string(6) "u10812" } [3]=> string(11) "description" ["givenname"]=> array(1) { [0]=> string(4) "Lena" } [4]=> string(9) "givenname" ["distinguishedname"]=> array(1) { [0]=> string(58) "CN=Lena Oronowicz,OU=Tarnobrzeg,OU=Pracownicy,DC=PUW,DC=RZ" } [5]=> string(17) "distinguishedname" ["instancetype"]=> array(1) { [0]=> string(1) "4" } [6]=> string(12) "instancetype" ["whencreated"]=> array(1) { [0]=> string(17) "20131031070153.0Z" } [7]=> string(11) "whencreated" ["whenchanged"]=> array(1) { [0]=> string(17) "20170403210032.0Z" } [8]=> string(11) "whenchanged" ["displayname"]=> array(1) { [0]=> string(14) "Lena Oronowicz" } [9]=> string(11) "displayname" ["usncreated"]=> array(1) { [0]=> string(6) "857040" } [10]=> string(10) "usncreated" ["memberof"]=> array(4) { [0]=> string(31) "CN=I-XIII,OU=Grupy,DC=PUW,DC=RZ" [1]=> string(34) "CN=Wydzial_I,OU=Grupy,DC=PUW,DC=RZ" [2]=> string(42) "CN=Gr_Otrs_Customers,OU=Grupy,DC=PUW,DC=RZ" [3]=> string(38) "CN=Gr_Tarnobrzeg,OU=Grupy,DC=PUW,DC=RZ" } [11]=> string(8) "memberof" ["usnchanged"]=> array(1) { [0]=> string(8) "18293551" } [12]=> string(10) "usnchanged" ["name"]=> array(1) { [0]=> string(14) "Lena Oronowicz" } [13]=> string(4) "name" ["objectguid"]=> array(1) { [0]=> string(16) "4�ǘ=��F�Q9�����" } [14]=> string(10) "objectguid" ["useraccountcontrol"]=> array(1) { [0]=> string(3) "512" } [15]=> string(18) "useraccountcontrol" ["badpwdcount"]=> array(1) { [0]=> string(1) "0" } [16]=> string(11) "badpwdcount" ["codepage"]=> array(1) { [0]=> string(1) "0" } [17]=> string(8) "codepage" ["countrycode"]=> array(1) { [0]=> string(1) "0" } [18]=> string(11) "countrycode" ["homedirectory"]=> array(1) { [0]=> string(24) "\\deimos\home\loronowicz" } [19]=> string(13) "homedirectory" ["homedrive"]=> array(1) { [0]=> string(2) "Z:" } [20]=> string(9) "homedrive" ["badpasswordtime"]=> array(1) { [0]=> string(18) "131338854817418281" } [21]=> string(15) "badpasswordtime" ["lastlogoff"]=> array(1) { [0]=> string(1) "0" } [22]=> string(10) "lastlogoff" ["lastlogon"]=> array(1) { [0]=> string(18) "131357615859570312" } [23]=> string(9) "lastlogon" ["pwdlastset"]=> array(1) { [0]=> string(18) "131357268328437500" } [24]=> string(10) "pwdlastset" ["primarygroupid"]=> array(1) { [0]=> string(3) "513" } [25]=> string(14) "primarygroupid" ["objectsid"]=> array(1) { [0]=> string(28) "����9aS��g^��p�f3 " } [26]=> string(9) "objectsid" ["accountexpires"]=> array(1) { [0]=> string(1) "0" } [27]=> string(14) "accountexpires" ["logoncount"]=> array(1) { [0]=> string(3) "727" } [28]=> string(10) "logoncount" ["samaccountname"]=> array(1) { [0]=> string(10) "loronowicz" } [29]=> string(14) "samaccountname" ["samaccounttype"]=> array(1) { [0]=> string(9) "805306368" } [30]=> string(14) "samaccounttype" ["userprincipalname"]=> array(1) { [0]=> string(17) "[email protected]" } [31]=> string(17) "userprincipalname" ["lockouttime"]=> array(1) { [0]=> string(1) "0" } [32]=> string(11) "lockouttime" ["objectcategory"]=> array(1) { [0]=> string(49) "CN=Person,CN=Schema,CN=Configuration,DC=PUW,DC=RZ" } [33]=> string(14) "objectcategory" ["dscorepropagationdata"]=> array(5) { [0]=> string(17) "20161014195806.0Z" [1]=> string(17) "20161014194900.0Z" [2]=> string(17) "20150414103534.0Z" [3]=> string(17) "20150414103450.0Z" [4]=> string(17) "16010714223649.0Z" } [34]=> string(21) "dscorepropagationdata" ["lastlogontimestamp"]=> array(1) { [0]=> string(18) "131356773375214757" } [35]=> string(18) "lastlogontimestamp" ["msds-supportedencryptiontypes"]=> array(1) { [0]=> string(1) "0" } [36]=> string(29) "msds-supportedencryptiontypes" ["mail"]=> array(1) { [0]=> string(28) "[email protected]" } [37]=> string(4) "mail" ["axiisenabled"]=> array(1) { [0]=> string(4) "TRUE" } [38]=> string(12) "axiisenabled" ["dn"]=> string(58) "CN=Lena Oronowicz,OU=Tarnobrzeg,OU=Pracownicy,DC=PUW,DC=RZ" } ["original":protected]=> array(79) { ["objectclass"]=> array(4) { [0]=> string(3) "top" [1]=> string(6) "person" [2]=> string(20) "organizationalPerson" [3]=> string(4) "user" } [0]=> string(11) "objectclass" ["cn"]=> array(1) { [0]=> string(14) "Lena Oronowicz" } [1]=> string(2) "cn" ["sn"]=> array(1) { [0]=> string(9) "Oronowicz" } [2]=> string(2) "sn" ["description"]=> array(1) { [0]=> string(6) "u10812" } [3]=> string(11) "description" ["givenname"]=> array(1) { [0]=> string(4) "Lena" } [4]=> string(9) "givenname" ["distinguishedname"]=> array(1) { [0]=> string(58) "CN=Lena Oronowicz,OU=Tarnobrzeg,OU=Pracownicy,DC=PUW,DC=RZ" } [5]=> string(17) "distinguishedname" ["instancetype"]=> array(1) { [0]=> string(1) "4" } [6]=> string(12) "instancetype" ["whencreated"]=> array(1) { [0]=> string(17) "20131031070153.0Z" } [7]=> string(11) "whencreated" ["whenchanged"]=> array(1) { [0]=> string(17) "20170403210032.0Z" } [8]=> string(11) "whenchanged" ["displayname"]=> array(1) { [0]=> string(14) "Lena Oronowicz" } [9]=> string(11) "displayname" ["usncreated"]=> array(1) { [0]=> string(6) "857040" } [10]=> string(10) "usncreated" ["memberof"]=> array(4) { [0]=> string(31) "CN=I-XIII,OU=Grupy,DC=PUW,DC=RZ" [1]=> string(34) "CN=Wydzial_I,OU=Grupy,DC=PUW,DC=RZ" [2]=> string(42) "CN=Gr_Otrs_Customers,OU=Grupy,DC=PUW,DC=RZ" [3]=> string(38) "CN=Gr_Tarnobrzeg,OU=Grupy,DC=PUW,DC=RZ" } [11]=> string(8) "memberof" ["usnchanged"]=> array(1) { [0]=> string(8) "18293551" } [12]=> string(10) "usnchanged" ["name"]=> array(1) { [0]=> string(14) "Lena Oronowicz" } [13]=> string(4) "name" ["objectguid"]=> array(1) { [0]=> string(16) "4�ǘ=��F�Q9�����" } [14]=> string(10) "objectguid" ["useraccountcontrol"]=> array(1) { [0]=> string(3) "512" } [15]=> string(18) "useraccountcontrol" ["badpwdcount"]=> array(1) { [0]=> string(1) "0" } [16]=> string(11) "badpwdcount" ["codepage"]=> array(1) { [0]=> string(1) "0" } [17]=> string(8) "codepage" ["countrycode"]=> array(1) { [0]=> string(1) "0" } [18]=> string(11) "countrycode" ["homedirectory"]=> array(1) { [0]=> string(24) "\\deimos\home\loronowicz" } [19]=> string(13) "homedirectory" ["homedrive"]=> array(1) { [0]=> string(2) "Z:" } [20]=> string(9) "homedrive" ["badpasswordtime"]=> array(1) { [0]=> string(18) "131338854817418281" } [21]=> string(15) "badpasswordtime" ["lastlogoff"]=> array(1) { [0]=> string(1) "0" } [22]=> string(10) "lastlogoff" ["lastlogon"]=> array(1) { [0]=> string(18) "131357615859570312" } [23]=> string(9) "lastlogon" ["pwdlastset"]=> array(1) { [0]=> string(18) "131357268328437500" } [24]=> string(10) "pwdlastset" ["primarygroupid"]=> array(1) { [0]=> string(3) "513" } [25]=> string(14) "primarygroupid" ["objectsid"]=> array(1) { [0]=> string(28) "����9aS��g^��p�f3 " } [26]=> string(9) "objectsid" ["accountexpires"]=> array(1) { [0]=> string(1) "0" } [27]=> string(14) "accountexpires" ["logoncount"]=> array(1) { [0]=> string(3) "727" } [28]=> string(10) "logoncount" ["samaccountname"]=> array(1) { [0]=> string(10) "loronowicz" } [29]=> string(14) "samaccountname" ["samaccounttype"]=> array(1) { [0]=> string(9) "805306368" } [30]=> string(14) "samaccounttype" ["userprincipalname"]=> array(1) { [0]=> string(17) "[email protected]" } [31]=> string(17) "userprincipalname" ["lockouttime"]=> array(1) { [0]=> string(1) "0" } [32]=> string(11) "lockouttime" ["objectcategory"]=> array(1) { [0]=> string(49) "CN=Person,CN=Schema,CN=Configuration,DC=PUW,DC=RZ" } [33]=> string(14) "objectcategory" ["dscorepropagationdata"]=> array(5) { [0]=> string(17) "20161014195806.0Z" [1]=> string(17) "20161014194900.0Z" [2]=> string(17) "20150414103534.0Z" [3]=> string(17) "20150414103450.0Z" [4]=> string(17) "16010714223649.0Z" } [34]=> string(21) "dscorepropagationdata" ["lastlogontimestamp"]=> array(1) { [0]=> string(18) "131356773375214757" } [35]=> string(18) "lastlogontimestamp" ["msds-supportedencryptiontypes"]=> array(1) { [0]=> string(1) "0" } [36]=> string(29) "msds-supportedencryptiontypes" ["mail"]=> array(1) { [0]=> string(28) "[email protected]" } [37]=> string(4) "mail" ["axiisenabled"]=> array(1) { [0]=> string(4) "TRUE" } [38]=> string(12) "axiisenabled" ["dn"]=> string(58) "CN=Lena Oronowicz,OU=Tarnobrzeg,OU=Pracownicy,DC=PUW,DC=RZ" } ["modifications":protected]=> array(0) { } ["timestampFormat":protected]=> string(9) "YmdHis.0Z" }

checking encoding of 'objectguid' and 'objectsid' using mb_detect_encoding() returns UTF-8 so it looks ok I think. I've added some extra code inside _convert function of ChromePHP to bypass those props and Object showed inside Firefox console.

Encoding object through:

base64_encode(utf8_encode(json_encode($object)))

results non empty string so I think that there is something wrong with the _convert function.

Log gets cleared automatically before page renders.

My Chrome Version = 26.0
When I reloads the page, I am able to view the log but it gets cleared as soon as page renders.
When I am doing this:
echo "<script>console.log('Hello from console.')</script>";
It is being shown there. I have called ChromePhp::log after that, it is not getting logged at the same time.

Line numbers not showing in Firefox 43

I see in the _log method that the backtrace message is a concatenation of the file path, a space, a colon, another space, and then the line number. The console drops the line number, resulting in something like this:

/path/to/file.php :

I noticed that if I add another colon and character to the backtrace message that the line then shows up, so a backtrace message that looks like this:

/path/to/file.php : 10 : 0

Will end up showing the console as:

/path/to/file.php : 10 :

So either the console is expecting something different, or the console is broken. If the console is expecting something different, it would be good to fix it. If the console is not expecting something different, then I need help with how to submit a bug to Firefox on this.

ERR_RESPONSE_HEADERS_TOO_BIG

Hi,

I'm using the newly released chromePHP class 3.0 which is adapted to work with Chrome 17, but I'm getting the ERR_RESPONSE_HEADERS_TOO_BIG error. In earlier versions there used to be a workaround for the 4kb cookie limit by writing to file instead of using cookies. Now ChromePhp is using header information instead of cookies, but there's no workaround for the header size limit, which is according to google 64kb... For most of our pages, there's no problem but sometimes we exceed the limit.

Is there going to be a workaround for this problem?

Many thanks!

Where to put the log statements?

I know this is a dumb question, but where are we supposed to put the "log statements" as described in step 3 of the installation? I assumed in a php file, but when I ran it, all it did was open the ChromePhp.php file on Github and at the end of the page, had the error: "Class 'ChromePhp' not found." I'm pretty sure I put the file in the right path because I used the path mentioned in the "file not found" error.

No LICENSE makes it impossible to use!

Your project is lacking a LICENSE file.

That means that it is impossible for anyone to legally use it in published works. Please advise, and please do not choose a FSF license (GPL, etc.) or any other copyleft viral license.

special variable Resource givin' SyntaxError

I'm getting the error below when I try to Chrome::log() a mysql_query result:

Error in event handler for runtime.onMessage: SyntaxError: Unexpected end of JSON input
at _decode (chrome-extension://noaneddfkdjfnfdakjjmocngnfkfehhd/log.js:156:21)
at _process (chrome-extension://noaneddfkdjfnfdakjjmocngnfkfehhd/log.js:164:26)
at _handleHeaderUpdate (chrome-extension://noaneddfkdjfnfdakjjmocngnfkfehhd/log.js:181:9)

*if I use mysql_fetch_array before Chrome::log() the error disappear.

Suggestion:
Add if(is_resource($object)){return get_resource_type($object);} to ChromePHP::_convert()

.info method in ChromePhp server-library

chrome and firebug supports that method, and compatibility needs it).
In webkit inspector console it draws log row now, but they can be different methods in future.

Also, I recommend you to change slightly logcleandata method in js-class.
Like this or someth:

switch(type) {
  //...
  default:
    type = 'log';
  case 'info':
  case 'log':
  case 'warn':
  case 'error':
    if (show_label) {
      console[type](label, log);
      break;
    }
    console[type](log);
    break;
}

Feel the power of JS ;-)

Duplicate console messages

I have the following code

<?php $emailarray = array("[email protected]"); require_once('ChromePhp.php'); foreach($emailarray as $row) { $mail->addAddress($row); if ($mail->send()) { ChromePhp::log("Email sent to $row"); } else { ChromePhp::log("Email failed to $row - $mail->ErrorInfo"); } $mail->clearAddresses(); } ChromePhp::log("All Emails sent"); ?>

But I get the messages twice like this

Email sent to [email protected]
All Emails sent
Email sent to [email protected]
All Emails sent

Any idea why this is happening?

WordPress theme - headers already sent

Using chromePHP inside a WordPress theme gives me an error of "headers already sent". The problematic line is 385:

header(self::HEADER_NAME . ': ' . $this->_encode($data));

Using ChromePHP in WP is no problem as long as wp_head() isn't called.
Is there a known workaround?

Uncaught TypeError

Uncaught TypeError: Cannot call method 'addEventListener' of undefined
(anonymous function)chrome-extension://homgcnaoacgigpkkljjjekpignblkeae/main.js:25
(anonymous function)chrome-extension://homgcnaoacgigpkkljjjekpignblkeae/main.js:34

ChromePhp not compatible with www.pagodabox.com

I have experienced the following problems with ChromePhp and www.pagodabox.com:

  1. As the page loads in the browser I see ChromePhp messages being written to console. However, immediately after they are written they disappear as if something is clearing the console. The only way to see the console messages is to enable "Preserve log upon navigation" in Chrome. Once I do this I am able to see the log messages.
  2. When logging PHP objects to the console the console records don't always expand in the console when you click on them. I have not been able to isolate the conditions that cause this yet, but it happens frequent enough.
  3. Pagodabox has the apache instance configured to only accept http RESPONSE headers of size ~12K. Any headers greater than 12K will cause the apache service to just stop (ie sends no response including no headers to the browser). This is not a ChromePhp problem other than ChromePhp writes all of the data to a single header and does a number of encodings on the data that your application can quickly exceed the 12K http header limit.

I have been using ChromePhp for around six months and absolutely love it. I have only experienced these problems on www.pagodabox.com. I have not had any of these problems on other apache instances (XAMPP and rackspace).

However, I have moved on to FirePHP4Chrome and FirePHP which do not have any of these issues. The FirePHPChrome extension appears to write its data to the Chrome console must later in the process than ChromePhp does as it's console messages don't have this problem and show up after ChromePhp messages do. FirePHP also sends it data using more than one http header. It also uses a different encoding method that consumes less header space.

I would be happy to setup a test case on Pagodabox if helps. Thank you very much.

Thanks, Dan

Calling groupEnd without any parameters fails silently.

Example:
ChromePhp::groupCollapsed('My test group');
ChromePhp::log('test log');
ChromePhp::error('test error');
ChromePhp::groupEnd();
ChromePhp::error('test error 2');

The expected behaviour is that a group gets logged with two items in it, followed by an error.
In practice the call to groupEnd is ignored as it has no arguments, and so all three items go into the group.

As a work around I can call ChromePhp::groupEnd(''), however this is non-obvious and non-intuitive.

Stopped working on localhost

Hi there,

I'm using ChromePhp both in local and production environment, but these last days it has stopped working locally. I don't get no logs anymore.

Here's my setup:

Windows 7 - 32 bit
Google Chrome 32.0.1700.102 m
Apache Version :2.2.21
PHP Version :5.3.9

I've already reinstalled the extension and checked the code at github, but that didn't help.

Anyone had been through this and could give any help?

Thanks in advance.

Pierre

Suggestion: snippet for automatic download of ChromePhp.php

It can be boring to download ChromePhp.php and upload it to the local (Vagrant) server, so I just wrote a snippet which downloads the file to the server's temp dir before using it. It needs PHP >= 5.2.1.

if (!is_file(sys_get_temp_dir() . '/ChromePhp.php')) {
    file_put_contents(
        sys_get_temp_dir() . '/ChromePhp.php',
        fopen('https://raw.githubusercontent.com/ccampbell/chromephp/master/ChromePhp.php', 'r')
    );
}
require_once sys_get_temp_dir() . '/ChromePhp.php';
ChromePhp::log('Hello automatization!');

I hope it usefull enough to include in the README. 😇

Dual Licensing?

Hi =) Thanks for this cool extension. I wanted to ask if you might consider dual licensing your class by adding "GPL v 2, or later" as one option in addition to your existing Apache License?

The reason I ask is I am hoping to use the class with software that also uses GPL v 2, or later. Apache is compatible with GPL v 3, so that's not a problem. But, by including something that is not compatible with GPL v 2 and only is compatible with GPL v 3 (as is the case with Apache http://www.apache.org/licenses/GPL-compatibility.html), then the entire distribution would need to be GPL v 3. That's not an easy step to make for a community project.

If you prefer not to use dual licensing, I certainly understand and absolutely respect a free software developer's right to make those calls. I thought I might ask to see if you had considered and might be willing to do so.

Kind regards.

initSettings or something?

Can you add static method for initialize _settings variable? ::getInstance()->addSettings for each row is too expensive.

Group collapsing by default?

I think we need it for usability.
If we define some depth-level for group collapsing and then we collapse all group to that level for example.
Can you add some group-collapsing-by-default mechanics? Some new setting key for example? Hm. But you must add new method groupExpanded then.
Or rewrite group/groupCollapsed methods - use some param for collapse/expand group.

Problem with Recent version of Chromium

Hello,
For me ChromePhp does not work on Chromium Version 28.0.1500.52 (most recent now). With version 27.** everything is fine. Does anyone has the same issue?

Thanks

Browser crash because of a lot of cookies

In _writeToFile after

        file_put_contents($this->getSetting(self::LOG_PATH) . '/' . $file_name, $json);

put that or something like that:

        static $setCookie;
        if (empty($setCookie)) {
            $data = array(
                'uri' => $this->getSetting(self::URL_PATH) . '/' . $file_name,
                'request_uri' => $_SERVER['REQUEST_URI'],
                'time' => $this->_timestamp,
                'version' => self::VERSION
            );

            $setCookie = $this->_setCookie($data);
        }

        return $setCookie;
    }

If not browser throws an error: "Error 325 (net::ERR_RESPONSE_HEADERS_TOO_BIG): Unknown error." and dont show a page.

Not logging when using Zend Redirect

Hello,
if you call an Controller Action which consists of a redirect,
ChomePhp will not output the messages to the console.

eg

    public function testAction()
    {
            \ChromePhp::log("Request: ");
            return $this->redirect()->toRoute('index');
     }

will output nothing.

Is there any fix or workaround for this?

Can I do this?

Can i fork your project and turn this into a helper for codeigniter and release it as a spark?

With your licence and copyright obviously.

cheers,
Marco

Group collapsed not displaying anything in Chrome or Firefox

Group collapsed not displaying anything in Chrome or Firefox:

require_once 'ChromePhp.php';
ChromePhp::groupCollapsed('Letters');
ChromePhp::log('a');
ChromePhp::log('b');
ChromePhp::log('c');
ChromePhp::groupEnd();

Nothing seen in the console for either Firefox 43 or Chrome (current version).

Other methods work fine.

PHP Error: Recursion detected

I always get this PHP error when using the script on my site...

A PHP Error was encountered
Severity: Warning
Message: json_encode(): recursion detected
Filename: libraries/ChromePhp.php
Line Number: 396

Is there a fix for this?

Installation problem on latest Chrome

Each time I try to install chromephp I get an error telling me 'Download was not a CRX'.
When I try to install it manually I am told 'CRX_MAGIC_NUMBER_INVALID'.
I get the crx from my Downloads directory.
I am running Mountain Lion with Chrome version: 24.0.1312.56
Thanks

Fatal error: Maximum function nesting level of '100' reached, aborting!

When working with objects that have some sort of circular references to each other I have this issue

Sample of the stack trace

ChromePhp::log( ) ../ConsoleLogger.php:54
4 0.0420 223068 ChromePhp::_log( ) ../ChromePhp.php:183
5 0.0420 224548 ChromePhp->_convert( ) ../ChromePhp.php:272
6 0.0421 226376 ChromePhp->_convert( ) ../ChromePhp.php:311
7 0.0421 228332 ChromePhp->_convert( ) ../ChromePhp.php:311
8 0.0421 230236 ChromePhp->_convert( ) ../ChromePhp.php:311
..... until I reach the error

Working with L4? Not joy here!

Has anybody been able to get this library working with Laravel 4? I have added it to my apps composer.json file and updated, but calls to ChromePhp::log are either ignored, or I get the standard header error.

I can't find much information about working with L4 and ChromePhp...

BTW, I am using Canary v20

Setting to turn off backtraces

We utilize ChromePHP through an abstraction layer that detects the browser before outputting messages. The problem is that the entry point is always the same from our code into the log method so the backtrace that's appended is useless. I'm hoping you can add an option to simply disable the backtrace functionality as we just add this ourselves.

Support FirePHP protocol?

Is there a reason you opted to create your own protocol? If not, I hope you would consider making the extension FirePHP compatible.

Announce its presence to the server

The ChromePHP extension should announce its presence and activation status to the server using a header, like FirePHP does with HTTP_X_INSIGHT.

Then the server can optimize its output for ChromePHP and fall back to text output if ChromePHP is not present.

arrays displayed as objects

when I var_dump the variable is an array, but I dump it to ChromePhp it says it is an object.

anyone notice this?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.