contao / manager-plugin

Contao Manager Plugin
GNU Lesser General Public License v3.0
4 stars 9 forks source link

Handling of disabled "parse_ini_file()" function #8

Closed bennyborn closed 6 years ago

bennyborn commented 6 years ago

I just deployed a new installation on a hosting where the function parse_ini_file was disabled by default for security reasons. This causes quite some trouble since all autoload.ini files are ignored and the order in which dependencies are loaded are not resolved correctly.

Even though the IniParser throws a RuntimeException the user never gets any notification that there was a serious error. This should at least create an entry in the logs to make debugging of such scenarios much easier - it cost my quite some time to figure it out :\

https://github.com/contao/manager-plugin/blob/24afc56e4dad5c0ed73b97d7d94905e03c45bbdf/src/Bundle/Parser/IniParser.php#L104-L108

aschempp commented 6 years ago

Shouln't you get the exception message in that case?

bennyborn commented 6 years ago

I guess, but it seems that this exception is already handled elsewhere and not passed through to the frontend.

leofeyer commented 6 years ago

The problem is that parse_ini_file()returns null in this case. And the PHP warning will only be shown once when the container is built and then never again.

leofeyer commented 6 years ago

Fixed in 546e28ad1b69e1ba3121289b0a3862541348f47d.

aschempp commented 6 years ago

The documentation says something else?

The settings are returned as an associative array on success, and FALSE on failure.

leofeyer commented 6 years ago

¯\(ツ)

I have tested it and it was null.

bennyborn commented 6 years ago

What the documentation says is the behaviour of the function itself. If the function is disabled at all I'm pretty sure the behaviour is different e.g. returning null like Leo said.

aschempp commented 6 years ago

That's funny. I would assume a different exception if the method does not exists at all, but maybe this is just our beloved PHP magic 😂