mirror of
https://github.com/codeigniter4/CodeIgniter4.git
synced 2025-02-20 11:44:28 +08:00
Add check for closure functions in exception before getting paramters
This commit is contained in:
parent
766996696d
commit
265ee9bfd1
@ -86,12 +86,15 @@
|
||||
<div class="args" id="<?= $args_id ?>">
|
||||
<table cellspacing="0">
|
||||
|
||||
<?php foreach ($row['args'] as $key => $value) : ?>
|
||||
<?php
|
||||
$mirror = isset($row['class']) ? new \ReflectionMethod($row['class'], $row['function']) :
|
||||
new \ReflectionFunction($row['function']);
|
||||
$params = $mirror->getParameters();
|
||||
?>
|
||||
<?php
|
||||
$params = null;
|
||||
// Reflection by name is not available for closure function
|
||||
if( substr( $row['function'], -1 ) !== '}' )
|
||||
{
|
||||
$mirror = isset( $row['class'] ) ? new \ReflectionMethod( $row['class'], $row['function'] ) : new \ReflectionFunction( $row['function'] );
|
||||
$params = $mirror->getParameters();
|
||||
}
|
||||
foreach ($row['args'] as $key => $value) : ?>
|
||||
<tr>
|
||||
<td><code><?= htmlspecialchars(isset($params[$key]) ? '$'.$params[$key]->name : "#$key", ENT_SUBSTITUTE, 'UTF-8') ?></code></td>
|
||||
<td><pre><?= print_r($value, true) ?></pre></td>
|
||||
|
Loading…
x
Reference in New Issue
Block a user