#48468 [Fbk->Opn]: empty function confusing

From: Date: Thu, 04 Jun 2009 08:50:06 +0000
Subject: #48468 [Fbk->Opn]: empty function confusing
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-2341@lists.php.net to get a copy of this message
ID: 48468 User updated by: heikki dot leppanen at extendeddisc dot com Reported By: heikki dot leppanen at extendeddisc dot com -Status: Feedback +Status: Open Bug Type: Translation problem Operating System: windows -PHP Version: Irrelevant +PHP Version: 5.2.5 New Comment: OK, now the syntax is correct. This is only example from my code I wrote to demonstrate the confusing with empty() class A { var $vars = array('a'=>'aa', 'b'=>'bb'); function __get ($name) { return $this->vars[$name]; } } $x = new A(); if (empty($x->a)) echo "this is empty<br>"; else echo "this in not empty<br>"; Previous Comments: ------------------------------------------------------------------------ [2009-06-04 08:20:03] bjori@php.net That is incorrect too, where are you seeing this? ------------------------------------------------------------------------ [2009-06-04 08:08:33] heikki dot leppanen at extendeddisc dot com It should be like this: var $vars = array{'a'=>'aa', 'b'=>'bb'}; ------------------------------------------------------------------------ [2009-06-04 07:49:27] bjori@php.net > var $vars = {'a'=>'aa', 'b'=>'bb'}; Heh? What does this do and where did you find this snippet? ------------------------------------------------------------------------ [2009-06-04 06:44:50] heikki dot leppanen at extendeddisc dot com Description: ------------ class A { var $vars = {'a'=>'aa', 'b'=>'bb'}; function __get ($name) { return $this->vars[$name]; } } $x = new A(); if (empty($this->a)) echo "this is empty"); else echo "this in not empty"); For me it looks a bug! Any experience? Reproduce code: --------------- --- From manual page: function.empty --- Expected result: ---------------- This is not empty Actual result: -------------- RESULT: this is empty ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=48468&edit=1

« previous php.doc.bugs (#2341) next »