LookingGlass icon indicating copy to clipboard operation
LookingGlass copied to clipboard

Fatal error: Uncaught Error: Function name must be a string in /ajax.php:44

Open Smir opened this issue 7 years ago • 8 comments

Just installed and can't ping, traceroute or anything to do with that area. Fatal error: Uncaught Error: Function name must be a string in /ajax.php:44 Stack trace: #0 {main} thrown in /ajax.php on line 44 Line 44 of ajax.php reads; $output = $lg->$_GET['cmd']($_GET['host']);

Regards

Smir avatar Aug 15 '17 15:08 Smir

I will do this string for case:

	switch ($_GET['cmd']) {
		case "host":
			$output = $lg->host($_GET['host']);
			break;
		case "mtr":
			$output = $lg->mtr($_GET['host']);
			break;
		case "mtr6":
			$output = $lg->mtr6($_GET['host']);
			break;
		case "ping":
			$output = $lg->ping($_GET['host']);
			break;
		case "ping6":
			$output = $lg->ping6($_GET['host']);
			break;
		case "traceroute":
			$output = $lg->traceroute($_GET['host']);
			break;				
		case "traceroute6":
			$output = $lg->traceroute6($_GET['host']);
			break;
	}

Volodya1234 avatar Aug 16 '17 06:08 Volodya1234

Whats this for??

Smir avatar Aug 16 '17 21:08 Smir

  • Whats this for?? This is fix.

Not all people are programmers and sometimes come to the github to find a solution to the problem and nothing more. I wrote a simple solution to this problem.

Volodya1234 avatar Aug 28 '17 14:08 Volodya1234

I have no idea what you posted?

do you mean overwrite line44 with what you posted?

Smir avatar Aug 28 '17 15:08 Smir

  • do you mean overwrite line44 with what you posted?

Yes. It is necessary to rewrite this function in line44 to the code that I wrote above.

Volodya1234 avatar Aug 28 '17 16:08 Volodya1234

I just rewrote it to this, PHP 7 likes it now. $output = $lg->{$_GET['cmd']}$_GET['host']);

Pulseeey avatar Aug 30 '17 12:08 Pulseeey

$output = $lg->{$_GET['cmd']}($_GET['host']);

There is a missing ( in @Volodya1234 's code

InsaneSplash avatar Oct 01 '17 19:10 InsaneSplash

after i change $output = $lg->$_GET'cmd'; to $output = $lg->{$_GET['cmd']}($_GET['host']); my lg is work now.

yavg avatar Jan 26 '21 14:01 yavg