It's a SAPI behaivor
"Destructors called during the script shutdown have HTTP headers already sent. The working directory in the script shutdown phase can be different with some SAPIs (e.g. Apache)."
From http://php.net/manual/en/language.oop5.decon.php
But as mentioned in other answers there are plenty ways to get the current relative path. If you changed it during runtime make sure to note somewhere inside the object.