Bug #75950 [Opn]: when zend.assertions=-1, and assert(sleep(5)); assertions is NOT zero-cost.

[email protected] ("xmlscript at gmail dot com") Sun, 11 Feb 2018 08:43:34 GMT
Newsgroups php.standards
Message-ID <[email protected]>
Edit report at https://bugs.php.net/bug.php?id=75950&edit=1

 ID:                 75950
 User updated by:    xmlscript at gmail dot com
 Reported by:        xmlscript at gmail dot com
 Summary:            when zend.assertions=-1, and assert(sleep(5));
                     assertions is NOT zero-cost.
 Status:             Open
 Type:               Bug
 Package:            PHP Language Specification
 Operating System:   Fedora 27
 PHP Version:        7.2.2
 Block user comment: N
 Private report:     N

 New Comment:

<?php
  /**
    * php-fpm 7.2.2
    * zend.assertions = -1
    */

  var_dump( ini_get('zend.assertions') ); // return -1

  assert_options(ASSERT_ACTIVE, false);

  assert( 'sleep(5)' ); //with string,  assertion code will not be generated, and throwed an "Deprecated: assert(): Calling assert() with a string argument is deprecated in ..."

  assert( sleep(5) ); //really waited for 5 seconds, is NOT assertions zero-cost.  :(
?>


Previous Comments:
------------------------------------------------------------------------
[2018-02-11 08:37:45] xmlscript at gmail dot com

Description:
------------
<?php
  /**
    * php-fpm 7.2.2
    * zend.assertions = -1
    */

  var_dump( ini_get('zend.assertions') ); // return -1

  assert_options(ASSERT_ACTIVE, true);

  assert( 'sleep(5)' ); //with string,  assertion code will not be generated, and throwed an "Deprecated: assert(): Calling assert() with a string argument is deprecated in ..."

  assert( sleep(5) ); //really waited for 5 seconds, is NOT assertions zero-cost.  :(
?>



------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=75950&edit=1