Forum


Replies: 4   Views: 713
Warning ini file
Topic closed:
Please note this is an old forum thread. Information in this post may be out-to-date and/or erroneous.
Every phpdocx version includes new features and improvements. Previously unsupported features may have been added to newer releases, or past issues may have been corrected.
We encourage you to download the current phpdocx version and check the Documentation available.

Posted by admin  · 23-10-2022 - 08:34

Hello,

We have tested in with PHP 8, PHP 8.1 and PHP 8.2 and no warning appears. 

Please check you have not commented all settings section in config/phpdocxconfig.ini or the file is missing in the phpdocx folder installation or the file has some wrong content that can't be parsed. The default content in this INI file is the following:

[settings]
; absolute path to the temp dir. If empty the default system tmp directory will be used
temp_path = ""

; if set to true: detects if the contents are UTF-8 encoded and if not encodes them
; if set to false do nothing
encode_to_UTF8 = "false"

; default document language
language = "en-US"

; default paper size
paper_size = "A4"

; right to left languages config
;bidi = "true"
;rtl = "true"

; if true, generate the DOCX as stream instead of saving it to the file system. Only available for Premium licenses
;stream="true"

[license]
; PHPDocX license code
code = ""
; subdomain (Basic license), domain (Advanced license) or IP (Premium license)
value = ""

[transform]
; transform options. Only available for Advanced and Premium licenses

; libreoffice, native, msword, openoffice
;method = "libreoffice"

; libreoffice installation path, absolute path
;path = "/opt/libreoffice/program/soffice"

; custom HOME folder; allows setting a custom HOME folder when doing the transformations using LibreOffice
;home_folder = ""

As you can check the settings key is set, including the encode_to_UTF8 key. The line you point out is the following:

if ($this->_phpdocxconfig['settings']['encode_to_UTF8'] == 'true'

_phpdocxconfig is an internal variable that contains config/phpdocxconfig.ini parsed. Please check you have not removed this required section in the file (or you have removed the whole file).

From your PHP information:

<b>Warning</b>:  Trying to access array offset on value of type null in

it seems the config/phpdocxconfig.ini file doesn't exist or it's not valid or it can't be readed.

Regards.