Ambiguity in result if ini_set

This is a discussion on Ambiguity in result if ini_set within the alt.comp.lang.php forums, part of the PHP Programming Forums category; I find that w.r.t. docs: string ini_set ( string varname, string newvalue) Sets the value of the given configuration ...


Go Back   Usenet Forums > PHP Programming Forums > alt.comp.lang.php

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 09-16-2003
Chris John Jordan
 
Posts: n/a
Default Ambiguity in result if ini_set

I find that w.r.t. docs:

string ini_set ( string varname, string newvalue)

Sets the value of the given configuration option. Returns the old value
on success, FALSE on failure.

if the old value is FALSE (or the indistinguishable NULL, or ""), the
result cannot be used to discover failure.

Have I misunderstood? Or must I discover failure some other way e.g.
ini_get.

Thanks.

--
Chris
Reply With Quote
  #2 (permalink)  
Old 09-16-2003
Jon Kraft
 
Posts: n/a
Default Re: Ambiguity in result if ini_set

Chris John Jordan <chrisjj@despammed.com> wrote:

> I find that w.r.t. docs:
>
> string ini_set ( string varname, string newvalue)
>
> Sets the value of the given configuration option. Returns the old value
> on success, FALSE on failure.
>
> if the old value is FALSE (or the indistinguishable NULL, or ""), the
> result cannot be used to discover failure.
>
> Have I misunderstood? Or must I discover failure some other way e.g.
> ini_get.


Hi Chris,

CHeck the return value with === or !== e.g.

if(ini_set("somevar", "somevalue")===FALSE){
if(ini_set("somevar", "somevalue")!==FALSE){

If the old value was FALSE or 0 it will be returned as string, not boolean.

HTH;
JOn
Reply With Quote
  #3 (permalink)  
Old 09-16-2003
Chris John Jordan
 
Posts: n/a
Default Re: Ambiguity in result if ini_set

Jon Kraft <jon@jonux.co.uk> wrote:
>CHeck the return value with === or !==


Excellent! Thanks, John.
--
Chris
Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 07:13 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0