From d471b1525da51ce8a4f0fdd283f3e7734f3e84c1 Mon Sep 17 00:00:00 2001 From: "Christoph M. Becker" Date: Sun, 31 Mar 2019 11:40:05 +0200 Subject: [PATCH] Work around old-style constructors in PGO training case class.php of the pgo01org training case still uses PHP 4 style constructors, which trigger deprecation notices and as such may negatively affect the optimization. Until this will be fixed upstream, we're employing the workaround to modify the file during the PGO initialization step. --- pgo/cases/pgo01org/TrainingCaseHandler.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pgo/cases/pgo01org/TrainingCaseHandler.php b/pgo/cases/pgo01org/TrainingCaseHandler.php index bf23f5e..46a0c21 100644 --- a/pgo/cases/pgo01org/TrainingCaseHandler.php +++ b/pgo/cases/pgo01org/TrainingCaseHandler.php @@ -90,6 +90,13 @@ protected function setupDist() : void $constants = preg_replace(",define\('DB_HOST'.+,", "define('DB_HOST', '$db_host:$db_port');", $constants); file_put_contents($fl, $constants); + // work around + $fl = $htdocs . DIRECTORY_SEPARATOR . "class.php"; + $class = file_get_contents($fl); + $class = preg_replace(",function Student,", "function __construct", $class); + $class = preg_replace(",function Faculty,", "function __construct", $class); + file_put_contents($fl, $class); + //$php->exec($cmd, NULL, $env); /* TODO check status or switch to cli. */ $out = file_get_contents("http://$http_host:$http_port/init.php");