0

For some reason, when I var_dump it shows the objects data in the variable, but it just shows nothing when I use CakePHP's debug. Why is that?

Using debug I only get this much, but there is a LOT of stuff in the object when I use var_dump:

Current setting for debug:

Configure::write('debug', 2);

Doesn't work:

debug($account);

Output:

object(Recurly_Account) {

}

Works:

echo "<pre>";
var_dump($account);
echo "</pre>";

Output:

object(Recurly_Account)#31 (6) {
  ["_values":protected]=>
  array(12) {
    ["adjustments"]=>
    object(Recurly_Stub)#34 (4) {
      ["objectType"]=>
      string(11) "adjustments"
      ["_href":protected]=>
      string(49) "https://api.recurly.com/v2/accounts/1/adjustments"
      ["_client":protected]=>
      NULL
      ["_links":protected]=>
      array(0) {
      }
    }
    ["billing_info"]=>
    object(Recurly_Stub)#35 (4) {
      ["objectType"]=>
      string(12) "billing_info"
      ["_href":protected]=>
      string(50) "https://api.recurly.com/v2/accounts/1/billing_info"
      ["_client":protected]=>
      NULL
      ["_links":protected]=>
      array(0) {
      }
    }
    ["invoices"]=>
    object(Recurly_Stub)#36 (4) {
      ["objectType"]=>
      string(8) "invoices"
      ["_href":protected]=>
      string(46) "https://api.recurly.com/v2/accounts/1/invoices"
      ["_client":protected]=>
      NULL
      ["_links":protected]=>
      array(0) {
      }
    }
    ["subscriptions"]=>
    object(Recurly_Stub)#37 (4) {
      ["objectType"]=>
      string(13) "subscriptions"
      ["_href":protected]=>
      string(51) "https://api.recurly.com/v2/accounts/1/subscriptions"
      ["_client":protected]=>
      NULL
      ["_links":protected]=>
      array(0) {
      }
    }
    ["transactions"]=>
    object(Recurly_Stub)#38 (4) {
      ["objectType"]=>
      string(12) "transactions"
      ["_href":protected]=>
      string(50) "https://api.recurly.com/v2/accounts/1/transactions"
      ["_client":protected]=>
      NULL
      ["_links":protected]=>
      array(0) {
      }
    }
    ["account_code"]=>
    string(1) "1"
    ["state"]=>
    string(6) "active"
    ["email"]=>
    string(20) "test1@test.com"
    ["first_name"]=>
    string(7) "test"
    ["last_name"]=>
    string(3) "test"
    ["hosted_login_token"]=>
    string(32) "19415f3937cd6079c96e5141fe99bc49"
    ["created_at"]=>
    object(DateTime)#39 (3) {
      ["date"]=>
      string(19) "2012-06-09 18:49:02"
      ["timezone_type"]=>
      int(2)
      ["timezone"]=>
      string(1) "Z"
    }
  }
  ["_unsavedKeys":protected]=>
  array(0) {
  }
  ["_errors":protected]=>
  NULL
  ["_href":protected]=>
  string(37) "https://api.recurly.com/v2/accounts/1"
  ["_client":protected]=>
  object(Recurly_Client)#27 (2) {
    ["_apiKey":"Recurly_Client":private]=>
    NULL
    ["_acceptLanguage":"Recurly_Client":private]=>
    string(5) "en-US"
  }
  ["_links":protected]=>
  NULL
}
4

2 回答 2

0

请仔细检查打印print_r非标准编码字符的值。

于 2012-08-14T00:57:57.953 回答
0

这是我最近为 CakePHP 2.3 修复的(需要 PHP 5.3+)。

以前,您只会看到对象的公共属性。使用当前的 2.3 头和我的增强功能,您还将看到所有受保护的和私有的属性(使用反射——顺便说一下,print_r 可以本机提供)。

你可以在这里看到票:http: //cakephp.lighthouseapp.com/projects/42648-cakephp/tickets/3095-enable-debuggerexportvar-to-display-protected-and-private-class-properties#ticket-3095-3

于 2012-08-14T01:09:41.040 回答