Skip to content

Commit ab37040

Browse files
author
Hugo Hamon
committed
[FrameworkBundle] fixes displaying of deprecation notices.
1 parent 24b780e commit ab37040

File tree

2 files changed

+21
-15
lines changed

2 files changed

+21
-15
lines changed

src/Symfony/Bundle/FrameworkBundle/Resources/config/debug_prod.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
<tag name="monolog.logger" channel="php" />
1717
<argument /><!-- Exception handler -->
1818
<argument type="service" id="logger" on-invalid="null" />
19-
<argument /><!-- Log levels map for enabled error levels -->
19+
<argument>null</argument><!-- Log levels map for enabled error levels -->
2020
<argument>null</argument>
2121
<argument>true</argument>
2222
<argument>null</argument><!-- %templating.helper.code.file_link_format% -->

src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/logger.html.twig

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -88,10 +88,13 @@
8888

8989
{% if collector.logs %}
9090
<ul class="alt">
91-
{% for log in collector.logs if priority >= 0 and log.priority >= priority or priority < 0 and log.context.type|default(0) == priority %}
92-
<li class="{{ cycle(['odd', 'even'], loop.index) }}{% if log.priority >= 400 %} error{% elseif log.priority >= 300 %} warning{% endif %}{% if log.context.scream is defined %} scream{% endif %}">
93-
{{ logger.display_message(loop.index, log) }}
94-
</li>
91+
{% for log in collector.logs %}
92+
{% set is_deprecation = log.context.level is defined and log.context.type is defined and (constant('E_DEPRECATED') == log.context.type or constant('E_USER_DEPRECATED') == log.context.type) %}
93+
{% if priority == '-100' ? is_deprecation : log.priority >= priority %}
94+
<li class="{{ cycle(['odd', 'even'], loop.index) }}{% if log.context.scream is defined %} scream{% elseif log.priority >= 400 %} error{% elseif log.priority >= 300 %} warning{% endif %}">
95+
{{ logger.display_message(loop.index, log, is_deprecation) }}
96+
</li>
97+
{% endif %}
9598
{% else %}
9699
<li><em>No logs available for this priority.</em></li>
97100
{% endfor %}
@@ -104,15 +107,18 @@
104107
{% endblock %}
105108

106109

107-
{% macro display_message(log_index, log) %}
108-
{% if log.context.level is defined and log.context.type is defined and (constant('E_DEPRECATED') == log.context.type or constant('E_USER_DEPRECATED') == log.context.type) %}
109-
DEPRECATION - {{ log.message }}
110-
{% set id = 'sf-call-stack-' ~ log_index %}
111-
<a href="#" onclick="Sfjs.toggle('{{ id }}', document.getElementById('{{ id }}-on'), document.getElementById('{{ id }}-off')); return false;">
112-
<img class="toggle" id="{{ id }}-off" alt="-" src="data:image/gif;base64,R0lGODlhEgASAMQSANft94TG57Hb8GS44ez1+mC24IvK6ePx+Wa44dXs92+942e54o3L6W2844/M6dnu+P/+/l614P///wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAEAABIALAAAAAASABIAQAVCoCQBTBOd6Kk4gJhGBCTPxysJb44K0qD/ER/wlxjmisZkMqBEBW5NHrMZmVKvv9hMVsO+hE0EoNAstEYGxG9heIhCADs=" style="display:none">
113-
<img class="toggle" id="{{ id }}-on" alt="+" src="data:image/gif;base64,R0lGODlhEgASAMQTANft99/v+Ga44bHb8ITG52S44dXs9+z1+uPx+YvK6WC24G+944/M6W28443L6dnu+Ge54v/+/l614P///wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAEAABMALAAAAAASABIAQAVS4DQBTiOd6LkwgJgeUSzHSDoNaZ4PU6FLgYBA5/vFID/DbylRGiNIZu74I0h1hNsVxbNuUV4d9SsZM2EzWe1qThVzwWFOAFCQFa1RQq6DJB4iIQA7" style="display:inline">
114-
</a>
115-
{% for index, call in log.context.stack if index > 1 %}
110+
{% macro display_message(log_index, log, is_deprecation) %}
111+
{% if is_deprecation %}
112+
{% set stack = log.context.stack|default([]) %}
113+
114+
{% if stack %}
115+
<a href="#" onclick="Sfjs.toggle('{{ id }}', document.getElementById('{{ id }}-on'), document.getElementById('{{ id }}-off')); return false;">
116+
<img class="toggle" id="{{ id }}-off" alt="-" src="data:image/gif;base64,R0lGODlhEgASAMQSANft94TG57Hb8GS44ez1+mC24IvK6ePx+Wa44dXs92+942e54o3L6W2844/M6dnu+P/+/l614P///wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAEAABIALAAAAAASABIAQAVCoCQBTBOd6Kk4gJhGBCTPxysJb44K0qD/ER/wlxjmisZkMqBEBW5NHrMZmVKvv9hMVsO+hE0EoNAstEYGxG9heIhCADs=" style="display:none">
117+
<img class="toggle" id="{{ id }}-on" alt="+" src="data:image/gif;base64,R0lGODlhEgASAMQTANft99/v+Ga44bHb8ITG52S44dXs9+z1+uPx+YvK6WC24G+944/M6W28443L6dnu+Ge54v/+/l614P///wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAEAABMALAAAAAASABIAQAVS4DQBTiOd6LkwgJgeUSzHSDoNaZ4PU6FLgYBA5/vFID/DbylRGiNIZu74I0h1hNsVxbNuUV4d9SsZM2EzWe1qThVzwWFOAFCQFa1RQq6DJB4iIQA7" style="display:inline">
118+
</a>
119+
{% endif %}
120+
121+
{% for index, call in stack if index > 1 %}
116122
{% if index == 2 %}
117123
<ul class="sf-call-stack" id="{{ id }}" style="display: none">
118124
{% endif %}
@@ -128,7 +134,7 @@
128134

129135
<li>Called from {{ call.file is defined and call.line is defined ? call.file|format_file(call.line, from) : from|raw }}</li>
130136

131-
{% if index == log.context.stack|length - 1 %}
137+
{% if index == stack|length - 1 %}
132138
</ul>
133139
{% endif %}
134140
{% endfor %}

0 commit comments

Comments
 (0)