View Issue Details

IDProjectCategoryView StatusLast Update
0001081XdebugUncategorizedpublic2014-11-11 20:49
Reporterbananer Assigned To 
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionnot fixable 
Product Version2.2.4 
Summary0001081: Breakpoints change PHP behavior
Description

Hi all,

I've been questioning my sanity today, it seems like setting a breakpoint changes PHP's behavior when comparing DateTimeZone objects. Here is a very basic script that was enough to reproduce the problem for me:

<?php

$tz1 = new DateTimeZone('Europe/Berlin');
$tz2 = new DateTimeZone('Europe/Berlin');

$d = new DateTime('2014-12-24 13:00:00', $tz1);

if($tz2 == $d->getTimezone()) {
echo "yes";
}
else {
echo "no";
}

What I observed: When ran without Xdebug or with no breakpoints set, the script prints "yes", just as expected. But when I set a breakpoint in line 6 ("$d = ..."), the script will print "no". The same can be seen when the breakpoint is in the very first line and I step over until the end, but not when resuming execution right from the breakpoint at the top. So it has to break in line 6 for the problem to show.

I have tested this on my main machine with Ubuntu 14.04, PHP 5.5.9, Xdebug 2.2.3 and using PHPStorm as debugger frontend. Since this was driving me crazy, I set up a fresh Ubuntu 14.10 VM with PHP 5.5.9 and Xdebug 2.2.4 using Eclipse, and could see the same problem, so it seems like this is not something wrong with my setup.

A remote_log file from inside the VM is attached. I hope somebody can figure out what is wrong here...

TagsNo tags attached.
Operating SystemUbuntu 14.04 and 14.10
PHP Version5.5.5-5.5.9

Activities

derick

2014-11-11 20:49

administrator   ~0002908

There is a bug here, but it is not in Xdebug. It is in PHP instead. Just run
the following script without Xdebug, and you will see the same "no":

<?php

$tz1 = new DateTimeZone('Europe/Berlin');
$tz2 = new DateTimeZone('Europe/Berlin');

$d = new DateTime('2014-12-24 13:00:00', $tz1);
var_dump($d->getTimezone(), $tz2);

if($tz2 == $d->getTimezone()) {
echo "yes";
}
else {
echo "no";
}

I've only added the var_dump(...) in there compared to your script. Xdebug
does something similar to var_dump, so hence the behaviour is the same. I've
filed a bug for PHP:
https://bugs.php.net/bug.php?id=68406