dbo Posted April 1, 2008 Share Posted April 1, 2008 So... I thought there was a bug in my code and I went debugging. Despite telling my system not to cache files, it was doing so anyways. I tracked down the issue to this code: //IF WE DIDN'T POPULATE THE CONTENTS FROM THE CACHE, AND THE FILE //IS CACHEABLE WE WANT TO WRITE IT TO CACHE $test = (!$blnFromCache && $this->blnIsCacheable); debug_zval_dump($test); if( $test ) { $strFilename = $this->getCacheId(); //file_put_contents(CACHE_DIR . $strFilename . ".php", $this->strContents); } This outputs false for the debug statement... meaning that it should not enter the if statement. Since I've got the file_put_contents thing commented out, the contents are not written to file. So I uncomment it and it writes it to cache. How can it write anything to cache if $test is false? I don't get it. Quote Link to comment Share on other sites More sharing options...
keeB Posted April 1, 2008 Share Posted April 1, 2008 I really don't understand how this is a bug.. ? Can you elaborate? Quote Link to comment Share on other sites More sharing options...
dbo Posted April 1, 2008 Author Share Posted April 1, 2008 Bug confirmed. Wrapping file_put_contents in my own function call, only gets executed when $test evaluates as true... as it's supposed to. Quote Link to comment Share on other sites More sharing options...
dbo Posted April 1, 2008 Author Share Posted April 1, 2008 A line of code executing inside of an if statement, even when the if statement evaluates to false is not odd to you? Quote Link to comment Share on other sites More sharing options...
dbo Posted April 1, 2008 Author Share Posted April 1, 2008 Hrmmm. I lied. My function is still getting executed when it evaluates to false too. Quote Link to comment Share on other sites More sharing options...
dbo Posted April 1, 2008 Author Share Posted April 1, 2008 I don't get stumped often... but I'm at a loss with this one. Quote Link to comment Share on other sites More sharing options...
keeB Posted April 1, 2008 Share Posted April 1, 2008 I'm not convinced it's false. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.