php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #77256 PHP Version => 5.6.30-0+deb8u1
Submitted: 2018-12-06 20:14 UTC Modified: 2018-12-12 11:04 UTC
From: kzg dot xc dot hu at gmail dot com Assigned:
Status: Not a bug Package: *Directory/Filesystem functions
PHP Version: 5.6.30 OS: Debian Jessie
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: kzg dot xc dot hu at gmail dot com
New email:
PHP Version: OS:

 

 [2018-12-06 20:14 UTC] kzg dot xc dot hu at gmail dot com
Description:
------------
---
From manual page: https://php.net/function.parse-ini-file
---

PHP Version => 5.6.30-0+deb8u1

Test script:
---------------
$file_content=<<<thisone
no = "norvegian"
thisone;
$fName='/var/tmp/norvegian.txt';
$fp = fopen($fName, 'w');
fwrite($fp, $file_content);
fclose($fp);

$TOarrayORnotTOarray= parse_ini_file ($fName);
// PHP Warning:  syntax error, unexpected BOOL_FALSE in /var/tmp/norvegian.txt on line 1  in php shell code on line 1

var_dump($TOarrayORnotTOarray);
// output: bool(false)
// echo file_get_contents( $fName ); works fine


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2018-12-06 20:28 UTC] requinix@php.net
-Status: Open +Status: Not a bug
 [2018-12-06 20:28 UTC] requinix@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

> 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.
 [2018-12-07 05:01 UTC] kzg dot xc dot hu at gmail dot com
-PHP Version: 5.6.39 +PHP Version: 5.6.30
 [2018-12-07 05:01 UTC] kzg dot xc dot hu at gmail dot com
I see, that there are some limitations in keys, but this one is very uncomfortable, since "no" is the official ISO 3166-1 alpha-2 code of Norway.
 [2018-12-07 05:33 UTC] requinix@php.net
As a workaround, put a space at the beginning of the line. Not sure it should work, but it does.

$file_content=<<<thisone
 no = "norvegian"
thisone;
 [2018-12-11 20:14 UTC] a at b dot c dot de
If you've got control over the codes used, ISO639-2 provides three-letter codes for languages; neither "yes" nor "off" conflict with this list.
 [2018-12-12 10:56 UTC] kzg dot xc dot hu at gmail dot com
Thx a at b dot c dot de, of course I have control over the code, since I am writing that. It is some kind of parameter check of the online Google translator, and sadly, they use "no" as an identifier for "Norvegian". The simpliest way is: $chkarray["no"]="Norvegian". As a php source code, it is accepted, and works error-free. Some sniffing around docs, makes clear, that nowadays there is no official put_ini_file, or similar function, therefore all of us have the ability writing a proprietary code.It can be either file_put_contents, or write it line-by line, etc, or just write 1 line to the end of the strem, as I did. Writing a space to the beginning of each line is simple and effective.
 [2018-12-12 11:04 UTC] kzg dot xc dot hu at gmail dot com
To requinix: thxs, it works, and I do apologize forgetting earlier to send that reply to you.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 16:01:28 2024 UTC