✏️ 编辑:StreamTrait.php
路径:
/home/forge/kingkrunch.com/wp/wp-content/plugins/wp-defender/vendor/nyholm/psr7/src/StreamTrait.php
大小:1.5 KB · 修改:2025-10-22 00:15:46 · 权限:0644 · 可写
← 返回目录
👁 查看
⬇ 下载
<?php declare(strict_types=1); namespace Nyholm\Psr7; use Psr\Http\Message\StreamInterface; use Symfony\Component\Debug\ErrorHandler as SymfonyLegacyErrorHandler; use Symfony\Component\ErrorHandler\ErrorHandler as SymfonyErrorHandler; if (\PHP_VERSION_ID >= 70400 || (new \ReflectionMethod(StreamInterface::class, '__toString'))->hasReturnType()) { /** * @internal */ trait StreamTrait { public function __toString(): string { if ($this->isSeekable()) { $this->seek(0); } return $this->getContents(); } } } else { /** * @internal */ trait StreamTrait { /** * @return string */ public function __toString() { try { if ($this->isSeekable()) { $this->seek(0); } return $this->getContents(); } catch (\Throwable $e) { if (\is_array($errorHandler = \set_error_handler('var_dump'))) { $errorHandler = $errorHandler[0] ?? null; } \restore_error_handler(); if ($e instanceof \Error || $errorHandler instanceof SymfonyErrorHandler || $errorHandler instanceof SymfonyLegacyErrorHandler) { return \trigger_error((string) $e, \E_USER_ERROR); } return ''; } } } }
💾 保存
取消
保存为 UTF-8,换行统一为 LF