swig/Examples/test-suite/php/director_pass_by_value_runme.php
Olly Betts e54d44c4be php: Omit closing ?> in manual and examples
PSR-12 says "The closing ?> tag MUST be omitted from files containing
only PHP".
2021-03-23 11:47:19 +13:00

23 lines
566 B
PHP

<?php
require "tests.php";
require "director_pass_by_value.php";
$passByVal = null;
class director_pass_by_value_Derived extends DirectorPassByValueAbstractBase {
function virtualMethod($b) {
global $passByVal;
$passByVal = $b;
}
}
# bug was the passByVal global object was destroyed after the call to virtualMethod had finished.
$caller = new Caller();
$caller->call_virtualMethod(new director_pass_by_value_Derived());
$ret = $passByVal->getVal();
if ($ret != 0x12345678) {
check::fail("Bad return value, got " . dechex($ret));
}
check::done();