Connecting Tech Pros Worldwide Forums | Help | Site Map

Inclusion confusion (Javascript in function?)

Steve Brecher
Guest
 
Posts: n/a
#1: May 12 '06
Context: I am having a problem with the phpBB package. Currently about
0.4 on the 0-10.0 scale from utter cluelessness to wizardry with respect to
PHP, I find a small debugging package at
http://www.zend.com/zend/tut/tutorial-DebugLib.php
and take the script presented there and name its file debugging.php. It
includes several function definitions, but no other code. So that you don't
have to follow the link, my guess is that the relevant definition is:
function debug_open_window()
{
static $window_opened = FALSE;
if(!$window_opened)
{
?>
<script language="JavaScript">
debugWindow =
window.open("","debugWin","toolbar=no,scrollbars,w idth=600,height=400");
debugWindow.document.writeln('<html>');
debugWindow.document.writeln('<head>');
debugWindow.document.writeln('<title>PHP Remote Debug
Window</title>');
debugWindow.document.writeln('</head>');
debugWindow.document.writeln('<body><font face="verdana,arial">');
debugWindow.document.writeln('<hr size=1 width="100%">');
</script>
<?
$window_opened = TRUE;
}
}

I insert as the first statement of the phpBB's index.php:
include('debugging.php');

and load index.php. The aim is to see whether the debugging code will parse
error-free. I get the following output prior to the expected first page of
our Forum:

Warning: Cannot modify header information - headers already sent by (output
started at [path]/forum/debugging.php:1) in
[path]/forum/includes/page_header.php on line 483

and two more of the same warnings for lines 485 and 486. Each of these
statements is a call to header().

Am I the only one confused, or is the PHP 4.4.2 that my shared linux/Apache
host is running also confused? I am confused because I don't see how simply
defining functions could generate the warnings.

--
For mail, please use my surname where indicated:
steve@surname.reno.nv.us (Steve Brecher)



Steve Brecher
Guest
 
Posts: n/a
#2: May 12 '06

re: Inclusion confusion (Javascript in function?)


I wrote:[color=blue]
> I find a small debugging package at
> http://www.zend.com/zend/tut/tutorial-DebugLib.php
> and take the script presented there and name its file debugging.php. It
> includes several function definitions, but no other code.[/color]

But it does include a space character at the start of the file immediately
before "<?php" and that is what generated the warnings.

--
For mail, please use my surname where indicated:
steve@surname.reno.nv.us (Steve Brecher)


Chung Leong
Guest
 
Posts: n/a
#3: May 12 '06

re: Inclusion confusion (Javascript in function?)


Steve Brecher wrote:[color=blue]
> Context: I am having a problem with the phpBB package. Currently about
> 0.4 on the 0-10.0 scale from utter cluelessness to wizardry with respect to
> PHP, I find a small debugging package at
> http://www.zend.com/zend/tut/tutorial-DebugLib.php
> and take the script presented there and name its file debugging.php.[/color]

Good luck. Beware that debugging phpBB might make you go blind 8-)

Alan Little
Guest
 
Posts: n/a
#4: May 14 '06

re: Inclusion confusion (Javascript in function?)


Carved in mystic runes upon the very living rock, the last words of
Steve Brecher of comp.lang.php make plain:
[color=blue]
> I wrote:[color=green]
>> I find a small debugging package at
>> http://www.zend.com/zend/tut/tutorial-DebugLib.php
>> and take the script presented there and name its file debugging.php.
>> It includes several function definitions, but no other code.[/color]
>
> But it does include a space character at the start of the file
> immediately before "<?php" and that is what generated the warnings.[/color]

Always the first thing to suspect, with that sort of problem. The second
thing to suspect is white space after the ?>, and the third thing to
suspect is invisible characters (e.g. control characters) which can creep
in upon occasion.

--
Alan Little
Phorm PHP Form Processor
http://www.phorm.com/
Closed Thread