php-src/tests/lang/bug22367.phpt

71 lines
1.0 KiB
Plaintext
Raw Normal View History

2003-02-24 19:37:27 +00:00
--TEST--
Bug #22367 (weird zval allocation problem)
--FILE--
<?php
class foo
{
var $test = array(0, 1, 2, 3, 4);
function a($arg) {
var_dump(array_key_exists($arg, $this->test));
return $this->test[$arg];
}
function b() {
@$this->c();
$zero = $this->test[0];
$one = $this->test[1];
$two = $this->test[2];
$three = $this->test[3];
$four = $this->test[4];
return array($zero, $one, $two, $three, $four);
}
function c() {
return $this->a($this->d());
}
function d() {}
}
class bar extends foo
{
var $i = 0;
var $idx;
function bar($idx) {
$this->idx = $idx;
}
function &a($arg){
return parent::a($arg);
}
function d(){
return $this->idx;
}
}
$a = new bar(5);
var_dump($a->idx);
2003-07-02 15:08:11 +00:00
$a->c();
2003-02-24 19:37:27 +00:00
$b = $a->b();
var_dump($b);
var_dump($a->test);
$a = new bar(2);
var_dump($a->idx);
@$a->c();
$b = $a->b();
var_dump($b);
var_dump($a->test);
?>
2003-07-02 15:08:11 +00:00
--EXPECTF--
2003-02-24 19:37:27 +00:00
int(5)
bool(false)
2003-07-02 15:08:11 +00:00
Notice: Undefined offset: %d in %s on line %d
Fatal error: Only variables or references can be returned by reference in %s on line %d