Unexpected absence of expected warning

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

    Unexpected absence of expected warning

    Hi Group,
    The page 167 of book Learning PHP5 by David Sklar says that
    setcookie() and session_start() must be added before any output.
    I tried to use that functions at last line but no warning!.
    The warning which i got 1 month back is not issued now.
    ------------------------------------------------------------------
    The following is my PHP program
    <?php

    function Intelli()
    {
    echo"Hello P";
    }

    function Bitz()
    {
    echo"Hello MySQL";
    }

    ;
    $a = 1;
    if($a)
    $myFunc = 'Intelli';
    else
    $myFunc ='Bitz';

    $myFunc();
    print'header';

    session_start() ;
    setcookie('user id')
    ?>

    ----------------------------------------------------------------
    The following is the output i got.
    There is no warning

    [tdphpadmin@trgb ws40 ~/public_html/demo]$ php dynamicfun.php
    X-Powered-By: PHP/5.2.0
    Set-Cookie: ZDEDebuggerPres ent=php,phtml,p hp3; path=/
    Set-Cookie: PHPSESSID=bp1m1 7rlrgsa5g19tfek idov31; path=/
    Expires: Thu, 19 Nov 1981 08:52:00 GMT
    Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-
    check=0
    Pragma: no-cache
    Set-Cookie: userid=
    Content-type: text/html

    Hello Pheader
    -------------------------------------------------------------

    can any one explain why i din get the warning.....

  • Roy Kaldung

    #2
    Re: Unexpected absence of expected warning

    geevaa wrote:
    Hi Group,
    The page 167 of book Learning PHP5 by David Sklar says that
    setcookie() and session_start() must be added before any output.
    I tried to use that functions at last line but no warning!.
    The warning which i got 1 month back is not issued now.
    ------------------------------------------------------------------
    The following is my PHP program
    <?php
    >
    function Intelli()
    {
    echo"Hello P";
    }
    >
    function Bitz()
    {
    echo"Hello MySQL";
    }
    >
    ;
    $a = 1;
    if($a)
    $myFunc = 'Intelli';
    else
    $myFunc ='Bitz';
    >
    $myFunc();
    print'header';
    >
    session_start() ;
    setcookie('user id')
    ?>
    >
    ----------------------------------------------------------------
    The following is the output i got.
    There is no warning
    >
    [tdphpadmin@trgb ws40 ~/public_html/demo]$ php dynamicfun.php
    X-Powered-By: PHP/5.2.0
    Set-Cookie: ZDEDebuggerPres ent=php,phtml,p hp3; path=/
    Set-Cookie: PHPSESSID=bp1m1 7rlrgsa5g19tfek idov31; path=/
    Expires: Thu, 19 Nov 1981 08:52:00 GMT
    Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-
    check=0
    Pragma: no-cache
    Set-Cookie: userid=
    Content-type: text/html
    >
    Hello Pheader
    -------------------------------------------------------------
    >
    can any one explain why i din get the warning.....
    >
    Hi,

    one possibility could be activated output buffering. Check the setting
    of output_bufferin g in current settings.
    Hint <http://de.php.net/manual/en/ref.outcontrol. php>

    hth,
    Roy

    Comment

    • ZeldorBlat

      #3
      Re: Unexpected absence of expected warning

      On Apr 30, 8:04 am, geevaa <govivasa...@gm ail.comwrote:
      Hi Group,
      The page 167 of book Learning PHP5 by David Sklar says that
      setcookie() and session_start() must be added before any output.
      I tried to use that functions at last line but no warning!.
      The warning which i got 1 month back is not issued now.
      ------------------------------------------------------------------
      The following is my PHP program
      <?php
      >
      function Intelli()
      {
      echo"Hello P";
      >
      }
      >
      function Bitz()
      {
      echo"Hello MySQL";
      >
      }
      >
      ;
      $a = 1;
      if($a)
      $myFunc = 'Intelli';
      else
      $myFunc ='Bitz';
      >
      $myFunc();
      print'header';
      >
      session_start() ;
      setcookie('user id')
      ?>
      >
      ----------------------------------------------------------------
      The following is the output i got.
      There is no warning
      >
      [tdphpadmin@trgb ws40 ~/public_html/demo]$ php dynamicfun.php
      X-Powered-By: PHP/5.2.0
      Set-Cookie: ZDEDebuggerPres ent=php,phtml,p hp3; path=/
      Set-Cookie: PHPSESSID=bp1m1 7rlrgsa5g19tfek idov31; path=/
      Expires: Thu, 19 Nov 1981 08:52:00 GMT
      Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-
      check=0
      Pragma: no-cache
      Set-Cookie: userid=
      Content-type: text/html
      >
      Hello Pheader
      -------------------------------------------------------------
      >
      can any one explain why i din get the warning.....
      When I run the code I get the warning. Check that you have
      display_errors enabled and error_reporting set appropriately in
      php.ini.

      Comment

      Working...