Changeset 12138
- Timestamp:
- 10/11/08 07:38:49 (5 years ago)
- Files:
-
- branches/1.2/UPGRADE_TO_1_2 (modified) (4 diffs)
- branches/1.2/lib/autoload/sfCoreAutoload.class.php (modified) (1 diff)
- branches/1.2/lib/exception/data/error.atom.php (moved) (moved from branches/1.2/lib/exception/data/error500.atom.php) (1 diff)
- branches/1.2/lib/exception/data/error.css.php (moved) (moved from branches/1.2/lib/exception/data/error500.css.php) (1 diff)
- branches/1.2/lib/exception/data/error.html.php (moved) (moved from branches/1.2/lib/exception/data/error500.html.php) (1 diff)
- branches/1.2/lib/exception/data/error.js.php (moved) (moved from branches/1.2/lib/exception/data/error500.js.php) (1 diff)
- branches/1.2/lib/exception/data/error.json.php (moved) (moved from branches/1.2/lib/exception/data/error500.json.php) (1 diff)
- branches/1.2/lib/exception/data/error.rdf.php (moved) (moved from branches/1.2/lib/exception/data/error500.rdf.php) (1 diff)
- branches/1.2/lib/exception/data/error.txt.php (moved) (moved from branches/1.2/lib/exception/data/error500.txt.php) (1 diff)
- branches/1.2/lib/exception/data/error.xml.php (moved) (moved from branches/1.2/lib/exception/data/error500.xml.php) (1 diff)
- branches/1.2/lib/exception/data/exception.atom.php (modified) (1 diff)
- branches/1.2/lib/exception/data/exception.css.php (modified) (1 diff)
- branches/1.2/lib/exception/data/exception.html.php (modified) (1 diff)
- branches/1.2/lib/exception/data/exception.js.php (modified) (1 diff)
- branches/1.2/lib/exception/data/exception.json.php (modified) (1 diff)
- branches/1.2/lib/exception/data/exception.rdf.php (modified) (1 diff)
- branches/1.2/lib/exception/data/exception.txt (modified) (2 diffs)
- branches/1.2/lib/exception/data/exception.xml.php (modified) (1 diff)
- branches/1.2/lib/exception/sfException.class.php (modified) (5 diffs)
- branches/1.2/lib/task/project/upgrade1.2/sfExceptionTemplatesUpgrade.class.php (deleted)
- branches/1.2/lib/view/sfView.class.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/1.2/UPGRADE_TO_1_2
r12085 r12138 49 49 `sfCreoleSessionStorage` | `sfPDOSessionStorage` 50 50 51 The `propel:build-db` task has been removed as this functionality is provided by52 `propel:insert-sql`.51 The `propel:build-db` task has been removed as this functionality is not yet 52 provided by Propel 1.3. 53 53 54 54 The first step to upgrading is changing from Creole to PDO syntax in the … … 533 533 with form defaults. 534 534 535 All widgets have a new `label` option. This option sets the label for the widget 536 when used in a widget schema context: 537 538 [php] 539 $widget = new sfWidgetFormInput(array('label' => 'Enter your name here')); 540 $widget->setLabel('Enter your name here'); 541 echo $widget->getLabel(); 542 535 543 Response 536 544 -------- … … 1103 1111 Before symfony 1.2, the `propel:insert-sql` task was the only task to read its 1104 1112 database configuration information from `propel.ini`. As of symfony 1.2, it 1105 reads it information from `databases.yml`. So, if you use several different1113 reads its information from `databases.yml`. So, if you use several different 1106 1114 connections in your model, the task will take those into account. 1107 Thanks to this new feature, you can now use the [--connection|INFO]option1115 Thanks to this new feature, you can now use the `--connection` option 1108 1116 if you want to only load SQL statements for a given connection: 1109 1117 … … 1654 1662 For example, an uncaught exception during an XML request could render 1655 1663 `config/error/exception.xml.php` when your application is in debug mode, or 1656 `config/error/error500.xml.php` when your application is not in debug mode. 1657 1658 Your symfony 1.1 project's `config/error500.php` file will also render, but 1659 your symfony 1.0 project's `web/errors/error500.php` file must be moved. This 1660 is done for you by the upgrade task. 1664 `config/error/error.xml.php` when your application is not in debug mode. 1665 1666 If you had customized the 500 error template in your project, you will 1667 need to manually move it to the new directory: 1668 1669 * For symfony 1.1: from `config/error500.php` to `config/error/error.html.php` 1670 * For symfony 1.0: from `web/errors/error500.php` to `config/error/error.html.php` branches/1.2/lib/autoload/sfCoreAutoload.class.php
r12069 r12138 361 361 'sfViewCacheManagerUpgrade' => 'task/project/upgrade1.1', 362 362 'sfWebDebugUpgrade' => 'task/project/upgrade1.1', 363 'sfExceptionTemplatesUpgrade' => 'task/project/upgrade1.2',364 363 'sfFactories12Upgrade' => 'task/project/upgrade1.2', 365 364 'sfPropel13Upgrade' => 'task/project/upgrade1.2', branches/1.2/lib/exception/data/error.atom.php
r11805 r12138 1 <?php include dirname(__FILE__).'/error_500.xml.php'?>1 <?php include sfException::getTemplatePathForError('xml', false) ?> branches/1.2/lib/exception/data/error.css.php
r11805 r12138 1 1 /* 2 500 Internal Server Error2 <?php echo $code ?> <?php echo $text ?> 3 3 */ branches/1.2/lib/exception/data/error.html.php
r11805 r12138 28 28 <div class="sfTMessageWrap"> 29 29 <h1>Oops! An Error Occurred</h1> 30 <h5>The server returned a " 500 Internal Server Error".</h5>30 <h5>The server returned a "<?php echo $code ?> <?php echo $text ?>".</h5> 31 31 </div> 32 32 </div> branches/1.2/lib/exception/data/error.js.php
r11805 r12138 1 1 /* 2 500 Internal Server Error2 <?php echo $code ?> <?php echo $text ?> 3 3 */ branches/1.2/lib/exception/data/error.json.php
r11805 r12138 1 1 { 2 'error':2 "error": 3 3 { 4 'code': 500,5 'message': 'Internal Server Error'4 "code": <?php echo $code ?>, 5 "message": "<?php echo $text ?>" 6 6 } 7 7 } branches/1.2/lib/exception/data/error.rdf.php
r11805 r12138 1 <?php include dirname(__FILE__).'/error_500.xml.php'?>1 <?php include sfException::getTemplatePathForError('xml', false) ?> branches/1.2/lib/exception/data/error.txt.php
r11805 r12138 2 2 ======================= 3 3 4 The server returned a " 500 Internal Server Error".4 The server returned a "<?php echo $code ?> <?php echo $text ?>". 5 5 6 6 Please e-mail us at [email] and let us know what you were doing when this branches/1.2/lib/exception/data/error.xml.php
r11805 r12138 1 1 <?xml version="1.0" encoding="<?php echo sfConfig::get('sf_charset', 'UTF-8') ?>"?> 2 <error code=" 500" message="Internal Server Error" />2 <error code="<?php echo $code ?>" message="<?php echo $text ?>" /> branches/1.2/lib/exception/data/exception.atom.php
r11805 r12138 1 <?php include dirname(__FILE__).'/exception.xml.php'?>1 <?php include sfException::getTemplatePathForError('xml', true) ?> branches/1.2/lib/exception/data/exception.css.php
r11805 r12138 1 1 /* 2 500 Internal Server Error2 <?php echo $code ?> <?php echo $text ?> 3 3 4 <?php echo $name."\n".$message."\n" ?> 4 <?php echo $name ?> 5 <?php echo $message ?> 6 7 <?php foreach ($traces as $trace): ?> 8 <?php echo $trace ?> 9 10 <?php endforeach; ?> 5 11 */ branches/1.2/lib/exception/data/exception.html.php
r11805 r12138 33 33 <center><div id="main"> 34 34 <div style="float: right"><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAZCAYAAAAiwE4nAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAEfklEQVRIx7VUa0wUVxT+Znd2FxZk0YKACAtaGwEDUhUTBTEIItmKYk3UNqalD7StMSQ1JKatP5omTYyx0VRrjPERX7XWAG2t9GVi3drU2h+gi4BCWV67lOe6O/uYmXtPf0BRrMBK6UlObmbON9935p6HQEQI1o7uXeSy1dsjHn2Xlpr0oKzililoEiIKymvOr9q+pzyZZN894moHcbWDZN892lOeTN9fKHgrWB5NsInZ7joOrtv4JgR2F4r0AxTpRwisEes2bsNtW+eBYHmCEqw8kVsp6oy6jMUFYIoTxFUQqWBqNzIWr4aoC9NVnlxZNSWC1mqLsa6ubd36zbug+m3gXBlypoCYAuavx4Ytu1Fbay+2VluME/GJEwHsnT3WpLlzhbi4Z6D46gBosP/gVQDA669kIzJSRWxcApLnPie0dw3cALBw0k1z5dyKrIqyWHL1/Eye7n3kcX5MH75fRAAIAJUUZ5Cnez9JPYfI1XuDKsriqOZcbtakm6alte/yqsIi6LVt4KobxAIAqSPxwUEJxAPgqgcG0YH8NS+gxT5wZVI1/PrU0q1O54OoFfmvQZZsIBYA5zIy0maOYFZmJ4GYAuIyZG8jcvLfgMPhmnHlbG7pUws2NfUeWVvyMpj3d3DVB84C4MyPxNkP+8I0TQRn/qGY6gP316J4w6uob3AceirBzw9nnBD1RmN65nLIUhOIBUBcBjEZ5viQEZx5thFcdQ+50o+A5w7SM5dBFHWhFz5bdOpJ3MLjq63mdHrIr7f6PaXbPtBGht4DUwYAQXikyVTkb/gKtbYBNFpzYYoY3egarR6D7jCcPmtly5ZEh6/ZWucfdyycPep3ycmJ2phoAzx9ziERLoMzN4hJAICI8KEkp4VxcCaP+p4zGdHTw2FOiNB2OTzfAMgf80qrjmem1zf256zf9B6kvmvgqgeqrw2qvx1cGQRxBcQV5GRFIGepaeT5cfdJXbAUPY+79z15l47MWzDmH7a3P/g2Ly9X4O6LkKUWEPeOMbwMpnANiClPDkOBXteL3OXxQnNL72UA5n/V8NLR9Bdrb/ddLN+5VvD23wTA8d9MgNH0LD759DrS5oeUbN7RWjXqSu//OXi8sCBFkN11IFJAxMZ0e4cP12+6xsUQqZC9nShclYTWtsDJUTU8cyDlsE7URqTMC4Eiu8fN+/JVF7I3NuGlna2wlDaPi1VkN1LnR0GvF00n95kPAICm+tgcQ9N9V5ll9Tz4JSem2vySE5bCFDS3+t+uPjbHIA64dF/MioU2aoYGXndgQgJLngnWL0PR1iUje0n4hHimBhA1XYA5IVz8q1eu0oSGqCc6HV4ihAIQgso6MV4flNhDUR/iYqbBI1GqZtM7zVUzZ4p3rl5rQIgxesqvVCsa0O8y4Lc/nGp8rLhcBIA7Df7C7hlKe2ZGojYmZsGUCsqygvOnf6FZsbrtm3bY+wUigiAIC/funlXR0RXYgv/BzAmGn979qGvXyOALghAJQAtAB0A/fIrDY6MNurj/LBqADW8OFYACQB4+2d80or7Ra0ZtxAAAAABJRU5ErkJggg==" /></div> 35 <h1> [<?php echo $name ?>]</h1>35 <h1><?php echo $code ?> | <?php echo $text ?> | <?php echo $name ?></h1> 36 36 <h2 id="message"><?php echo str_replace("\n", '<br />', htmlspecialchars($message, ENT_QUOTES, sfConfig::get('sf_charset', 'UTF-8'))) ?></h2> 37 37 <h2>stack trace</h2> branches/1.2/lib/exception/data/exception.js.php
r11805 r12138 1 1 /* 2 500 Internal Server Error2 <?php echo $code ?> <?php echo $text ?> 3 3 4 4 <?php echo $name ?> 5 5 <?php echo $message ?> 6 7 <?php foreach ($traces as $trace): ?> 8 <?php echo $trace ?> 9 10 <?php endforeach; ?> 6 11 */ branches/1.2/lib/exception/data/exception.json.php
r11805 r12138 1 1 { 2 'error':2 "error": 3 3 { 4 'code': 500,5 'message': 'Internal Server Error',6 'debug':4 "code": <?php echo $code ?>, 5 "message": "<?php echo addcslashes($text, "\0..\37\\'\"\177..\377\/") ?>", 6 "debug": 7 7 { 8 'name': '<?php echo $name ?>', 9 'message':'<?php echo addcslashes($message, "\0..\37\\'\"\177..\377\/") ?>' 8 "name": "<?php echo $name ?>", 9 "message": "<?php echo addcslashes($message, "\0..\37\\'\"\177..\377\/") ?>" 10 "traces": 11 [ 12 <?php foreach ($traces as $trace): ?> 13 "<?php echo addcslashes($trace, "\0..\37\\'\"\177..\377\/") ?>" 14 15 <?php endoreach; ?> 16 ] 10 17 } 11 18 } branches/1.2/lib/exception/data/exception.rdf.php
r11805 r12138 1 <?php include dirname(__FILE__).'/exception.xml.php'?>1 <?php include sfException::getTemplatePathForError('xml', true) ?> branches/1.2/lib/exception/data/exception.txt
r10633 r12138 1 [exception] <?php echo $ name ?>2 [message] <?php echo $message ?> 1 [exception] <?php echo $code.' | '.$text.' | '.$name ?> 2 [message] <?php echo $message ?> 3 3 <?php if (count($traces) > 0): ?> 4 4 [stack trace] … … 9 9 <?php endif; ?> 10 10 [symfony] v. <?php echo SYMFONY_VERSION ?> (symfony-project.org) 11 [PHP] v. <?php echo PHP_VERSION ?> 11 [PHP] v. <?php echo PHP_VERSION ?> branches/1.2/lib/exception/data/exception.xml.php
r11805 r12138 1 1 <?xml version="1.0" encoding="<?php echo sfConfig::get('sf_charset', 'UTF-8') ?>"?> 2 <error code=" 500" message="Internal Server Error">2 <error code="<?php echo $code ?>" message="<?php echo $text ?>"> 3 3 <debug> 4 4 <name><?php echo $name ?></name> 5 5 <message><?php echo htmlspecialchars($message, ENT_QUOTES, sfConfig::get('sf_charset', 'UTF-8')) ?></message> 6 <traces> 7 <?php foreach ($traces as $trace): ?> 8 <trace><?php echo $trace ?></trace> 9 <?php endforeach; ?> 10 </traces> 6 11 </debug> 7 12 </error> branches/1.2/lib/exception/sfException.class.php
r11837 r12138 137 137 } 138 138 } 139 140 $code = $response->getStatusCode(); 141 $text = $response->getStatusText(); 139 142 } 140 143 else … … 147 150 header('Content-Type: text/html; charset='.sfConfig::get('sf_charset', 'utf-8')); 148 151 } 149 } 150 151 $templatePaths = array( 152 sfConfig::get('sf_app_config_dir').'/error', 153 sfConfig::get('sf_config_dir').'/error', 154 dirname(__FILE__).'/data', 155 ); 152 153 $code = '500'; 154 $text = 'Internal Server Error'; 155 } 156 156 157 157 // send an error 500 if not in debug mode 158 158 if (!sfConfig::get('sf_debug')) 159 159 { 160 $template = sprintf('error500.%s.php', $format); 161 foreach ($templatePaths as $path) 162 { 163 if (is_null($path)) 164 { 165 continue; 166 } 167 168 if (is_readable($file = $path.'/'.$template)) 169 { 170 include $file; 171 return; 172 } 173 174 // for backward compatibility with symfony 1.1 175 if ('html' == $format && is_readable($file = $path.'/../error500.php')) 176 { 177 include $file; 178 return; 179 } 160 if ($template = self::getTemplatePathForError($format, false)) 161 { 162 include $template; 163 return; 180 164 } 181 165 } … … 183 167 $message = is_null($exception->getMessage()) ? 'n/a' : $exception->getMessage(); 184 168 $name = get_class($exception); 185 $traces = self::getTraces($exception, 0 == strncasecmp(PHP_SAPI, 'cli', 3) ? 'plain' : 'html');169 $traces = self::getTraces($exception, 'html' != $format || 0 == strncasecmp(PHP_SAPI, 'cli', 3) ? 'plain' : 'html'); 186 170 187 171 // dump main objects values … … 198 182 } 199 183 200 $template = sprintf('exception.%s.php', $format); 184 if ($template = self::getTemplatePathForError($format, true)) 185 { 186 include $template; 187 return; 188 } 189 } 190 191 /** 192 * Returns the path for the template error message. 193 * 194 * @param string $format The request format 195 * @param Boolean $debug Whether to return a template for the debug mode or not 196 * 197 * @return string|Boolean false if the template cannot be found for the given format, 198 * the absolute path to the template otherwise 199 */ 200 static public function getTemplatePathForError($format, $debug) 201 { 202 $templatePaths = array( 203 sfConfig::get('sf_app_config_dir').'/error', 204 sfConfig::get('sf_config_dir').'/error', 205 dirname(__FILE__).'/data', 206 ); 207 208 $template = sprintf('%s.%s.php', $debug ? 'exception' : 'error', $format); 201 209 foreach ($templatePaths as $path) 202 210 { 203 211 if (!is_null($path) && is_readable($file = $path.'/'.$template)) 204 212 { 205 include $file; 206 return; 207 } 208 } 213 return $file; 214 } 215 } 216 217 return false; 209 218 } 210 219 … … 322 331 else if ($value === null) 323 332 { 324 $result[] = '<em>null</em>';333 $result[] = $format == 'html' ? '<em>null</em>' : 'null'; 325 334 } 326 335 else if (!is_int($key)) 327 336 { 328 $result[] = "'$key' =>'$value'";337 $result[] = $format == 'html' ? "'$key' => '$value'" : "'$key' => '$value'"; 329 338 } 330 339 else branches/1.2/lib/view/sfView.class.php
r11286 r12138 356 356 if (!is_readable($this->directory.'/'.$this->template)) 357 357 { 358 throw new sfRenderException(sprintf('The template "%s" does not exist or is unreadable in "%s".', $this->template, $this->directory)); 358 // 404? 359 if ('404' == $this->context->getResponse()->getStatusCode()) 360 { 361 // use default exception templates 362 $this->directory = null; 363 $this->template = sfException::getTemplatePathForError($this->context->getRequest()->getRequestFormat(), $this->context->getConfiguration()->isDebug()); 364 $this->setAttribute('code', '404'); 365 $this->setAttribute('text', 'Not Found'); 366 } 367 else 368 { 369 throw new sfRenderException(sprintf('The template "%s" does not exist or is unreadable in "%s".', $this->template, $this->directory)); 370 } 359 371 } 360 372