summaryrefslogtreecommitdiff
path: root/Examples/test-suite/php/director_pass_by_value_runme.php
blob: d3763292f537a657ae84123608a0563d2e7f0769 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<?php

require "tests.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();