Unverified Commit 3ac9df13 authored by alexpott's avatar alexpott

Issue #2002514 by dawehner, mondrake, damiankloip, RobLoach, ParisLiakos,...

Issue #2002514 by dawehner, mondrake, damiankloip, RobLoach, ParisLiakos, joachim, Krzysztof Domański, gaurav.kapoor, chx, alexpott, tim.plunkett, Mile23, daffie: Deprecate debug(); remove references to _drupal_debug_message()
parent 08350aec
......@@ -601,7 +601,7 @@ function _drupal_flush_css_js() {
* Outputs debug information.
*
* The debug information is passed on to trigger_error() after being converted
* to a string using _drupal_debug_message().
* to a string using print_r() or var_export().
*
* @param $data
* Data to be output.
......@@ -611,8 +611,14 @@ function _drupal_flush_css_js() {
* Flag to switch between print_r() and var_export() for data conversion to
* string. Set $print_r to FALSE to use var_export() instead of print_r().
* Passing recursive data structures to var_export() will generate an error.
*
* @deprecated in drupal:9.2.0 and is removed from drupal:10.0.0. Use dump()
* instead.
*
* @see https://www.drupal.org/node/3192283
*/
function debug($data, $label = NULL, $print_r = TRUE) {
@trigger_error('debug() is deprecated in drupal:9.2.0 and is removed from drupal:10.0.0. Use dump() instead. See https://www.drupal.org/node/3192283', E_USER_DEPRECATED);
// Print $data contents to string.
$string = Html::escape($print_r ? print_r($data, TRUE) : var_export($data, TRUE));
......
......@@ -217,7 +217,6 @@ function _drupal_log_error($error, $fatal = FALSE) {
// If error type is 'User notice' then treat it as debug information
// instead of an error message.
// @see debug()
if ($error['%type'] == 'User notice') {
$error['%type'] = 'Debug';
$class = 'status';
......
......@@ -86,7 +86,6 @@ public function onException(ExceptionEvent $event) {
if ($this->isErrorDisplayable($error)) {
// If error type is 'User notice' then treat it as debug information
// instead of an error message.
// @see debug()
if ($error['%type'] == 'User notice') {
$error['%type'] = 'Debug';
}
......
......@@ -670,18 +670,10 @@ protected function verifyRenderCache($cid, array $tags, $redirected_cid = NULL)
$is_redirecting_cache_item = isset($cache_entry->data['#cache_redirect']);
if ($redirected_cid === NULL) {
$this->assertFalse($is_redirecting_cache_item, 'Render cache entry is not a redirect.');
// If this is a redirecting cache item unlike we expected, log it.
if ($is_redirecting_cache_item) {
debug($cache_entry->data);
}
}
else {
// Verify that $cid contains a cache redirect.
$this->assertTrue($is_redirecting_cache_item, 'Render cache entry is a redirect.');
// If this is not a redirecting cache item unlike we expected, log it.
if (!$is_redirecting_cache_item) {
debug($cache_entry->data);
}
// Verify that the cache redirect points to the expected CID.
$redirect_cache_metadata = $cache_entry->data['#cache'];
$actual_redirection_cid = $this->createCacheId(
......
......@@ -1060,7 +1060,7 @@ function hook_views_plugins_exposed_form_alter(array &$plugins) {
*/
function hook_views_plugins_join_alter(array &$plugins) {
// Print out all join plugin names for debugging purposes.
debug($plugins);
dump($plugins);
}
/**
......@@ -1092,7 +1092,7 @@ function hook_views_plugins_pager_alter(array &$plugins) {
*/
function hook_views_plugins_query_alter(array &$plugins) {
// Print out all query plugin names for debugging purposes.
debug($plugins);
dump($plugins);
}
/**
......
......@@ -951,6 +951,17 @@ public function testDrupalGetHeader() {
$this->drupalGetHeader('Content-Type');
}
/**
* Tests legacy debug().
*
* @group legacy
*/
public function testDebug() {
$this->expectDeprecation('debug() is deprecated in drupal:9.2.0 and is removed from drupal:10.0.0. Use dump() instead. See https://www.drupal.org/node/3192283');
$this->expectError();
debug("There's a star man waiting in the sky");
}
/**
* Tests the dump() function provided by the var-dumper Symfony component.
*/
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment