Why is a file handle opened in dispatcher.php not available inside view.php??
Permalink
On the off chance that someone here might be able to help me understand why something that should seemingly work under PHP does not when I try it inside C5 code...I would appreciate any insight anyone might have on the following.
I am trying to debug my way into a greater understanding of C5 code so that I can then implement add on's or what have you without breaking C5 (I am presently working on a static page caching mechanism to speed up first page loading which breaks the ability to login in to the C5 admin interface).
In line with that I added the following to dispatcher.php to begin with...
No big deal really. Works as expected.
A file stream is opened up to debug_log.txt and the number 1 (followed by a newline) is written to the file.
When logging into C5 dispatcher.php shoots off to /concrete/libraries/view.php where I have put the following follow up code (most of which is irrelevant to why my file handle isn't working inside view.php but just in case I left it in)...
One would think that the second fwrite() to the filehandle $handlez43 would write out a "2" like a "1" was written out inside dispatcher.php. But only the "1" makes it into the file. The "2" is nowhere in sight!
A PHP warning is generated saying that the handle is not a proper resource.
But $handlez43 shows up as being in scope and present (i.e. defined) in the list of variables returned by get_defined_vars().
Beats me why my fwrite isn't working inside view.php.
Anybody got a clue?
If no one has any insight I'll just ask on a PHP forum but I figured I would ask here first in case anything related to C5 directly was causing the expected behavior to...well...not work.
The expected behavior being that I can write to the file inside view.php as well as I can write to the file inside dispatcher.php.
Any insight would be appreciated.
Thanks.
Carlos
I am trying to debug my way into a greater understanding of C5 code so that I can then implement add on's or what have you without breaking C5 (I am presently working on a static page caching mechanism to speed up first page loading which breaks the ability to login in to the C5 admin interface).
In line with that I added the following to dispatcher.php to begin with...
No big deal really. Works as expected.
A file stream is opened up to debug_log.txt and the number 1 (followed by a newline) is written to the file.
When logging into C5 dispatcher.php shoots off to /concrete/libraries/view.php where I have put the following follow up code (most of which is irrelevant to why my file handle isn't working inside view.php but just in case I left it in)...
One would think that the second fwrite() to the filehandle $handlez43 would write out a "2" like a "1" was written out inside dispatcher.php. But only the "1" makes it into the file. The "2" is nowhere in sight!
A PHP warning is generated saying that the handle is not a proper resource.
But $handlez43 shows up as being in scope and present (i.e. defined) in the list of variables returned by get_defined_vars().
Beats me why my fwrite isn't working inside view.php.
Anybody got a clue?
If no one has any insight I'll just ask on a PHP forum but I figured I would ask here first in case anything related to C5 directly was causing the expected behavior to...well...not work.
The expected behavior being that I can write to the file inside view.php as well as I can write to the file inside dispatcher.php.
Any insight would be appreciated.
Thanks.
Carlos