Seldaek / php-console

PHP Debug Console
Other
529 stars 93 forks source link

Script ended unexpectedly. #52

Closed DavBE closed 7 years ago

DavBE commented 7 years ago

Hi!

I get a "Script ended unexpectedly" error when running the following code :

$d = new DateTime();
$i = new DateInterval('P2W');
$p = new DatePeriod($d, $i, 5);

< $p;

php-console is running in the php 7 built-in web server (PHP 7.0.8-0ubuntu0.16.04.3).

Am I doing something wrong ?

Seldaek commented 7 years ago

Can you try running that code in a simple php file with php -r test.php on the command line? Just to see if you get more details..

DavBE commented 7 years ago

Hi,

Thanks for your reply.

php -r '$d = new DateTime();$i = new DateInterval("P2W");$p = new DatePeriod($d, $i, 5);'

--> no output

Seldaek commented 7 years ago

Ah I see, I get Fatal error: Uncaught Error: Writing to DatePeriod properties is unsupported in console\krumo\class.krumo.php on line 921.. it seems krumo does some hackery that breaks with DatePeriod objects.. So just use var_dump($p); instead for this one. Sorry about that.

DavBE commented 7 years ago

Ok no problem. Thank you.