Cookies again: Expiry Date

Andre Garzia andre at andregarzia.com
Mon Sep 6 12:45:50 EDT 2010


On Mon, Sep 6, 2010 at 1:36 PM, Gregory Lypny
<gregory.lypny at videotron.ca> wrote:
> Hi Stephen,
>
> Just to add to Andre's tip, I've found the setting and getting of cookies to be extremely finicky.  One thing that tripped me up for about four hours was the placement of <?rev in scripts.  It must appear in the very first line of any script involving cookies.  Leave a blank first line, and it is possible that everything in a script will work except for things having to do with cookies!
>

Gregory,

That is not an actual bug but a design behaviour. RevServer engine
will output things as soon as it can, meaning that the blank line will
be sent as is back to apache server as soon as your script starts
executing. HTTP Headers must be sent to apache before actual output is
sent, so if you have a blank line on top of your file, that is treated
by the engine as "hey you want to output a blank line, fine!" and thus
all the subsequent put header calls will fail since apache will pick
that blank line and start outputing everyting as content and not as
headers.

RevServer will start the flush output process if it finds anything
that is not enclosed into a <?rev tag or if it finds the closing ?>
tag.

So if you start your code with a <?rev but closes it with a ?> and
then the output will also begin. This is good to know because of
includes, if you put ?> in your includes, the very act of including a
file will start the output. So take those ?> out of the include files.

Before anyone ask why this is so it is because PHP engine does it this
way and we decided to copy them.



> Regards,
>
> Gregory
>


-- 
http://www.andregarzia.com All We Do Is Code.



More information about the use-livecode mailing list