[FX.php List] php 5 problems: I have tried to copy my existing scripts to php5 enabled servers

Carl Anderson Carl.Anderson at asu.edu
Mon Mar 5 09:30:33 MST 2007


Error, or warn?  I'm using it now, and I believe we're running 5 in-house,
but I haven't seen anything bomb.

(Mind you, most of what my $var happens to be is $_POST stuff anyhow, so
it's pretty well guaranteed to be set, by me.)

-- 
Carl Anderson 
Technical Support Analyst
Distance Learning 
Herberger College of Fine Arts
Arizona State University
http://herbergeronline.asu.edu


> From: Dale Bengston <dbengston at preservationstudio.com>
> Reply-To: "FX.php Discussion List" <fx.php_list at mail.iviking.org>
> Date: Mon, 5 Mar 2007 10:21:22 -0600
> To: "FX.php Discussion List" <fx.php_list at mail.iviking.org>
> Subject: Re: [FX.php List] php 5 problems: I have tried to copy my existing
> scripts to php5 enabled servers
> 
> However...
> 
> $var = trim($var);
> 
> ...will error under PHP 5 if $var is not set.
> 
> Dale
> 
> 
> On Mar 5, 2007, at 9:57 AM, Carl Anderson wrote:
> 
>> Regarding isset() ...  Try empty($var) instead.  It returns false
>> when you'd
>> expect it to (for the most part), even when the variable exists.
>> 
>> What I'll often do is something like this, just to be safe:
>> 
>> $var = trim($var);
>> if ( empty($var) ) {
>>     // do something if $var is empty
>>     ...
>> }
>> 
>> -- 
>> Carl Anderson
>> Technical Support Analyst
>> Distance Learning
>> Herberger College of Fine Arts
>> Arizona State University
>> http://herbergeronline.asu.edu
>> 
>> 
>>> From: Bob Patin <bob at patin.com>
>>> Reply-To: "FX.php Discussion List" <fx.php_list at mail.iviking.org>
>>> Date: Mon, 5 Mar 2007 09:48:44 -0600
>>> To: "FX.php Discussion List" <fx.php_list at mail.iviking.org>
>>> Subject: Re: [FX.php List] php 5 problems: I have tried to copy my
>>> existing
>>> scripts to php5 enabled servers
>>> 
>>> I've always tested to make sure that not only is there a session
>>> variable by that name, but also that it's not empty, by using
>>> 
>>> if(strlen($_SESSION['myvar'])>0)
>>> 
>>> Probably an easier way, but it works fine for me so that's how I've
>>> been doing it...
>>> 
>>> I used to use isset, but sometimes I found that a variable was there,
>>> but there was nothing in it...
>>> 
>>> Bob Patin
>>> Longterm Solutions
>>> bob at longtermsolutions.com
>>> 615-333-6858
>>> http://www.longtermsolutions.com
>>> 
>>>    CONTACT US VIA INSTANT MESSAGING:
>>>       AIM or iChat: longterm1954
>>>       Yahoo: longterm_solutions
>>>       MSN: tech at longtermsolutions.com
>>>       ICQ: 159333060
>>> 
>>> 
>>> On Mar 5, 2007, at 9:00 AM, Dale Bengston wrote:
>>> 
>>>> With PHP 4, I used to do a lot of evaluations like
>>>> 
>>>> if ($_SESSION['whatever'])
>>>> 
>>>> ...using the presence or absence of a variable to decide action.
>>>> PHP 5 requires more explicit references, like
>>>> 
>>>> if (isset($_SESSION['whatever']))
>>>> if (!empty($_SESSION['whatever']))
>>>> 
>>>> ...so I can't be sloppy any more. Maybe you're running into this?
>>>> 
>>>> Dale
>>>> 
>>>> 
>>>> On Mar 5, 2007, at 6:30 AM, Gjermund Gusland Thorsen wrote:
>>>> 
>>>>> php 5 problems: I have tried to copy my existing scripts to php5
>>>>> enabled servers
>>>>> 
>>>>> It has problems, especially with ifs while traversing arrays in
>>>>> _REQUEST and _SESSION
>>>>> 
>>>>> anyone else encountered this?
>>>>> 
>>>>> ggt667
>>>>> _______________________________________________
>>>>> FX.php_List mailing list
>>>>> FX.php_List at mail.iviking.org
>>>>> http://www.iviking.org/mailman/listinfo/fx.php_list
>>>> 
>>>> _______________________________________________
>>>> FX.php_List mailing list
>>>> FX.php_List at mail.iviking.org
>>>> http://www.iviking.org/mailman/listinfo/fx.php_list
>>> 
>>> _______________________________________________
>>> FX.php_List mailing list
>>> FX.php_List at mail.iviking.org
>>> http://www.iviking.org/mailman/listinfo/fx.php_list
>> 
>> _______________________________________________
>> FX.php_List mailing list
>> FX.php_List at mail.iviking.org
>> http://www.iviking.org/mailman/listinfo/fx.php_list
> 
> _______________________________________________
> FX.php_List mailing list
> FX.php_List at mail.iviking.org
> http://www.iviking.org/mailman/listinfo/fx.php_list



More information about the FX.php_List mailing list