Support A2Billing :

provided by Star2Billing S.L.

Support A2Billing :
It is currently Thu Mar 28, 2024 8:33 am
Auto Dialer Software


All times are UTC




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: Suggestion about a2billing.conf
PostPosted: Fri Jan 18, 2008 5:40 pm 
Offline
User avatar

Joined: Mon Apr 30, 2007 6:43 am
Posts: 1060
Location: Canada
Hello fellow PHP Coders

Can we all agree on enclosing all parameters in a2billing.conf in double-quotes?

I have seen many configuration options that could lead to an unexpected behavior. The parsed value may lead to problem. I have not make particular tests, I was just observing and predicting the results.

For example, what should happen in the following case? Notice the space after the commas.

Code:
file_ext_allow = gsm, mp3, wav


On safe way to avoid any undiscovered or unexpected behavior will be to adopt the double-quote style like this (in throughout the .conf file). Even for the most base values

Code:
file_ext_allow = "gsm, mp3, wav"
num_musiconhold_class = "10"


What do you with?


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jan 18, 2008 6:10 pm 
Offline

Joined: Thu Oct 19, 2006 9:56 am
Posts: 300
Location: Athens, Greece
There is an even better suggestion (=solution), made by stavros in 1.4 : put all conf into the db and have it properly quoted there.
:)

Now, wrt. the entries in a .conf file, it's only a matter of the sample configuration. Apart from that, it is a predefined PHP algorithm that reads the file. We really can't/don't want to mess with that algorithm. This means that we practically cannot enforce the quoting style.


Top
 Profile  
 
 Post subject: Re: Suggestion about a2billing.conf
PostPosted: Fri Jan 18, 2008 7:11 pm 
Offline
Moderator
User avatar

Joined: Thu Jun 22, 2006 2:19 pm
Posts: 2890
Location: Devon, UK
asiby wrote:
Only safe way to avoid any undiscovered or unexpected behavior will be to adopt the double-quote style like this (in throughout the .conf file). Even for the most base values
Code:
file_ext_allow = "gsm, mp3, wav"
num_musiconhold_class = "10"
The .INI file format is very old and whilst it is described in detail by the Amiga Forever developers, documentation on exactly how to parse an .INI file varies. To further complicate things A2B already uses PHP's parse_ini_file() and also Perl's Config::IniFiles, and I'm not convinced they both obey exactly the same rules.

I see no ambiguity in your example. Those values will all be read in as strings. If you were hoping to create an array of the values I believe the syntax (for at least PHP's INI loader) you should be using is:
Code:
file_exten_allow[] = gsm
file_exten_allow[] = mp3
file_exten_allow[] = wav

Whilst I appreciate that simple oversights in an .INI file can cause inexperienced users trouble, in my opinion the problem here is the user's inexperience. The problem with trying to fool-proof things is that they keep making better fools. I don't think it's asking too much of someone aiming to run an ITSP to insist they familiarise themselves with what must be the simplest and probably even the most prevalent human-readable configuration file format.

xrg wrote:
There is an even better suggestion (=solution), made by stavros in 1.4
I can't accept the praise/blame for that; I thought it was Areski's idea. Personally, I'd rather stick with .INI files for all the configuration for two reasons: editing is much quicker than the alternatives, and it's trivial to keep a plain-text config file under version control.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jan 18, 2008 7:33 pm 
Offline
User avatar

Joined: Mon Apr 30, 2007 6:43 am
Posts: 1060
Location: Canada
There is no complicated algorithm for the config file. It is simply being parsed with the PHP function parse_init_file().

Even with the configuration moved in the database with version 1.4, the configuration is still going to read something from a file before parsing the rest of the configuration from the database.

It may be a good idea for everyone who is still running v1.2.3 or 1.3.x to enclose the values in double-quote.

Added after 17 minutes:

My example was pretty simple. But I know for a fact that I have used a password that contained many non alphanumeric characters that caused the connection to MySQL failed and I was receiving a message about invalid card length.

It's only after printing out the values that I have noticed that the password were not being properly parsed.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jan 18, 2008 8:04 pm 
Offline

Joined: Thu Oct 19, 2006 9:56 am
Posts: 300
Location: Athens, Greece
asiby wrote:
There is no complicated algorithm for the config file. It is simply being parsed with the PHP function parse_init_file().

Still, the internals of this function are not absolutely listed in that page. To make things worse, it won't even return an error when parsing fails.

Quote:
Even with the configuration moved in the database with version 1.4, the configuration is still going to read something from a file before parsing the rest of the configuration from the database.

That's true, both for v1.4 and v2.0

Quote:
It may be a good idea for everyone who is still running v1.2.3 or 1.3.x to enclose the values in double-quote.


Agreed! We may put a bold, sticky topic saying: do you have weird chars in your .conf? Quote them!


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 
Voice Broadcast System


All times are UTC


Who is online

Users browsing this forum: No registered users and 6 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group