THRIFT-1822 PHP unit test does not work
Patch: Roger Meier
diff --git a/lib/php/test/Test/Thrift/Protocol/TestTJSONProtocol.php b/lib/php/test/Test/Thrift/Protocol/TestTJSONProtocol.php
old mode 100644
new mode 100755
index 06c6ab2..d5aa69c
--- a/lib/php/test/Test/Thrift/Protocol/TestTJSONProtocol.php
+++ b/lib/php/test/Test/Thrift/Protocol/TestTJSONProtocol.php
@@ -535,11 +535,18 @@
 
     self::$testArgsJSON['testI32'] = '{"1":{"i32":1073741824}}';
 
-    self::$testArgsJSON['testI64'] = '{"1":{"i64":1152921504606847000}}';
-
-    self::$testArgsJSON['testStruct'] = '{"1":{"rec":{"1":{"str":"worked"},"4":{"i8":1},"9":{"i32":1073741824},"11":{"i64":1152921504606847000}}}}';
-
-    self::$testArgsJSON['testNest'] = '{"1":{"rec":{"1":{"i8":1},"2":{"rec":{"1":{"str":"worked"},"4":{"i8":1},"9":{"i32":1073741824},"11":{"i64":1152921504606847000}}},"3":{"i32":32768}}}}';
+    if ( PHP_INT_SIZE == 8 )
+    {
+      self::$testArgsJSON['testI64'] = '{"1":{"i64":'.pow( 2, 60 ).'}}';
+      self::$testArgsJSON['testStruct'] = '{"1":{"rec":{"1":{"str":"worked"},"4":{"i8":1},"9":{"i32":1073741824},"11":{"i64":'.pow( 2, 60 ).'}}}}';
+      self::$testArgsJSON['testNest'] = '{"1":{"rec":{"1":{"i8":1},"2":{"rec":{"1":{"str":"worked"},"4":{"i8":1},"9":{"i32":1073741824},"11":{"i64":'.pow( 2, 60 ).'}}},"3":{"i32":32768}}}}';
+    }
+    else
+    {
+      self::$testArgsJSON['testI64'] = '{"1":{"i64":1152921504606847000}}';
+      self::$testArgsJSON['testStruct'] = '{"1":{"rec":{"1":{"str":"worked"},"4":{"i8":1},"9":{"i32":1073741824},"11":{"i64":1152921504606847000}}}}';
+      self::$testArgsJSON['testNest'] = '{"1":{"rec":{"1":{"i8":1},"2":{"rec":{"1":{"str":"worked"},"4":{"i8":1},"9":{"i32":1073741824},"11":{"i64":1152921504606847000}}},"3":{"i32":32768}}}}';
+    }
 
     self::$testArgsJSON['testMap'] = '{"1":{"map":["i32","i32",3,{"7":77,"8":88,"9":99}]}}';
 
diff --git a/test/php/TestClient.php b/test/php/TestClient.php
index 4df498c..c334aee 100755
--- a/test/php/TestClient.php
+++ b/test/php/TestClient.php
@@ -257,23 +257,23 @@
  * ENUM TEST
  */
 print_r("testEnum(ONE)");
-$ret = $testClient->testEnum(ThriftTest_Numberz::ONE);
+$ret = $testClient->testEnum(\ThriftTest\Numberz::ONE);
 print_r(" = $ret\n");
 
 print_r("testEnum(TWO)");
-$ret = $testClient->testEnum(ThriftTest_Numberz::TWO);
+$ret = $testClient->testEnum(\ThriftTest\Numberz::TWO);
 print_r(" = $ret\n");
 
 print_r("testEnum(THREE)");
-$ret = $testClient->testEnum(ThriftTest_Numberz::THREE);
+$ret = $testClient->testEnum(\ThriftTest\Numberz::THREE);
 print_r(" = $ret\n");
 
 print_r("testEnum(FIVE)");
-$ret = $testClient->testEnum(ThriftTest_Numberz::FIVE);
+$ret = $testClient->testEnum(\ThriftTest\Numberz::FIVE);
 print_r(" = $ret\n");
 
 print_r("testEnum(EIGHT)");
-$ret = $testClient->testEnum(ThriftTest_Numberz::EIGHT);
+$ret = $testClient->testEnum(\ThriftTest\Numberz::EIGHT);
 print_r(" = $ret\n");
 
 /**
@@ -302,7 +302,7 @@
  * INSANITY TEST
  */
 $insane = new \ThriftTest\Insanity();
-$insane->userMap[ThriftTest_Numberz::FIVE] = 5000;
+$insane->userMap[\ThriftTest\Numberz::FIVE] = 5000;
 $truck = new \ThriftTest\Xtruct();
 $truck->string_thing = "Truck";
 $truck->byte_thing = 8;
@@ -348,7 +348,7 @@
 try {
   $testClient->testException('Xception');
   print_r("  void\nFAILURE\n");
-} catch (ThriftTest_Xception $x) {
+} catch (\ThriftTest\Xception $x) {
   print_r(' caught xception '.$x->errorCode.': '.$x->message."\n");
 }