var-dump

json_encode() returns false

左心房为你撑大大i 提交于 2019-12-03 05:23:44
This is the first time i ever face, that var_dumping json_encode of an array resulting boolean value. I have an array that was resulted from unserialization. I var_dumped it and made sure that it is a valid array. The result is like below. This is just a piece, not entire debug view. array (size=3) 'id' => string 'asco-power-technologies-l-p' (length=27) 'name' => string 'asco-power-technologies-l-p' (length=27) 'children' => array (size=2) 0 => array (size=4) 'id' => string 'apl-logistics' (length=13) 'name' => string 'APL LOGISTICS' (length=13) 'data' => array (size=2) 'band' => string 'ASCO

PHP: Colors in var_dump (Ubuntu)

萝らか妹 提交于 2019-12-03 03:13:39
I'd like to see the colors and formatting that can come with var_dump. In my php.ini html_errors is set to On . This is confirmed by phpinfo() . My PHP version is 5.3.3 on Ubuntu 10.10. Anybody an idea? You're looking for XDebug . sudo apt-get install php5-xdebug sudo /etc/init.d/apache2 restart and you're done. Note: Maerlyn's approach should be taken for its simplicity. I wasn't aware of php5-xdebug being in the repos. I've decided to leave this answer because I feel it adds some value to future readers. sudo apt-get install php5-dev php-pear Install Xdebug sudo pecl install xdebug You

Why can var_dump ascertain values of private variables, yet it can't when trying to access a single the property

柔情痞子 提交于 2019-11-30 23:29:40
I have an object that is being thrown into the session array, and I want to run a foreach on the items property. I can't seem to access it. I see that it's private, but I can't help but wonder why var_dump can show me what the property contains yet I can't read the data as it throws a fatal error? I suppose I could do some output buffering and evaluate var_dump as a string if I really have to like this but it seems like there should be a better method. Any ideas how I can access _items? The object code var_dumped from var_dump($_SESSION['PHPurchaseCart']) : object(PHPurchaseCart)#191 (4) { ["

Symfony 4: Var-dumper not working properly

痴心易碎 提交于 2019-11-30 22:33:10
I tried to use the wonderful dump function from the var-dumper bundle in symfony 4 and for some reason I get the following error: Failed to start the session because headers have already been sent by "vendor\symfony\var-dumper\Dumper\AbstractDumper.php" at line 181. Additionally, when I try to use the {% dump foo %} tag in a twig template I get an error: Unknown "dump" tag. Can anyone help me? A guy named Simon Waldburger mentioned in the lesson's comments that installing "debug" fixed the issue (it fixed it for me). The instruction was in the next lesson. composer require debug --dev iiirxs

Why can var_dump ascertain values of private variables, yet it can't when trying to access a single the property

元气小坏坏 提交于 2019-11-30 18:17:24
问题 I have an object that is being thrown into the session array, and I want to run a foreach on the items property. I can't seem to access it. I see that it's private, but I can't help but wonder why var_dump can show me what the property contains yet I can't read the data as it throws a fatal error? I suppose I could do some output buffering and evaluate var_dump as a string if I really have to like this but it seems like there should be a better method. Any ideas how I can access _items? The

Does xdebug beautify var_dump?

ε祈祈猫儿з 提交于 2019-11-30 17:24:28
According to this article, http://devzone.zend.com/article/2803 , var_dump is supposed to beautify the outputs. I have installed xdebug on my local host with PHP Version 5.3.3-1ubuntu9.2. I have this in my php.ini outputs. This program makes use of the Zend Scripting Language Engine: Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies with Xdebug v2.1.0, Copyright (c) 2002-2010, by Derick Rethans However when I use var_dump(), nothing changes. Does xdebug really beautify the var_dump outputs? If so, how can I fix it? This is my details of xdebug in php.ini xdebug xdebug support

Unexpected observation: var_dump() of an array is flagging referenced elements… since when?

别说谁变了你拦得住时间么 提交于 2019-11-30 13:51:19
I've just been running some simple debug tests against arrays, and noticed that when I do a var_dump() of an array, the output is flagging any element in the array that is referenced by another variable. As a simple experiment, I ran the following code: $array = range(1,4); var_dump($array); echo '<br />'; foreach($array as &$value) { } var_dump($array); echo '<br />'; $value2 = &$array[1]; var_dump($array); echo '<br />'; which gives the following output: array(4) { [0]=> int(1) [1]=> int(2) [2]=> int(3) [3]=> int(4) } array(4) { [0]=> int(1) [1]=> int(2) [2]=> int(3) [3]=> ∫(4) } array(4) {

Sending “var_dump” to FireBug console

社会主义新天地 提交于 2019-11-30 08:54:33
As you know var_dump() in addition to value show its data type and length . Is there any way to log its output to FireBug console ? I tried FirePHP and FireLogger but both output only value of a variable (sometimes even incorrect variable value). Walter Tross Maybe what you need is something like this: function var2console($var, $name='', $now=false) { if ($var === null) $type = 'NULL'; else if (is_bool ($var)) $type = 'BOOL'; else if (is_string ($var)) $type = 'STRING['.strlen($var).']'; else if (is_int ($var)) $type = 'INT'; else if (is_float ($var)) $type = 'FLOAT'; else if (is_array ($var)

How do I properly use print_r or var_dump?

痞子三分冷 提交于 2019-11-30 07:25:06
I use the following snippet quite often when I am debugging: echo "<pre>" . var_dump($var) . "</pre>"; And I find I usually get a nice readable output. But sometimes I just don't. I'm particularly vexed at the moment by this example: <?php $username='xxxxxx'; $password='xxxxxx'; $data_url='http://docs.tms.tribune.com/tech/tmsdatadirect/schedulesdirect/tvDataDelivery.wsdl'; $start=gmdate("Y-m-d\TH:i:s\Z",time()); $stop =gmdate("Y-m-d\TH:i:s\Z",time()+3600*24); $client = new SoapClient($data_url, array('exceptions' => 0, 'user_agent' => "php/".$_SERVER[SCRIPT_NAME], 'login' => strtolower(

Symfony 4: Var-dumper not working properly

青春壹個敷衍的年華 提交于 2019-11-29 22:04:52
问题 I tried to use the wonderful dump function from the var-dumper bundle in symfony 4 and for some reason I get the following error: Failed to start the session because headers have already been sent by "vendor\symfony\var-dumper\Dumper\AbstractDumper.php" at line 181. Additionally, when I try to use the {% dump foo %} tag in a twig template I get an error: Unknown "dump" tag. Can anyone help me? 回答1: A guy named Simon Waldburger mentioned in the lesson's comments that installing "debug" fixed