Bug #80766 [NEW]: assert() can be imported via use statement
From: smokey101stair at gmail dot com
Operating system: Ubuntu 20.04
PHP version: 7.3.27
Package: Unknown/Other Function
Bug Type: Bug
Bug description:assert() can be imported via use statement
Description:
------------
In PHP 7, assert became a language construct and cannot be redefined
as a user function. Typically language constructs can't be imported via
use statements, however, it seems that assert can be imported via a
use statement. I'm not sure if this is intentional or not for BC
purposes. PHP throws a ParseError when trying to import other language
constructs, such as isset, so I would expect importing assert to
throw as well.
Test script:
---------------
// Works, unexpectedly
namespace Foo {
use function assert;
}
// Doesn't work, as expected
namespace Foo {
use function isset;
}
--
Edit bug report at https://bugs.php.net/bug.php?id=80766&edit=1
--
Fix committed: https://bugs.php.net/fix.php?id=80766&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=80766&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=80766&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=80766&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=80766&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=80766&r=support
Expected behavior: https://bugs.php.net/fix.php?id=80766&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=80766&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=80766&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=80766&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=80766&r=phptooold
Daylight Savings: https://bugs.php.net/fix.php?id=80766&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=80766&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=80766&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=80766&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=80766&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=80766&r=mysqlcfg
Thread (1 message)
- smokey101stair at gmail dot com