On 12/25/12 5:26 AM, Austin Einter wrote:
Dear All
I compiled phc in ubuntu 10.04 lts.
Next I am trying to obfusace some php code (which is part of a drupal based code). I just tried obfuscating a single file using phc. It did  work.

But when I am trying to access my site, I get bunch of below errors.

Notice: Undefined variable: TSa200978216 in doc_search_my_form() (line 475 of /var/www/example.com/sites/all/modules/doc_search/doc_search.module).
Notice: Undefined variable: TSa1454652404 in doc_search_my_form() (line 482 of /var/www/example.com/sites/all/modules/doc_search/doc_search.module).


Mostly these are variable undefined errors. When the file is in normal mode (having normal php code), it does not throw any error. When the file is in obfuscated mode , when I access my site I get lots of variable undefined error. Any idea what's wrong here.

Thanks

I am going to assume that doc_search is the name of a custom module you are writing (since I don't find a project by that name with a quick search).

The likely problem is that the obfuscator doesn't understand the structure of Drupal, these undefined variables are probably globals coming from Drupal, so their names should NOT have been changed. The obfuscation is probably also breaking your hook functions as these functions must not have their name changed.

It is basically hard to run a standard obfuscator on Drupal code due to the way Drupal works with building functions names up for hooks and such. If you really want to obfuscate code with Drupal, you will need to find a "Drupal aware" obfuscator, which I am not sure exists.
-- 
Richard Damon