mIRC Home    About    Download    Register    News    Help

Topic Options
#253981 - 17/07/15 12:56 AM $ini no longer returns 0
FroggieDaFrog Offline
Hoopy frood

Registered: 16/04/10
Posts: 910
Loc: USA
$ini(file, section) and $ini(file, section, 0) used to return 0 if the section did not exist, now it returns null.

Possibly related to:
change #30 of v7.39 (?)
I am SReject
My Stuff

#253995 - 17/07/15 04:37 PM Re: $ini no longer returns 0 [Re: FroggieDaFrog]
Khaled Offline

Planetary brain

Registered: 04/12/02
Posts: 4344
Loc: London, UK
Thanks for your bug report. I was able to reproduce this issue.

The behaviour for $ini(file, section, 0) was changed a long time ago as described here. It should not have been changed, as it broke scripts. However, someone must have reported it as a bug and, at the time, it looks like I agreed. However, in retrospect, returning 0 was correct.

In fact, there are several situations where $ini() should return 0 but instead returns $null. If all of these are changed to return 0, as they should, it will break all existing scripts that check for $null, as it did for the user in the older bug report.

The last version that returned 0 for $ini(test.ini, section) if section does not exist was mIRC v6.35. I could change $ini() to match mIRC v6.35 behaviour. However, this would break all scripts that have adapted since 2008. It's a tough call.

Update: I have added the following note to the help file $ini() entry: The behaviour of this identifier varies across versions, where either 0 or $null may be returned for a non-existent item.