|   | php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login | 
| 
 PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits              [2016-10-12 21:29 UTC] cmb@php.net
 
-Status:      Open
+Status:      Verified
-Assigned To:
+Assigned To: dmitry
  [2016-10-12 21:29 UTC] cmb@php.net
  [2016-11-17 20:56 UTC] jmaguire at duo dot com
  [2016-11-18 20:37 UTC] nikic@php.net
 
-Summary: Not documented Backward incompatible change related
          to assert
+Summary: Scope not inherited by eval in assert()
-Type:    Documentation Problem
+Type:    Bug
  [2016-11-18 20:37 UTC] nikic@php.net
  [2016-11-18 20:42 UTC] nikic@php.net
  [2016-11-18 20:42 UTC] nikic@php.net
 
-Status: Verified
+Status: Closed
  [2016-11-22 13:14 UTC] krakjoe@php.net
 | |||||||||||||||||||||||||||
|  Copyright © 2001-2025 The PHP Group All rights reserved. | Last updated: Fri Oct 31 01:00:01 2025 UTC | 
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