Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Smir opened this issue Aug 15, 2017 · 8 comments
Open

Comments

@Smir
Copy link

Smir commented Aug 15, 2017

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

@Volodya1234
Copy link

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;
	}

@Smir
Copy link
Author

Smir commented Aug 16, 2017

Whats this for??

@Volodya1234
Copy link

  • 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.

@Smir
Copy link
Author

Smir commented Aug 28, 2017

I have no idea what you posted?

do you mean overwrite line44 with what you posted?

@Volodya1234
Copy link

  • 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.

@Pulseeey
Copy link

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

@InsaneSplash
Copy link

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

There is a missing ( in @Volodya1234 's code

@yavg
Copy link

yavg commented Jan 26, 2021

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants