From d17098e7037e448f01a35b99619d4959ac657558 Mon Sep 17 00:00:00 2001 From: Thomas Keller Date: Tue, 5 Jun 2012 20:55:21 +0200 Subject: [PATCH] Ensure that PHP doesn't interpret read ini file values and therefor scrambles the output of hgrc files (issue 523). --- NEWS.mdtext | 4 ++++ src/IDF/Plugin/SyncMercurial.php | 5 ++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/NEWS.mdtext b/NEWS.mdtext index a55e25f..2545b30 100644 --- a/NEWS.mdtext +++ b/NEWS.mdtext @@ -5,6 +5,10 @@ or newer to run properly! ## Bugfixes +- A long standing bug in the Mercurial plugin that lead to corruption + of boolean configuration values in the `hgrc` of the served repository + has been fixed (issue 523). + - If an anonymous or authenticated user had no access to any project in a forge, all projects were listed for him (but still no one was actually accessible). This has been fixed. diff --git a/src/IDF/Plugin/SyncMercurial.php b/src/IDF/Plugin/SyncMercurial.php index ac6855c..f6dba9b 100644 --- a/src/IDF/Plugin/SyncMercurial.php +++ b/src/IDF/Plugin/SyncMercurial.php @@ -178,7 +178,10 @@ class IDF_Plugin_SyncMercurial // Generate hgrc content if (is_file($hgrc_file)) { - $tmp_content = parse_ini_file($hgrc_file, true); + $tmp_content = @parse_ini_file($hgrc_file, true, INI_SCANNER_RAW); + if ($tmp_content === false) { + throw new Exception('could not parse "'.$hgrc_file.'" because of syntax problems'); + } $tmp_content['web']['allow_push'] = $allow_push; } else {