+ render('FrameworkBundle:Exception:traces', array('manager' => $manager, 'position' => 0, 'count' => count($managers))) ?>
+
+ $previous): ?>
+ render('FrameworkBundle:Exception:traces', array('manager' => $previous, 'position' => $i + 1, 'count' => count($managers))) ?>
+
+
+
- render('FrameworkBundle:Exception:traces', array('traces' => $manager->getTraces())) ?>
-
-
+
Content of the Output »
- getCurrentContent() ?>
+
diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Exception/exception.txt.php b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Exception/exception.txt.php
index 4d31f0aa97..9c4e22a689 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Exception/exception.txt.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Exception/exception.txt.php
@@ -1,14 +1,19 @@
-[exception] getStatusCode().' | '.$manager->getStatusText().' | '.$manager->getName() ?>
+[exception] getStatusCode().' | '.$manager->getStatusText().' | '.$manager->getName() ?>
-[message] getMessage() ?>
+[message] getMessage() ?>
getTraces())): ?>
-[stack trace]
-getTraces() as $i => $trace): ?>
-render('FrameworkBundle:Exception:trace.txt', array('i' => $i, 'trace' => $trace)) ?>
-
-
+render('FrameworkBundle:Exception:traces', array('manager' => $manager, 'position' => 0, 'count' => count($managers))) ?>
-[symfony] v. (symfony-project.org)
-[PHP] v.
+
+ $previous): ?>
+[linked exception] getName() ?>: getMessage() ?>
+
+render('FrameworkBundle:Exception:traces', array('manager' => $previous, 'position' => $i + 1, 'count' => count($managers))) ?>
+
+
+
+
+[symfony] v. (symfony-project.org)
+[PHP] v.
diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Exception/exception.xml.php b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Exception/exception.xml.php
index 620dc5e738..cec8cd3701 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Exception/exception.xml.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Exception/exception.xml.php
@@ -1,15 +1,13 @@
', $view->getCharset())."\n" ?>
-
- getName() ?>
- getMessage(), ENT_QUOTES, $view->getCharset()) ?>
-
-getTraces() as $i => $trace): ?>
-
- render('FrameworkBundle:Exception:trace.txt', array('i' => $i, 'trace' => $trace)) ?>
-
-
+
+ render('FrameworkBundle:Exception:traces', array('manager' => $manager, 'position' => 0, 'count' => count($managers))) ?>
+
+
+ $previous): ?>
+
+ render('FrameworkBundle:Exception:traces', array('manager' => $previous, 'position' => $i + 1, 'count' => count($managers))) ?>
+
-
-
+
diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Exception/styles.php b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Exception/styles.php
index 2afec7ee1b..90719625e0 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Exception/styles.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Exception/styles.php
@@ -1,25 +1,41 @@
-body { margin: 0; padding: 0; margin-top: 30px; background-color: #eee }
-body, td, th { font: 11px Verdana, Arial, sans-serif; color: #333 }
+/*
+Copyright (c) 2010, Yahoo! Inc. All rights reserved.
+Code licensed under the BSD License:
+http://developer.yahoo.com/yui/license.html
+version: 3.1.2
+build: 56
+*/
+html{color:#000;background:#FFF;}body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,code,form,fieldset,legend,input,textarea,p,blockquote,th,td{margin:0;padding:0;}table{border-collapse:collapse;border-spacing:0;}fieldset,img{border:0;}address,caption,cite,code,dfn,em,strong,th,var{font-style:normal;font-weight:normal;}li{list-style:none;}caption,th{text-align:left;}h1,h2,h3,h4,h5,h6{font-size:100%;font-weight:normal;}q:before,q:after{content:'';}abbr,acronym{border:0;font-variant:normal;}sup{vertical-align:text-top;}sub{vertical-align:text-bottom;}input,textarea,select{font-family:inherit;font-size:inherit;font-weight:inherit;}input,textarea,select{*font-size:100%;}legend{color:#000;}
+
+/*
+Symfony stylesheet
+*/
+html { background: #eee }
+body { font: 11px Verdana, Arial, sans-serif; color: #333 }
+strong { font-weight: bold }
+em { font-style: italic }
a { color: #333 }
-h1 { margin: 0; margin-top: 4px; font-weight: normal; font-size: 170%; letter-spacing: -0.03em; }
-h2 { margin: 0; padding: 0; font-size: 90%; font-weight: normal; letter-spacing: -0.02em; }
-h3 { margin: 0; padding: 0; margin-bottom: 10px; font-size: 110% }
-ul { padding-left: 20px; list-style: decimal }
-ul li { padding-bottom: 5px; margin: 0 }
-ol { font-family: monospace; white-space: pre; list-style-position: inside; margin: 0; padding: 10px 0 }
-ol li { margin: -5px; padding: 0 }
+abbr { border-bottom: 1px dotted #000000; cursor: help }
+h1 { font-size: 170%; letter-spacing: -0.03em; }
+h2 { margin-top: 4px; font-size: 90%; letter-spacing: -0.02em; }
+h3 { font-size: 130%; font-weight: bold; letter-spacing: -0.02em; }
+h3 span { float: right; font-size: 80%; background: #eee; color: #333; padding: 5px; -moz-border-radius: 5px; -webkit-border-radius: 5px; border-radius: 5px; }
+ul { padding-left: 20px }
+ul li { padding-bottom: 5px; list-style: decimal }
+ol { font-family: monospace; white-space: pre; padding: 10px 0 }
+ol li { margin: -5px; list-style: decimal; list-style-position: inside }
ol .selected { font-weight: bold; background-color: #ffd; padding: 2px 0 }
-table.vars { padding: 0; margin: 0; border: 1px solid #999; background-color: #fff; }
-table.vars th { padding: 2px; background-color: #ddd; font-weight: bold }
-table.vars td { padding: 2px; font-family: monospace; white-space: pre }
p.error { padding: 10px; background-color: #f00; font-weight: bold; text-align: center; -moz-border-radius: 10px; -webkit-border-radius: 10px; border-radius: 10px; }
p.error a { color: #fff }
-#main { padding: 20px 25px; margin: 0; margin-bottom: 20px; border: 1px solid #ddd; background-color: #fff; text-align:left; -moz-border-radius: 10px; -webkit-border-radius: 10px; border-radius: 10px; min-width: 770px; max-width: 770px }
-#message { padding: 20px 25px; margin: 0; margin-bottom: 5px; border: 1px solid #ddd; text-align:left; background-color: #c8e8f3; -moz-border-radius: 10px; -webkit-border-radius: 10px; border-radius: 10px; min-width: 770px; max-width: 770px }
+.block { padding: 20px 25px; margin-bottom: 10px; border: 1px solid #ddd; background-color: #fff; text-align:left; -moz-border-radius: 10px; -webkit-border-radius: 10px; border-radius: 10px; min-width: 770px; max-width: 770px }
+.traces { display: none; margin-top: 10px }
+#message { margin-top: 30px; margin-bottom: 10px; padding: 20px 25px; border: 1px solid #ddd; text-align:left; background-color: #c8e8f3; -moz-border-radius: 10px; -webkit-border-radius: 10px; border-radius: 10px; min-width: 770px; max-width: 770px }
#content { border: 1px solid #ddd; margin-top: 10px; padding: 7px; overflow: auto; }
a.file_link { text-decoration: none; }
a.file_link:hover { text-decoration: underline; }
.code { overflow: auto; }
img { vertical-align: middle; }
-a img { border: 0; }
-.error { background-color: #f66; padding: 1px 3px; color: #111; }
+.error { background-color: #f66 }
+.linked ul, .linked li { padding-left: 0; display: inline }
+.linked li { padding-right: 7px }
+#logs { margin-top: 10px }
diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Exception/trace.php b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Exception/trace.php
index 07a21959e6..931312bde4 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Exception/trace.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Exception/trace.php
@@ -1,10 +1,10 @@
- at
(formatArgs($trace['args']) ?>)
+ at
(formatArgs($trace['args']) ?>)
in
formatFile($trace['file'], $trace['line']) ?> line
-
...
-
+ »
+
fileExcerpt($trace['file'], $trace['line']) ?>
diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Exception/trace.txt.php b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Exception/trace.txt.php
index 0349e78858..6a047d0920 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Exception/trace.txt.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Exception/trace.txt.php
@@ -1,5 +1,5 @@
- at (formatArgs($trace['args']) ?>)
+ at (formatArgsAsText($trace['args']) ?>)
at n/a
diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Exception/traces.php b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Exception/traces.php
index 46239855a6..cab4ab155e 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Exception/traces.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Exception/traces.php
@@ -1,7 +1,20 @@
-
- $trace): ?>
- -
- render('FrameworkBundle:Exception:trace', array('i' => $i, 'trace' => $trace)) ?>
-
-
-
+
+ 0): ?>
+
+ /
+ getName() ?>: ', htmlspecialchars($manager->getMessage(), ENT_QUOTES, $view->getCharset())) ?>
+ »
+
+
+
Stack Trace
+
+
+
+
+ getTraces() as $i => $trace): ?>
+ -
+ render('FrameworkBundle:Exception:trace', array('prefix' => $position, 'i' => $i, 'trace' => $trace)) ?>
+
+
+
+
diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Exception/traces.txt.php b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Exception/traces.txt.php
new file mode 100644
index 0000000000..1469b5a494
--- /dev/null
+++ b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Exception/traces.txt.php
@@ -0,0 +1,6 @@
+getTraces())): ?>
+getTraces() as $i => $trace): ?>
+render('FrameworkBundle:Exception:trace.txt', array('i' => $i, 'trace' => $trace)) ?>
+
+
+
diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Exception/traces.xml.php b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Exception/traces.xml.php
new file mode 100644
index 0000000000..40c494cf96
--- /dev/null
+++ b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Exception/traces.xml.php
@@ -0,0 +1,8 @@
+
+getTraces() as $i => $trace): ?>
+
+ render('FrameworkBundle:Exception:trace.txt', array('i' => $i, 'trace' => $trace)) ?>
+
+
+
+
diff --git a/src/Symfony/Bundle/FrameworkBundle/Templating/Helper/CodeHelper.php b/src/Symfony/Bundle/FrameworkBundle/Templating/Helper/CodeHelper.php
index 2e8818d986..226a35c194 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Templating/Helper/CodeHelper.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Templating/Helper/CodeHelper.php
@@ -21,15 +21,51 @@ use Symfony\Component\Templating\Helper\Helper;
class CodeHelper extends Helper
{
protected $fileLinkFormat;
+ protected $rootDir;
/**
* Constructor.
*
* @param string $fileLinkFormat The format for links to source files
+ * @param string $rootDir The project root directory
*/
- public function __construct($fileLinkFormat)
+ public function __construct($fileLinkFormat, $rootDir)
{
$this->fileLinkFormat = null !== $fileLinkFormat ? $fileLinkFormat : ini_get('xdebug.file_link_format');
+ $this->rootDir = str_replace('\\', '/', $rootDir).'/';
+ }
+
+ /**
+ * Formats an array as a string.
+ *
+ * @param array $args The argument array
+ *
+ * @return string
+ */
+ public function formatArgsAsText($args)
+ {
+ $result = array();
+ foreach ($args as $key => $value) {
+ if (is_object($value)) {
+ $formattedValue = sprintf("object('%s')", get_class($value));
+ } elseif (is_array($value)) {
+ $formattedValue = sprintf("array(%s)", $this->formatArgs($value));
+ } elseif (is_string($value)) {
+ $formattedValue = sprintf("'%s'", $value);
+ } elseif (null === $value) {
+ $formattedValue = 'null';
+ } elseif (false === $value) {
+ $formattedValue = 'false';
+ } elseif (true === $value) {
+ $formattedValue = 'true';
+ } else {
+ $formattedValue = $value;
+ }
+
+ $result[] = is_int($key) ? $formattedValue : sprintf("'%s' => %s", $key, $formattedValue);
+ }
+
+ return implode(', ', $result);
}
/**
@@ -44,13 +80,20 @@ class CodeHelper extends Helper
$result = array();
foreach ($args as $key => $value) {
if (is_object($value)) {
- $formattedValue = sprintf("object('%s')", get_class($value));
+ $class = get_class($value);
+ $parts = explode('\\', $class);
+ $short = array_pop($parts);
+ $formattedValue = sprintf("object(%s)", $class, $short);
} elseif (is_array($value)) {
- $formattedValue = sprintf("array(%s)", $this->formatArgs($value));
+ $formattedValue = sprintf("array(%s)", $this->formatArgs($value));
} elseif (is_string($value)) {
$formattedValue = sprintf("'%s'", $value);
} elseif (null === $value) {
- $formattedValue = 'null';
+ $formattedValue = 'null';
+ } elseif (false === $value) {
+ $formattedValue = 'false';
+ } elseif (true === $value) {
+ $formattedValue = 'true';
} else {
$formattedValue = $value;
}
@@ -95,13 +138,18 @@ class CodeHelper extends Helper
*/
public function formatFile($file, $line)
{
+ if (0 === strpos($file, $this->rootDir)) {
+ $file = str_replace($this->rootDir, '', str_replace('\\', '/', $file));
+ $file = sprintf('kernel.root_dir/%s', $this->rootDir, $file);
+ }
+
if (!$this->fileLinkFormat) {
return $file;
}
$link = strtr($this->fileLinkFormat, array('%f' => $file, '%l' => $line));
- return sprintf('%s', $link, $file);
+ return sprintf('%s', $link, $this->rootDir, $file);
}
/**
diff --git a/src/Symfony/Component/CssSelector/Parser.php b/src/Symfony/Component/CssSelector/Parser.php
index 2cb1d31c98..89724004b1 100644
--- a/src/Symfony/Component/CssSelector/Parser.php
+++ b/src/Symfony/Component/CssSelector/Parser.php
@@ -75,7 +75,7 @@ class Parser
} catch (\Exception $e) {
$class = get_class($e);
- throw new $class(sprintf('%s at %s -> %s', $e->getMessage(), implode($stream->getUsed(), ''), $stream->peek()));
+ throw new $class(sprintf('%s at %s -> %s', $e->getMessage(), implode($stream->getUsed(), ''), $stream->peek()), 0, $e);
}
}
diff --git a/src/Symfony/Component/DependencyInjection/ContainerBuilder.php b/src/Symfony/Component/DependencyInjection/ContainerBuilder.php
index 9aac92414f..ffef2846b8 100644
--- a/src/Symfony/Component/DependencyInjection/ContainerBuilder.php
+++ b/src/Symfony/Component/DependencyInjection/ContainerBuilder.php
@@ -176,7 +176,7 @@ class ContainerBuilder extends Container implements TaggedContainerInterface
return parent::get($id, ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE);
} catch (\InvalidArgumentException $e) {
if (isset($this->loading[$id])) {
- throw new \LogicException(sprintf('The service "%s" has a circular reference to itself.', $id));
+ throw new \LogicException(sprintf('The service "%s" has a circular reference to itself.', $id), 0, $e);
}
if (!$this->hasDefinition($id) && isset($this->aliases[$id])) {
diff --git a/src/Symfony/Component/HttpFoundation/SessionStorage/PdoSessionStorage.php b/src/Symfony/Component/HttpFoundation/SessionStorage/PdoSessionStorage.php
index c009dfcf01..c2e9c63d79 100644
--- a/src/Symfony/Component/HttpFoundation/SessionStorage/PdoSessionStorage.php
+++ b/src/Symfony/Component/HttpFoundation/SessionStorage/PdoSessionStorage.php
@@ -108,7 +108,7 @@ class PdoSessionStorage extends NativeSessionStorage
$stmt->bindParam(1, $id, \PDO::PARAM_STR);
$stmt->execute();
} catch (\PDOException $e) {
- throw new \RuntimeException(sprintf('PDOException was thrown when trying to manipulate session data. Message: %s', $e->getMessage()));
+ throw new \RuntimeException(sprintf('PDOException was thrown when trying to manipulate session data: %s', $e->getMessage()), 0, $e);
}
return true;
@@ -135,7 +135,7 @@ class PdoSessionStorage extends NativeSessionStorage
try {
$this->db->query($sql);
} catch (\PDOException $e) {
- throw new \RuntimeException(sprintf('PDOException was thrown when trying to manipulate session data. Message: %s', $e->getMessage()));
+ throw new \RuntimeException(sprintf('PDOException was thrown when trying to manipulate session data: %s', $e->getMessage()), 0, $e);
}
return true;
@@ -184,7 +184,7 @@ class PdoSessionStorage extends NativeSessionStorage
return '';
}
} catch (\PDOException $e) {
- throw new \RuntimeException(sprintf('PDOException was thrown when trying to manipulate session data. Message: %s', $e->getMessage()));
+ throw new \RuntimeException(sprintf('PDOException was thrown when trying to manipulate session data: %s', $e->getMessage()), 0, $e);
}
}
@@ -214,7 +214,7 @@ class PdoSessionStorage extends NativeSessionStorage
$stmt->bindParam(2, $id, \PDO::PARAM_STR);
$stmt->execute();
} catch (\PDOException $e) {
- throw new \RuntimeException(sprintf('PDOException was thrown when trying to manipulate session data. Message: %s', $e->getMessage()));
+ throw new \RuntimeException(sprintf('PDOException was thrown when trying to manipulate session data: %s', $e->getMessage()), 0, $e);
}
return true;
diff --git a/src/Symfony/Component/Yaml/Yaml.php b/src/Symfony/Component/Yaml/Yaml.php
index 5ce6c87f99..0e3c4b151e 100644
--- a/src/Symfony/Component/Yaml/Yaml.php
+++ b/src/Symfony/Component/Yaml/Yaml.php
@@ -89,7 +89,7 @@ class Yaml
try {
$ret = $yaml->parse($input);
} catch (\Exception $e) {
- throw new \InvalidArgumentException(sprintf('Unable to parse %s: %s', $file ? sprintf('file "%s"', $file) : 'string', $e->getMessage()));
+ throw new \InvalidArgumentException(sprintf('Unable to parse %s: %s', $file ? sprintf('file "%s"', $file) : 'string', $e->getMessage()), 0, $e);
}
return $ret;