PHP 7.3 Drupal 中弃用的命名空间断言
PHP 7.3 Deprecated Namespace Assert in Drupal
英语不是我的第一语言,请耐心等待。
Namespaced assert()
Declaring a function called assert() inside a namespace is deprecated.
The assert() function is subject to special handling by the engine,
which may lead to inconsistent behavior when defining a namespaced
function with the same name.
我正在研究 Drupal 7.72,我正在检查迁移到 PHP 7.3 的过程,当涉及到已弃用的功能时,我发现 Drupal 核心在几个方面使用了 assert()
功能文件夹 \misc\typo3\
中的文件。 我已确定为潜在风险的风险如下:
- docroot\misc\typo3\drupal-security\PharExtensionInterceptor.php
- docroot\misc\typo3\phar-stream-wrapper\src\Interceptor\ConjunctionInterceptor.php
- docroot\misc\typo3\phar-stream-wrapper\src\Interceptor\PharExtensionInterceptor.php
- docroot\misc\typo3\phar-stream-wrapper\src\Interceptor\PharMetaDataInterceptor.php
- docroot\misc\typo3\phar-stream-wrapper\src\PharStreamWrapper.php
- docroot\misc\typo3\phar-stream-wrapper\src\Assertable.php
- docroot\misc\typo3\phar-stream-wrapper\src\Behavior.php
- docroot\misc\typo3\phar-stream-wrapper\src\Manager.php
我真的很困惑 Drupal 如何声明断言函数,即使它们已被弃用,也许我误读了文档?有一些方法可以测试这些文件,以确保一切都能在 PHP 7.3?
上正常工作
这些文件应该不会对已弃用的命名空间 assert()
.
造成任何问题
该弃用是指命名空间 assert()
函数,但您在这些文件中拥有的是 class 方法。
如果我的解释不清楚,这里有一个基本的区别示例:
命名空间断言函数(已弃用)
<?php
namespace Foo;
function assert() {}
这将导致:
Deprecated: Defining a custom assert() function is deprecated, as the function has special semantics
Class 方法(未弃用)
<?php
namespace Foo;
class Something
{
public function assert() {}
}
没问题,因为 assert 函数包含在 class.
中
英语不是我的第一语言,请耐心等待。
Namespaced assert()
Declaring a function called assert() inside a namespace is deprecated. The assert() function is subject to special handling by the engine, which may lead to inconsistent behavior when defining a namespaced function with the same name.
我正在研究 Drupal 7.72,我正在检查迁移到 PHP 7.3 的过程,当涉及到已弃用的功能时,我发现 Drupal 核心在几个方面使用了 assert()
功能文件夹 \misc\typo3\
中的文件。 我已确定为潜在风险的风险如下:
- docroot\misc\typo3\drupal-security\PharExtensionInterceptor.php
- docroot\misc\typo3\phar-stream-wrapper\src\Interceptor\ConjunctionInterceptor.php
- docroot\misc\typo3\phar-stream-wrapper\src\Interceptor\PharExtensionInterceptor.php
- docroot\misc\typo3\phar-stream-wrapper\src\Interceptor\PharMetaDataInterceptor.php
- docroot\misc\typo3\phar-stream-wrapper\src\PharStreamWrapper.php
- docroot\misc\typo3\phar-stream-wrapper\src\Assertable.php
- docroot\misc\typo3\phar-stream-wrapper\src\Behavior.php
- docroot\misc\typo3\phar-stream-wrapper\src\Manager.php
我真的很困惑 Drupal 如何声明断言函数,即使它们已被弃用,也许我误读了文档?有一些方法可以测试这些文件,以确保一切都能在 PHP 7.3?
上正常工作这些文件应该不会对已弃用的命名空间 assert()
.
该弃用是指命名空间 assert()
函数,但您在这些文件中拥有的是 class 方法。
如果我的解释不清楚,这里有一个基本的区别示例:
命名空间断言函数(已弃用)
<?php
namespace Foo;
function assert() {}
这将导致:
Deprecated: Defining a custom assert() function is deprecated, as the function has special semantics
Class 方法(未弃用)
<?php
namespace Foo;
class Something
{
public function assert() {}
}
没问题,因为 assert 函数包含在 class.
中