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

Error on Mobile_Detect.php line 22 #6

Closed
ezMaverick opened this issue Sep 27, 2012 · 14 comments
Closed

Error on Mobile_Detect.php line 22 #6

ezMaverick opened this issue Sep 27, 2012 · 14 comments
Assignees

Comments

@ezMaverick
Copy link

I'm getting an error:
Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in Mobile_Detect.php on line 22
It shows only on my ixwebhosting server. I tested it on hostgator and there is no problem at all.
Any idea?

@ghost ghost assigned serbanghita Sep 27, 2012
@serbanghita
Copy link
Owner

@ezMaverick the host you are using has PHP4 installed, remove all 'public' and 'private' keywords in front of the functions. The class is designed for PHP5.

@ezMaverick
Copy link
Author

no luck.
still getting an error "Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in d:\hshome\user\Mobile_Detect.php on line 22

@carpii
Copy link

carpii commented Oct 1, 2012

Whats on line 22?
But really, PHP 4 stopped being supported in 2008.
Its doesn't even get security fixes anymore. You really need to migrate to PHP 5

@ezMaverick
Copy link
Author

Line 22 is protected $userAgent = null;
and if there is no way to use it under 4 I will migrate to 5.
thanks again.

@carpii
Copy link

carpii commented Oct 1, 2012

You'd need to remove all 'protected' too.
PHP 4 had next to no OO support, and so 'public', 'private' and 'protected' mean nothing to it.

I do think you'd be better moving to PHP 5, but I should point out I'm just a user and not speaking on behalf of mobile_detect :)

@ezMaverick
Copy link
Author

I take down 'public', 'private' and 'protected' and still showing that error. Well PHP 5 here you go...
carpii, thanks for helping

@alva2409
Copy link

  1. "public", "private" -> delete
  2. "protected" -> "var"
  3. "self::VER" -> "$this->VER"
  4. VER - from const to DEFINE
    As result - no errors & particaly work in php 4, but not fully!

@curiousworx
Copy link

I modified this to work in PHP4 (at least the main functionality tested.) I'm new to git/github but the change can be found in my public repository.

@alva2409
Copy link

alva2409 commented Feb 6, 2013

Your and my code work without errors, but NOT detect mobile or phone browsers :(

@curiousworx
Copy link

What functions specifically aren't working? It seems to detect mobile/phones for me but perhaps I am not understanding.

@alva2409
Copy link

alva2409 commented Feb 7, 2013

In my server with php4 isTablet & isMobile detection not work and not works all "Custom detection methods"
I check with my Samsung i9000 (Android 3)

@serbanghita
Copy link
Owner

@alva2409 go to http://is.gd/mobiletest with your phone. Send me feedback if it's not detected. From my tests everything works fine (on PHP5).

@alva2409
Copy link

alva2409 commented Feb 8, 2013

"on PHP5" - it's work FINE! I can't use PHP5 in my main server because my clients have special system. In secondary server with PHP5 your code work. In last topics we speak about changing code to PHP4. It's work without errors, but not detect any mobile or tablet devices.

@curiousworx
Copy link

@alva2409 Odd, those functions seem to work fine on the PHP4 server I am running with my PHP4 code. They are detecting my Note2 and various iPhones, iPads. I don't have access to any other Android devices so it is something I can't test :(

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