Bug #63512 [Asn]: parse_ini_file() with INI_SCANNER_RAW removes quotes from value.

From: Date: Fri, 16 Nov 2012 01:23:41 +0000
Subject: Bug #63512 [Asn]: parse_ini_file() with INI_SCANNER_RAW removes quotes from value.
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-174738@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=63512&edit=1

 ID:                 63512
 Updated by:         pierrick@php.net
 Reported by:        arjen at react dot com
 Summary:            parse_ini_file() with INI_SCANNER_RAW removes quotes
                     from value.
 Status:             Assigned
 Type:               Bug
 Package:            Filesystem function related
 Operating System:   All
 PHP Version:        5.3.18
 Assigned To:        pierrick
 Block user comment: N
 Private report:     N

 New Comment:

Current status is : 
- we can't as suggested keep all " to make a "real" raw, because of BC
- we can't remove all the quotes would not make sense for some cases like
  c = "waa" INSTALL_ROOT
- we need to fix the bug where c="foo;bar" will result in c="foo (This is why the 
commit causing the current bug was first made)

So I think this patch is the best one for the moment since it fix the original 
bug, and keep the old behaviour to keep BC.


Previous Comments:
------------------------------------------------------------------------
[2012-11-15 13:39:18] laruence@php.net

codes looks fine, and new comment coming :)
thanks

------------------------------------------------------------------------
[2012-11-15 13:32:23] arjen at react dot com

With this patch, the old behaviour is restored. But the "eat leading and trailing quotes"
does 
not make sense..

var_dump(parse_ini_string('waa = "string" CONSTANT "anotherString"',
false, 
INI_SCANNER_RAW));

5.3.18 (wrong):
array(1) {
  ["waa"]=>
  string(29) "string CONSTANT anotherString"
}

with patch (behaviour like in versions < 5.3.15)

array(1) {
  ["waa"]=>
  string(29) "string" CONSTANT "anotherString"
}


Now string appears to be the constant, and CONSTANT a quoted string..

expected/better:
array(1) {
  ["waa"]=>
  string(29) ""string" CONSTANT "anotherString""
}

So IHMO remove this whole trim quotes thingy.

------------------------------------------------------------------------
[2012-11-15 04:46:29] pierrick@php.net

The following patch has been added/updated:

Patch Name: 63512-v3.diff
Revision:   1352954789
URL:        https://bugs.php.net/patch-display.php?bug=63512&patch=63512-v3.diff&revision=1352954789

------------------------------------------------------------------------
[2012-11-15 04:45:54] pierrick@php.net

I created a patch for this bug (which also fix #62884).

Could you make a quick code review before I commit it ? 

Thanks

------------------------------------------------------------------------
[2012-11-15 04:12:53] pierrick@php.net

The following patch has been added/updated:

Patch Name: 63512-v2.diff
Revision:   1352952773
URL:        https://bugs.php.net/patch-display.php?bug=63512&patch=63512-v2.diff&revision=1352952773

------------------------------------------------------------------------


The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at

    https://bugs.php.net/bug.php?id=63512


-- 
Edit this bug report at https://bugs.php.net/bug.php?id=63512&edit=1


Thread (10 messages)

« previous php.bugs (#174738) next »