Open high-rolls opened 2 months ago
Hello @high-rolls can you please provide us with the following information to help us better triage this issue?
Thank you in advance.
Hello @achakko , here's the information you need:
<?php
require 'vendor/autoload.php';
use Matomo\Ini{IniReader, IniWriter};
$writer = new IniWriter(); $iniArray = ['Section 1' => ['test' => true]]; $writer->writeToFile('bool_test.ini', $iniArray); $reader = new IniReader(); $readArray = $reader->readFile('bool_test.ini'); echo gettype($readArray['Section 1']['test']); // 'boolean' expected, got 'integer' instead ?>
4. I'm not a customer, I'm just using this library for a personal project.
5. N/A
6. I use only this component, version 3.0.1
7. PHP version 8.2.12
8. N/A
9. N/A
10. N/A #
Also, here's the linked PR: #26
IniWriter's encode method encodes boolean values as either 1 or 0, but IniReader's decode reads 1 and 0 as integer values. When reading and writing the same .ini file array using the library, all boolean values will be converted to integers.