From: [EMAIL PROTECTED] Operating system: Linux 2.4.4/glibc 2.2.2 PHP version: 4.0CVS-2001-10-17 PHP Bug Type: Scripting Engine problem Bug description: assert does not work as documented
According to the manual, assert() accepts string or boolean. However, it seems assert() does handle string type well, especially if it's a class property. (Parse error) Either PHP or the manual page is wrong. Following code does not work well. == code #1 == <?php class A { var $name = 'class A'; function print_name() { assert($this->name); print $this->name; } } $obj1 = new A; $obj1->print_name(); ?>== result #1 == Parse error: parse error in /home/yohgaki/public_html/test/bug/obj_property/test.php(7) : assert code on line 1 Fatal error: Failure evaluating code: class A in /home/yohgaki/public_html/test/bug/obj_property/test.php on line 7 == code #2 == <?php $str1 = ''; $str2 = 'abc'; assert($str1); assert($str2); ?> == result #2 ==Warning: Assertion "" failed in /home/yohgaki/public_html/test/bug/obj_property/test2.php on line 5 Warning: Use of undefined constant abc - assumed 'abc' in /home/yohgaki/public_html/test/bug/obj_property/test2.php(6) : assert code on line 1 == code #3 == <?php $arr = array('abc'); assert($arr['abc']); ?> == result #3 == Warning: Undefined index: abc in /home/yohgaki/public_html/test/bug/obj_property/test3.php on line 4 Warning: Assertion failed in /home/yohgaki/public_html/test/bug/obj_property/test3.php on line 4 -- Edit bug report at: http://bugs.php.net/?id=13724&edit=1 -- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]