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

Parse error: syntax error, unexpected T_PAAMAYIM_NEKUDOTAYIM in GameQ.php on line 399 #5

Closed
gcphost opened this issue Nov 5, 2011 · 15 comments

Comments

@gcphost
Copy link

gcphost commented Nov 5, 2011

Testing on IIS 7.5 on Windows - regular gameq works great - your version 2 is failing to work.

Reproduce:

Use IIS 7.5
Download your GameQ
Browse to example

@gcphost
Copy link
Author

gcphost commented Nov 5, 2011

Sorry maybe cause its PHP 5.2 - forgot to check.

@Austinb
Copy link
Owner

Austinb commented Nov 5, 2011

Yes please check your php version. The actually code should be platform independent outside of needing PHP 5.3 plus some of the modules like zlib.

Let me know what you do to fix it.

@gcphost
Copy link
Author

gcphost commented Nov 5, 2011

PHP Version 5.2.14
System Windows NT 6.1 build 7601

I never got it to work so I adapted the Bf3 protocols to work for GameQ v1 - and that solved what I was needing. I'd love to use your GameQ version in our software (gamecp) but out of 1,000's of users only a small % use php 5.3 - php 5.3 still not to common (if you ask me).

@Austinb
Copy link
Owner

Austinb commented Nov 5, 2011

I am curious as to why it is failing there, I will have to look at the code. Might be late static bindings. If you find a solution that will work in 5.3 please fork and submit a pull request or let me know and I will be happy to add it in. Also, I plan on another refactoring of the GameQ.php class file here soon to clean things up from my speedy jump to v2.

To your point about 5.2 vs 5.3, php.net is no longer supporting the 5.2.x series as posted at http://www.php.net/archive/2010.php#id2010-12-16-1. This is the main reason why I ported the code to v2 and PHP 5.3.

Going to close this issue. If you find a solution please let me know and reopen this. I will try to make some backwards compatible changes but I do not have an environment setup with PHP 5.2 installed.

@Austinb Austinb closed this as completed Nov 5, 2011
@gcphost
Copy link
Author

gcphost commented Nov 5, 2011

No problems - wont be able to fix and keep php 5.3 compatability - google reports its:

"
T_PAAMAYIM_NEKUDOTAYIM is the double colon scope resolution thingy PHP uses - ::

Quick glance at your code, I think this line:

return $cnf::getConfig($key);

should be

return $cnf->getConfig($key);

The first is the way to call a method statically - this code would be valid if $cnf contained a string that was also a valid class. The -> syntax is for calling a method on an instance of a class/object.

"

I can understand PHP dropping 5.2 - but it did take about 2-3 years from people using 4 to upgrade to 5 - and now from 5.0/1/2 to 5.3 is seemingly going the same route. I'd be happy to look at this again in a year or two when PHP 5.3 is standard - and hopefully at that time it wont require PHP 6 lol.

@gcphost
Copy link
Author

gcphost commented Nov 5, 2011

Oh and BTW - thanks for getting GameQ going again - even tho I wont be able to use it in gamecp I am happy to see someone pick it up as GameQ is a great project. We're still adding new protocols every month because it was coded so well.

@Austinb
Copy link
Owner

Austinb commented Nov 5, 2011

I am confused. According to your title error is on line 399 (https://github.com/Austinb/GameQ/blob/v2/GameQ.php#L399). Has this changed? My guess from the Line 399 is the static call of $instance::PACKET_MODE_LINEAR as I believe this is new behavior.

Please let me know if this is not the correct line and open up a new ticket with the proper error. I will make a 5.2 branch and attempt to make some fixes that will satisfy the 5.2 requirements.

@gcphost
Copy link
Author

gcphost commented Nov 5, 2011

Hi

I was copying from the google search result - you are right about the line.

I managed to replace the ::'s with -> and got new errors - but it takes more then just editing the GameQ.php file - the protocols and other files seem to have the same issue from 5.2 to 5.3

Austinb added a commit that referenced this issue Nov 5, 2011
…ully work with PHP 5.2 (#5), unable to test.  Thanks to gcphost.
@Austinb
Copy link
Owner

Austinb commented Nov 5, 2011

I would imagine that changing those from static reference (::) to a pointer will not work anymore.

Please pull down the latest version if you can and test it for me. Will take me a while to setup a 5.2 environment to test on. I changed it to reference the base class instead of the $instance, since the $instance is kinda overkill because it is static across all protocols.

Thanks for you help.

@gcphost
Copy link
Author

gcphost commented Nov 5, 2011

re-downloaded, got diff line errors still regarding the ::'s - fixed those and onto more testing now.

@gcphost
Copy link
Author

gcphost commented Nov 5, 2011

ok had to comment out the bzip2 check as for some reason i cant get my windows iis install to load it - not exactly sure.. but dont think it matters for this -- went to test the cs example and got these errors:

Notice: Undefined property: GameQ_Protocols_Cs16::$PACKET_MODE_LINEAR in C:\inetpub\wwwroot\gq\GameQ.php on line 403

Notice: Undefined property: GameQ_Protocols_Cs16::$PACKET_CHALLENGE in C:\inetpub\wwwroot\gq\GameQ.php on line 585

Notice: Array to string conversion in C:\inetpub\wwwroot\gq\GameQ.php on line 585

Notice: Undefined property: GameQ_Protocols_Cs16::$PACKET_CHALLENGE in C:\inetpub\wwwroot\gq\GameQ.php on line 590

@Austinb
Copy link
Owner

Austinb commented Nov 5, 2011

Do you have SPL installed? http://www.php.net/manual/en/book.spl.php

Austinb added a commit that referenced this issue Nov 5, 2011
@Austinb
Copy link
Owner

Austinb commented Nov 5, 2011

Nevermind on that. Been a long day already. Try that last commit. I missed the other instances of $instance:: which 5.2 doesnt like.

Thanks for all of your help!

@gcphost
Copy link
Author

gcphost commented Nov 5, 2011

thanks! no more errors there - seems to work a little better -but w/o bzip2 support on my install I cant seem to get anywhere.

Also had issues using an internal ip
if($server_ip === $server_addr)
{
throw new GameQException("Unable to lookup ip for hostname '{$server_addr}'");
return false;
}
Seems to fail to properly check if using the internal ip - not sure GameQ 1 does this as I never had an issue there.

Might still just be my lack of bzip but w/ bzip exception disabled and the ip look up exception disabled the status isnt checked still (page just loads and loads).

I will keep pressing to get bz2 working - i may have to try one of my other servers.

thanks!!

@Austinb
Copy link
Owner

Austinb commented Nov 5, 2011

I will make a ticket about 127.0 and 10.10. Right now the system assumes any invalid internet ip is a hostname. So I will fix that. I use real internet accessible servers (gametracker.com) and use those to test games/mods with.

Bzip is used for source based games for decompressing the rules response. So if you do not have bzip2 installed I am not sure how the script will respond. In v1 if you didnt have bzip2 installed it just returned nothing for the rules response so you were left missing half the server information for source games.

Also make sure your timeout is not huge. In v2 the timeout param is in seconds, not milliseconds like in v1. I know of an issue with the loop not finishing for a long while because of this time limit. Its on my list of known issues. I would recommend nothing more than 5 seconds for the timeout $gq->setOption('timeout', 5). Note that this time out is per server you request information from.

I will setup a 5.2 environment to work on tonight/tomorrow so I will stop bugging you. But thank you for all your help with the testing.

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

2 participants