PDA

View Full Version : class_language.php cause PHP Notice on Undefined variable $controller


anno1986
01-22-2014, 02:59 PM
In some cases the $control is undefined and this can cause a PHP Notice.
Its not urgent but annoying when going thru error_log


--- v1.3.4/classes/class_language.php 2013-04-18 19:42:30.000000000 +0200
+++ src/classes/class_language.php 2014-01-21 21:26:09.000000000 +0100
@@ -105,6 +105,7 @@
*/
private function locate($file){
$mysidia = Registry::get("mysidia");
+ $controller = '';
if($mysidia->input->get("frontcontroller") != "index"){
$controller = "{$mysidia->input->get("frontcontroller")}/";
}

Hall of Famer
01-27-2014, 02:00 AM
Notice errors are caused by not checking the existence of variables at first. In Mys v1.3.4, the notice error ususally occurs with PHP native strings. In Mys v1.4.0, almost everything is an object so you wont get notice errors. Most people do not have notice errors enabled on their web servers though, so only users with their own servers will likely to ever receive them.

Anyway just like the OP suggested, the easiest way to get rid of notice errors is to simply define the missing variable to be an empty string or even NULL at the very beginning.

anno1986
01-27-2014, 02:48 AM
is the version 1.4.0 already available?

Hall of Famer
01-27-2014, 05:28 AM
Nope, its months away from available.