Pārlūkot izejas kodu

fixed: fixed the bug of request_panel.php in WebProfiler

When the session attributes don't exist, $data->sessionAttributes->getRawValue() cannot be called as not being defined.
So check the session attributes before calling getRawValue()
Masao Maeda 14 gadi atpakaļ
vecāks
revīzija
ade5fd6574

+ 18 - 16
src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/request_panel.php

@@ -42,20 +42,22 @@
         <th>Value</th>
     </tr>
 
-    <?php foreach ($data->getSessionAttributes()->getRawValue() as $key => $value): ?>
-        <tr>
-            <th><?php echo $key ?></th>
-            <td>
-                <?php if (is_object($value)): ?>
-                    <em>Object</em>
-                <?php elseif (is_resource($value)): ?>
-                    <em>Resource</em>
-                <?php elseif (is_array($value)): ?>
-                    <em>Array</em>
-                <?php else: ?>
-                    <?php echo $value ?>
-                <?php endif; ?>
-            </td>
-        </tr>
-    <?php endforeach; ?>
+    <?php if (count($sessionAttributes = $data->getSessionAttributes())):?>
+        <?php foreach ($sessionAttributes->getRawValue() as $key => $value): ?>
+            <tr>
+                <th><?php echo $key ?></th>
+                <td>
+                    <?php if (is_object($value)): ?>
+                        <em>Object</em>
+                    <?php elseif (is_resource($value)): ?>
+                        <em>Resource</em>
+                    <?php elseif (is_array($value)): ?>
+                        <em>Array</em>
+                    <?php else: ?>
+                        <?php echo $value ?>
+                    <?php endif; ?>
+                </td>
+            </tr>
+        <?php endforeach; ?>
+    <?php endif; ?>
 </table>