Browse Source

Fixing non-unique id's being generated for Debugger rendered errors.

mark_story 15 years ago
parent
commit
bd30510e87
2 changed files with 4 additions and 4 deletions
  1. 1 1
      lib/Cake/Utility/Debugger.php
  2. 3 3
      lib/Cake/tests/Case/Utility/DebuggerTest.php

+ 1 - 1
lib/Cake/Utility/Debugger.php

@@ -607,7 +607,7 @@ class Debugger {
 			$this->_outputFormat = 'js';
 		}
 
-		$data['id'] = 'cakeErr' . count($this->errors);
+		$data['id'] = 'cakeErr' . uniqid();
 		$tpl = array_merge($this->_templates['base'], $this->_templates[$this->_outputFormat]);
 		$insert = array('context' => join("\n", $context), 'helpPath' => $this->helpPath) + $data;
 

+ 3 - 3
lib/Cake/tests/Case/Utility/DebuggerTest.php

@@ -145,9 +145,9 @@ class DebuggerTest extends CakeTestCase {
 			'pre' => array('class' => 'cake-debug'),
 			'a' => array(
 				'href' => "javascript:void(0);",
-				'onclick' => "document.getElementById('cakeErr9-trace').style.display = " .
-				             "(document.getElementById('cakeErr9-trace').style.display == 'none'" .
-				             " ? '' : 'none');"
+				'onclick' => "preg:/document\.getElementById\('cakeErr[a-z0-9]+\-trace'\)\.style\.display = " .
+				             "\(document\.getElementById\('cakeErr[a-z0-9]+\-trace'\)\.style\.display == 'none'" .
+				             " \? '' \: 'none'\);/"
 			),
 			'b' => array(), 'Notice', '/b', ' (8)',
 		));