Inclusion confusion (Javascript in function?)

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Steve Brecher

    Inclusion confusion (Javascript in function?)

    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

    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_wind ow()
    {
    static $window_opened = FALSE;
    if(!$window_ope ned)
    {
    ?>
    <script language="JavaS cript">
    debugWindow =
    window.open("", "debugWin","too lbar=no,scrollb ars,width=600,h eight=400");
    debugWindow.doc ument.writeln(' <html>');
    debugWindow.doc ument.writeln(' <head>');
    debugWindow.doc ument.writeln(' <title>PHP Remote Debug
    Window</title>');
    debugWindow.doc ument.writeln(' </head>');
    debugWindow.doc ument.writeln(' <body><font face="verdana,a rial">');
    debugWindow.doc ument.writeln(' <hr size=1 width="100%">') ;
    </script>
    <?
    $window_opened = TRUE;
    }
    }

    I insert as the first statement of the phpBB's index.php:
    include('debugg ing.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.r eno.nv.us (Steve Brecher)


  • Steve Brecher

    #2
    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.r eno.nv.us (Steve Brecher)


    Comment

    • Chung Leong

      #3
      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-)

      Comment

      • Alan Little

        #4
        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

        Comment

        Working...