Req #38732 [Opn->Csd]: Parse files with #'s in front of comments

From: Date: Tue, 05 May 2015 17:10:39 +0000
Subject: Req #38732 [Opn->Csd]: Parse files with #'s in front of comments
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-192488@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=38732&edit=1

 ID:                 38732
 Updated by:         cmb@php.net
 Reported by:        jm at powertrip dot co dot za
 Summary:            Parse files with #'s in front of comments
-Status:             Open
+Status:             Closed
 Type:               Feature/Change Request
-Package:            Feature/Change Request
+Package:            *General Issues
 Operating System:   Linux / Windows / FreeBSD
 PHP Version:        5.1.6
-Assigned To:        
+Assigned To:        cmb
 Block user comment: N
 Private report:     N

 New Comment:

Indeed, as of PHP 5.3 a deprecation warning is thrown.


Previous Comments:
------------------------------------------------------------------------
[2011-09-19 14:02:35] technik at thomas-heuer dot eu

This is noted in the changelog for PHP 5.3.0:

"Hash marks (#) may no longer be used as comments and will throw a deprecation warning if
used."

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

------------------------------------------------------------------------
[2006-09-06 10:42:14] jm at powertrip dot co dot za

Description:
------------
# php -q generate-dlr.php

Warning:  Error parsing *snip* on line 279 in *snip* on line 77
*snip*(77) : Warning - Error parsing *snip* on line 279

Reproduce code:
---------------
In /tmp/test.ini

;=======================================================================
; This is a comment
;=======================================================================

[test]
testing=test

#======================================================================
# This is another comment
#======================================================================

[foo]
foo=bar

And the following in /tmp/test.php

<?php
$ini = parse_ini_file("/tmp/test.ini", true);
print_r($ini);

Expected result:
----------------
Warning:  Error parsing /tmp/test.ini on line 8
 in /tmp/test.php on line 2
/tmp/test.php(2) : Warning - Error parsing /tmp/test.ini on line 8



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



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


Thread (3 messages)

« previous php.bugs (#192488) next »