ini icon indicating copy to clipboard operation
ini copied to clipboard

PHP special characters that need to be quoted

Open seebees opened this issue 10 years ago • 1 comments

From: http://php.net/manual/en/function.parse-ini-string.php

<quote> Note: There are reserved words which must not be used as keys for ini files. These include: null, yes, no, true, false, on, off, none. Values null, off, no and false result in "", and values on, yes and true result in "1", unless INI_SCANNER_TYPED mode is used. Characters ?{}|&~![()^" must not be used anywhere in the key and have a special meaning in the value. </quote>

I'm not sure if you want to support this. It would help me out as I have a grunt task that rebuilds an INI for a PHP project.

This PR required changes to the tests for obvious reasons

e.g.

zr[]=deedee becomes "zr[]"=deedee

your code currently will turn both of these into:

{ zr: [ 'deedee' ] }

So I'm not sure what kind of havoc this would cause with current users...

The specific issue I have is:

asdf = "^something(?:/([^/]+)(?:/special/(.*))?)?"

decodes nicely, but encodes back to:

asdf=^something(?:/([^/]+)(?:/special/(.*))?)?

Which does not parse nicely in parse-ini-string

seebees avatar Aug 19 '15 17:08 seebees

@seebees if you make this PR to https://github.com/rijnhard/ini-extra I'll review it.

But you will need to change the implementation though, ini-extra has a decode filters option, if you implement an encode filters that mirrors that functionality then I'll accept.

rijnhard avatar May 24 '18 12:05 rijnhard

Closing this one due to age, and the fact that tests don't pass locally for me on this. If this is something folks need please resubmit w/ working tests.

wraithgar avatar Apr 11 '23 20:04 wraithgar