Doc #73303 [Opn->Ver]: Not documented Backward incompatible change related to assert

From: Date: Wed, 12 Oct 2016 21:29:56 +0000
Subject: Doc #73303 [Opn->Ver]: Not documented Backward incompatible change related to assert
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-14013@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=73303&edit=1 ID: 73303 Updated by: cmb@php.net Reported by: ildar dot aim at gmail dot com Summary: Not documented Backward incompatible change related to assert -Status: Open +Status: Verified Type: Documentation Problem Package: *General Issues Operating System: Linux PHP Version: 7.1.0RC3 -Assigned To: +Assigned To: dmitry Block user comment: N Private report: N New Comment: It seems the behavior has changed as of commit 6499162f[1]. Is the reported behavior intentional, Dmitry? [1] <http://git.php.net/?p=php-src.git;a=commit;h=6499162ff0d8aa6e862d3e3cdd2288b87636b8a1> Previous Comments: ------------------------------------------------------------------------ [2016-10-12 15:16:51] ildar dot aim at gmail dot com Description: ------------ aim-server[~/tmp]$ /usr/bin/php --version PHP 7.0.11 (cli) (built: Sep 16 2016 18:52:44) ( NTS ) Copyright (c) 1997-2016 The PHP Group Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies with Xdebug v2.4.1, Copyright (c) 2002-2016, by Derick Rethans aim-server[~/tmp]$ /usr/bin/php test_class.php Success% aim-server[~/tmp]$ /opt/phpfarm/inst/php-7.1.0RC3/bin/php --version PHP 7.1.0RC3 (cli) (built: Oct 12 2016 16:13:20) ( NTS DEBUG ) Copyright (c) 1997-2016 The PHP Group Zend Engine v3.1.0-dev, Copyright (c) 1998-2016 Zend Technologies aim-server[~/tmp]$ /opt/phpfarm/inst/php-7.1.0RC3/bin/php test_class.php PHP Warning: assert(): Assertion "self::checkCacheKey(get_object_vars($this))" failed in /home/aim/tmp/test_class.php on line 7 Warning: assert(): Assertion "self::checkCacheKey(get_object_vars($this))" failed in /home/aim/tmp/test_class.php on line 7 PHP Fatal error: Uncaught Error: Cannot access self:: when no class scope is active in /home/aim/tmp/test_class.php(7) : assert code:1 Stack trace: #0 [internal function]: unknown() #1 /home/aim/tmp/test_class.php(7): assert('self::checkCach...') #2 /home/aim/tmp/test_class.php(17): Test->main() #3 {main} thrown in /home/aim/tmp/test_class.php(7) : assert code on line 1 Fatal error: Uncaught Error: Cannot access self:: when no class scope is active in /home/aim/tmp/test_class.php(7) : assert code:1 Stack trace: #0 [internal function]: unknown() #1 /home/aim/tmp/test_class.php(7): assert('self::checkCach...') #2 /home/aim/tmp/test_class.php(17): Test->main() #3 {main} thrown in /home/aim/tmp/test_class.php(7) : assert code on line 1 aim-server[~/tmp]$ http://i.imgur.com/aG7kYps.png I cannot find a description of this behavior in http://php.net/manual/en/migration71.incompatible.php Test script: --------------- aim-server[~/tmp]$ cat test_class.php <?php class Test { public $prop; public function main(){ assert('self::checkCacheKey(get_object_vars($this))'); echo 'Success'; } private static function checkCacheKey($obj_properties){ return count($obj_properties) == 1; } } $obj = new Test(); $obj->main(); Expected result: ---------------- Success output or description in http://php.net/manual/en/migration71.incompatible.php Actual result: -------------- Fatal error: Uncaught Error: Cannot access self:: when no class scope is active in /home/aim/tmp/test_class.php(7) : assert code:1 ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=73303&edit=1

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