Q:

Execute javascript in selenium using php-webdriver-bindings-0.9.0

I'm trying to execute JavaScript in my selenium test suite but it's not working and I get no error feedback. It gracefully accepts whatever I enter as parameters to the execute function and passes the test. The following are combinations I have tried:
class TestingStuff extends PHPUnit_Framework_TestCase {

protected function setUp() {
    $this->webdriver = new WebDriver("localhost", 4444);
    $this->webdriver->connect("firefox");
}

protected function tearDown() {
    $this->webdriver->close();
}

public function testSomething() {
    $this->webdriver->get('http://localhost/testdir/');
    // Here is the execute function
    $this->webdriver->execute('alert', 'Hello');

$this->webdriver->get('http://127.0.0.1/testdir/');
// Here is the execute function
$this->webdriver->execute('alert("Hello")', '');

$this->webdriver->get('http://127.0.0.1/testdir/');
// Here is the execute function
$this->webdriver->execute('javascript:alert("Hello")', '');

$this->webdriver->get('http://localhost/testdir/');
// Here is the execute function
$this->webdriver->execute('alert()', 'Hello');
}

}

This is the function from The "WebDriver" class:
/**
Inject a snippet of JavaScript into the page for execution in the context of the currently   selected frame.
* The executed script is assumed to be synchronous and the result of evaluating the script
* is returned to the client.
* @return Object result of evaluating the script is returned to the client.
*/
public function execute($script, $script_args) {
    $request = $this->requestURL . "/execute";
    $session = $this->curlInit($request);
    $args = array('script' => $script, 'args' => $script_args);
    $jsonData = json_encode($args);
    $this->preparePOST($session, $jsonData);
    $response = curl_exec($session);
    return $this->extractValueFromJsonResponse($response);
}

A:

Have a look at 
https://github.com/scopium/Work/blob/master/php-webdriver-bindings-0.9.0/test/PHPWebdriverTest.php
public function testExecute() {
    $this->webdriver->get(TEST_URL);
    $result = $this->webdriver->executeScript("return sayHello('unitTest')", array());
    $this->assertEquals("hello unitTest !!!", $result);
}

Is this what you are trying to achieve?
I'm using phpunit-selenium and had a similar issue:
class MyTestClass extends PHPUnit_Extensions_Selenium2TestCase
{
   protected function setUp()
   {
     $this->setBrowser('firefox');
     $this->setBrowserUrl('http://yourdomain.tld');
   }

   public function testScript()
   {
     $this->url('./');
     $this->execute(array('script' => "alert('Hello');", 'args' => array()));
     sleep(3); // Just to see the alert() 
   }
}

(Orig. from https://github.com/sebastianbergmann/phpunit-selenium/issues/160)

