Sophie

Sophie

distrib > Mandriva > current > x86_64 > by-pkgid > a0e14bae8f3654971c3130c606d9abbc > files > 7

php-funcall-0.2.5-11mdv2010.1.x86_64.rpm

--TEST--
Checking functions
--SKIPIF--
<?php if (!extension_loaded("funcall")) print "skip"; ?>
--FILE--
<?php
function m1() {
    return 0;
}
function m2($a,$b,$c) {
    return 2;
}
class testc2 {
    public function testf() {
        echo 'testf';
    }
}
function pre_cb($args) {
    if (count($args)==0) {
        echo 'zero';
    } else if (count($args)==1) {
        echo 'trim';
    } else {
        $args[2]->testf();
    }
}
function post_cb($args,$result,$t) {
    if (count($args)==0) {
        echo 'zero';
    } else if (count($args)==1) {
        echo 'trim';
    } else {
        $args[2]->testf();
    }
    echo $result;
}
fc_add_pre('m1','pre_cb');
fc_add_pre('m2','pre_cb');
fc_add_post('m1','post_cb');
fc_add_post('m2','post_cb');

fc_add_post('trim','pre_cb');
fc_add_post('trim','post_cb');

$t2=new testc2;

m1();
m2('abc',true,$t2);
trim(' ok ');
?>
--EXPECT--
zerozero0testftestf2trimtrimok