Bug #75752 [NEW]: function assert callback The namespace is not avail
| From: | 742592958 at qq dot com | Date: | Tue, 02 Jan 2018 14:22:56 +0000 |
| Subject: | Bug #75752 [NEW]: function assert callback The namespace is not avail | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-213355@lists.php.net to get a copy of this message | ||
From: 742592958 at qq dot com
Operating system: win7
PHP version: 5.6.32
Package: *General Issues
Bug Type: Bug
Bug description:function assert callback The namespace is not avail
Description:
------------
PHP Options/Info
Namespace coordination assertion cannot use the callback function
Test script:
---------------
namespace GD\Tool;
class Config
{
public static function init($callback = null)
{
assert_options(ASSERT_ACTIVE, 1);
assert_options(ASSERT_WARNING, 0);
assert_options(ASSERT_BAIL, 1);
if($callback !== null){
assert_options(ASSERT_CALLBACK, $callback);
}
}
public static function assert($assertion,$info = ''){
if((int)PHP_VERSION >= 7 ){
is_object($info) ? : die('not an object');
}else{
is_string($info) ? : die('not an string');
}
return assert($assertion,$info);
}
}
Config::init('test');
function test($file, $line, $code){
die("file:{$file} \n line:{$line} \n code{$code}");
}
Config::assert('1==2');
echo 'success';
--
Edit bug report at https://bugs.php.net/bug.php?id=75752&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=75752&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=75752&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=75752&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=75752&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=75752&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=75752&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=75752&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=75752&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=75752&r=support
Expected behavior: https://bugs.php.net/fix.php?id=75752&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=75752&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=75752&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=75752&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=75752&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=75752&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=75752&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=75752&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=75752&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=75752&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=75752&r=mysqlcfg