Re: [PHP4BETA] SESS constant a not that good idea?

From: Date: Sat, 12 Jun 1999 16:11:37 +0000
Subject: Re: [PHP4BETA] SESS constant a not that good idea?
References: 1  Groups: php.version4 
Request: Send a blank email to php-version4+get-1531@lists.php.net to get a copy of this message
On Sat, Jun 12, 1999 at 01:50:32AM +0200, Boris Erdmann wrote: > First of all i am not that familiar with the constants > behaviour of PHP: > > will a define("SESS","sometext") and later <?php SESS?> > not produce a syntax error as sometext is not supposed > to be valid PHP source? You mean <?=SID?>. The <?= ... ?> has a special meaning (borrowed from ASP) and prints out the inner expression. > dont we need a clever way to generally do a We don't need that generally. Think of almost static HTML pages - they have static URLs, so you can simply construct a <A HREF="/some.url?<?=SID?>">... instead of writing (in PHPLIB's case) <A HREF="<? $sess->purl("/some.url"); ?>">... There is also a difference in speed. <?=SID?> is only a string which is inserted into the output. purl is a full user function which is much complexer (needs a full ereg_replace to work). > For this kind of cleverness a simple constant will not > suffice. > > We have something like surl() in PHPLIB because we want > to be able to write scripts independent from the session > id propagation method. Moreover: a clever propagation > method detection mechanism will do the rest for us. > We dont care for the propagation method. > That mechanism resides in a prepend file and the surl() > like function decides if there has to be done modification > to the given url. Well, not all cases are as complex as you discuss them here. SID is set to <session-name>=<session-id>, if no cookie with the name <session-name> exists. The propagation detection method in PHPLIB is quite complex and sometimes results in very clever endless loops as observed by some people. Even if this happens only on broken servers, the possibility is not feasible at all. We'll try to avoid this by not redirecting the user on the first hit. Instead, the session module sets a cookie and the SID, if no cookie/get/post variable exists with the name <session-name>. Nevertheless, I plan on adding a function similar to $sess->url(). -- Regards, Sascha Schumann Consultant

« previous php.version4 (#1531) next »