cvs: ZendEngine2 /tests ns_064.phpt objects_021.phpt

[email protected] ("Felipe Pena")
Newsgroups php.zend-engine.cvs
Message-ID <cvsfelipe1210169321@cvsserver>
felipe		Wed May  7 14:08:41 2008 UTC

  Added files:                 
    /ZendEngine2/tests	ns_064.phpt objects_021.phpt 
  Log:
  - New tests
  
  

http://cvs.php.net/viewvc.cgi/ZendEngine2/tests/ns_064.phpt?view=markup&rev=1.1
Index: ZendEngine2/tests/ns_064.phpt
+++ ZendEngine2/tests/ns_064.phpt
--TEST--
Magic methods in overrided stdClass inside namespace
--FILE--
<?php

namespace test;

class foo {
	public $e = array();
	
	public function __construct() {
		$this->e[] = $this;
	}
	
	public function __set($a, $b) {
		var_dump($a, $b);
	}
	public function __get($a) {
		var_dump($a);
		return $this;
	}
}

use test::foo as stdClass;

$x = new stdClass;
$x->a = 1;
$x->b->c = 1;
$x->d->e[0]->f = 2;

?>
--EXPECT--
string(1) "a"
int(1)
string(1) "b"
string(1) "c"
int(1)
string(1) "d"
string(1) "f"
int(2)
--UEXPECT--
unicode(1) "a"
int(1)
unicode(1) "b"
unicode(1) "c"
int(1)
unicode(1) "d"
unicode(1) "f"
int(2)

http://cvs.php.net/viewvc.cgi/ZendEngine2/tests/objects_021.phpt?view=markup&rev=1.1
Index: ZendEngine2/tests/objects_021.phpt
+++ ZendEngine2/tests/objects_021.phpt
--TEST--
Testing magic methods __set, __get and __call in cascade
--FILE--
<?php

class test {
	static public $i = 0;
	
	public function __construct() {
		self::$i++;
	}
	
	public function __set($a, $b) {
		return x();
	}
	
	public function __get($a) {
		return x();
	}
	
	public function __call($a, $b) {
		return x();
	}
}

function x() {
	return new test;
}

x()
	->a
		->b()
			->c	= 1;

var_dump(test::$i);

?>
--EXPECT--
int(4)
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.