Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Strange variable/method/class names - PHP

Tags:

php

I've a php file that I can't read it because all variables/functions have strange names! A block of function of my file is:

public static function    …………  …… …  ($   ………  …  ……  , $   …… ………  ……  )
{
    $   …… ……   ……   = strpos(   …………… … ……  ::   ……… ……… …   ($   ………  …  ……  ) , $   …… ………  ……  );

    return (false !== $   …… ……   ……  ) ? (int)floor($   …… ……   ……   / 4) : false;
}

As I know php standards don't allow to use dots and spaces in varaible name.

I myself just came with if there is something related to character encoding! as I found, file encoding is windows-1252.

Can these dots and spaces be converted to something readable?

Also because they are variables/functions, they have more than one occurrence in file.

Edited #1

I open file like always with Notepad++/Sublime Text under Widnows OS and It's not paid or something.

Edited #2

Script works without problem!

Edited #3

Link to file: https://www.dropbox.com/s/hoegvk0vz53cnyn/include.php

like image 718
revo Avatar asked Jul 19 '13 12:07

revo


2 Answers

It appears your "spaces" and "dots" are not what they look like. In the code you posted in your question, these are in fact "non-breaking-spaces" (c2 a0) and "ellipsis" (e2 80 a6). These are perfectly valid characters in an identifier.

(thank you StackOverflow for being 100% UTF-8 compatible).

[edit]

... but having looked at the file you linked, the file encoding is rather Windows-1252 (aka. CP1252). The answer is still correct, but the corresponding binary values differ a bit from the ones I mentionned above.

like image 118
RandomSeed Avatar answered Nov 05 '22 19:11

RandomSeed


Here's it converted to something slightly more readable.

public static function    …………  …… …  ( $a , $b )
{
    $c = strpos( some_class::some_function($a), $b );
    return (false !== $c) ? (int)floor($c / 4) : false;
}

Without seeing the other function it references or the error message it gives it would be hard to see why it failed.

This code has been deliberately obfuscate for a reason though. Maybe to stop people fiddling or maybe because it's licensed. If it doesn't work maybe you should try contacting the author.

like image 28
AeroX Avatar answered Nov 05 '22 19:11

AeroX