[switchyard] r782 committed - More updates to help kill off errors ...

0 views
Skip to first unread message

codesite...@google.com

unread,
Sep 30, 2009, 4:48:37 PM9/30/09
to switchy...@googlegroups.com
Revision: 782
Author: intuiworx
Date: Wed Sep 30 13:47:44 2009
Log: More updates to help kill off errors ...
http://code.google.com/p/switchyard/source/detail?r=782

Modified:
/framework/trunk/app/conf/httpstatus.ini
/framework/trunk/app/conf/routes.php
/framework/trunk/app/core/SwitchYard.class.php
/framework/trunk/app/core/SwitchYard_Router.class.php
/framework/trunk/app/core/SwitchYard_Session.class.php
/framework/trunk/app/core/bootstrap.php

=======================================
--- /framework/trunk/app/conf/httpstatus.ini Tue Mar 24 08:33:27 2009
+++ /framework/trunk/app/conf/httpstatus.ini Wed Sep 30 13:47:44 2009
@@ -1,57 +1,57 @@
-100 = Continue
-101 = Switching Protocols
-102 = Processing
-200 = OK
-201 = Created
-202 = Accepted
-203 = Non-Authoritative Information
-204 = No Content
-205 = Reset Content
-206 = Partial Content
-207 = Multi-Status
-300 = Multiple Choices
-301 = Moved Permanently
-302 = Found
-303 = See Other
-304 = Not Modified
-305 = Use Proxy
-306 = unused
-307 = Temporary Redirect
-400 = Bad Request
-401 = Authorization Required
-402 = Payment Required
-403 = Forbidden
-404 = Not Found
-405 = Method Not Allowed
-406 = Not Acceptable
-407 = Proxy Authentication Required
-408 = Request Time-out
-409 = Conflict
-410 = Gone
-411 = Length Required
-412 = Precondition Failed
-413 = Request Entity Too Large
-414 = Request-URI Too Large
-415 = Unsupported Media Type
-416 = Requested Range Not Satisfiable
-417 = Expectation Failed
-418 = I’m a teapot
-419 = unused
-420 = unused
-421 = unused
-422 = Unprocessable Entity
-423 = Locked
-424 = Failed Dependency
-425 = No code
-426 = Upgrade Required
-500 = Internal Server Error
-501 = Method Not Implemented
-502 = Bad Gateway
-503 = Service Temporarily Unavailable
-504 = Gateway Time-out
-505 = HTTP Version Not Supported
-506 = Variant Also Negotiates
-507 = Insufficient Storage
-508 = unused
-509 = unused
-510 = Not Extended
+100 = "Continue"
+101 = "Switching Protocols"
+102 = "Processing"
+200 = "OK"
+201 = "Created"
+202 = "Accepted"
+203 = "Non-Authoritative Information"
+204 = "No Content"
+205 = "Reset Content"
+206 = "Partial Content"
+207 = "Multi-Status"
+300 = "Multiple Choices"
+301 = "Moved Permanently"
+302 = "Found"
+303 = "See Other"
+304 = "Not Modified"
+305 = "Use Proxy"
+306 = "unused"
+307 = "Temporary Redirect"
+400 = "Bad Request"
+401 = "Authorization Required"
+402 = "Payment Required"
+403 = "Forbidden"
+404 = "Not Found"
+405 = "Method Not Allowed"
+406 = "Not Acceptable"
+407 = "Proxy Authentication Required"
+408 = "Request Time-out"
+409 = "Conflict"
+410 = "Gone"
+411 = "Length Required"
+412 = "Precondition Failed"
+413 = "Request Entity Too Large"
+414 = "Request-URI Too Large"
+415 = "Unsupported Media Type"
+416 = "Requested Range Not Satisfiable"
+417 = "Expectation Failed"
+418 = "I’m a teapot"
+419 = "unused"
+420 = "unused"
+421 = "unused"
+422 = "Unprocessable Entity"
+423 = "Locked"
+424 = "Failed Dependency"
+425 = "No code"
+426 = "Upgrade Required"
+500 = "Internal Server Error"
+501 = "Method Not Implemented"
+502 = "Bad Gateway"
+503 = "Service Temporarily Unavailable"
+504 = "Gateway Time-out"
+505 = "HTTP Version Not Supported"
+506 = "Variant Also Negotiates"
+507 = "Insufficient Storage"
+508 = "unused"
+509 = "unused"
+510 = "Not Extended"
=======================================
--- /framework/trunk/app/conf/routes.php Fri Jun 5 11:13:19 2009
+++ /framework/trunk/app/conf/routes.php Wed Sep 30 13:47:44 2009
@@ -5,10 +5,7 @@
*/
SwitchYard_Router::add('', array('controller' => 'Example', 'method'
=> 'index'));

-SwitchYard_Router::add(
- 'example1',
- array('controller' => 'Example', 'method' => 'example1')
-);
+SwitchYard_Router::add('example1', array('controller'
=> 'Example', 'method' => 'example1'));

SwitchYard_Router::add(
'example2/(.+)/(.+)',
=======================================
--- /framework/trunk/app/core/SwitchYard.class.php Mon Sep 28 08:06:48 2009
+++ /framework/trunk/app/core/SwitchYard.class.php Wed Sep 30 13:47:44 2009
@@ -32,7 +32,7 @@
*/
public static function doHandler($hook_name, $params = array())
{
- if (is_array(SwitchYard::$handlers) and array_key_exists($hook_name,
SwitchYard::$handlers)) {
+ if (is_array(SwitchYard::$handlers) and
isset(SwitchYard::$handlers[$hook_name])) {
ksort(SwitchYard::$handlers[$hook_name], SORT_NUMERIC);
foreach (SwitchYard::$handlers[$hook_name] as $priority => $handlers) {
foreach ($handlers as $callback) call_user_func_array($callback,
$params);
=======================================
--- /framework/trunk/app/core/SwitchYard_Router.class.php Mon Sep 28
08:06:48 2009
+++ /framework/trunk/app/core/SwitchYard_Router.class.php Wed Sep 30
13:47:44 2009
@@ -16,7 +16,7 @@
include SY_CNFDIR.'/routes.php';

// see if we've got a URL match
- if (!array_key_exists('path', $_REQUEST)) {
+ if (!isset($_REQUEST['path'])) {
$_REQUEST['path'] = '';
}
foreach (self::$url_match as $k => $v) {
@@ -48,7 +48,7 @@
$this->controller->params = $this->params;

// Set AUTH if necessary.
- if (array_key_exists('auth', SwitchYard::$routeconfig)) {
+ if (isset(SwitchYard::$routeconfig['auth'])) {
define('SY_AUTH',
SwitchYard_Config::value_to_boolean(SwitchYard::$routeconfig['auth']));
SwitchYard::doHandler('define_auth');
}
@@ -88,7 +88,7 @@
private function _filter_input()
{
// filter input, if necessary
- if (!array_key_exists('urlparams', SwitchYard::$routeconfig)) return;
+ if (!isset(SwitchYard::$routeconfig['urlparams'])) return;
for ($i = 0; $i < sizeof(SwitchYard::$routeconfig['urlparams']); $i++) {
$p = SwitchYard::$routeconfig['urlparams'][$i];
if (is_array($p)) {
=======================================
--- /framework/trunk/app/core/SwitchYard_Session.class.php Fri Jul 10
22:14:37 2009
+++ /framework/trunk/app/core/SwitchYard_Session.class.php Wed Sep 30
13:47:44 2009
@@ -29,25 +29,29 @@
/**
* Retrieves the saved session value associated with $key.
*
+ * @todo Figure out how we can make this not throw a warning, and perhaps
even get rid of the eval() call.
* @param string $key
* @return mixed
*/
public function get($key)
{
$this->_init();
- eval('$val = $_SESSION[\''.implode('\'][\'', explode('.', $key)).'\'];');
+ // FIXME!
+ @eval('$val = $_SESSION[\''.implode('\'][\'', explode('.',
$key)).'\'];');
return $val;
}

/**
* Sets the value or set of values into the session.
+ *
+ * @todo Figure out how we can make this not throw a warning, and perhaps
even get rid of the eval() call.
*/
public function set($arg1, $arg2 = null)
{
$this->_init();
if (!is_array($arg1)) $arg1 = array($arg1 => $arg2);
foreach ($arg1 as $k => $v) {
- eval('$_SESSION[\''.implode('\'][\'', explode('.', $k)).'\'] = $v;');
+ @eval('$_SESSION[\''.implode('\'][\'', explode('.', $k)).'\'] = $v;');
}
}

=======================================
--- /framework/trunk/app/core/bootstrap.php Mon Jul 13 12:44:47 2009
+++ /framework/trunk/app/core/bootstrap.php Wed Sep 30 13:47:44 2009
@@ -9,8 +9,8 @@
require 'SwitchYard.class.php';

// Define some necessary constants.
-define('SY_ROOTDIR', realpath(dirname($_SERVER['SCRIPT_FILENAME'])));
-define('SY_HTTPDIR', strtr(dirname($_SERVER['SCRIPT_NAME']), '\\', '/'));
+define('SY_ROOTDIR', str_replace('/app/core', '', dirname(__FILE__)));
+define('SY_HTTPDIR', str_replace('/app/core', '', dirname(__FILE__)));
define('SY_APPDIR', SY_ROOTDIR.'/app');
define('SY_CNFDIR', SY_APPDIR.'/conf');
define('SY_COREDIR', SY_APPDIR.'/core');
@@ -26,7 +26,7 @@
define('GET', ($_SERVER['REQUEST_METHOD'] == 'GET')?true:false);

// Add to the include dirs
-ini_set('include_path',
ini_get('include_path').PATH_SEPARATOR.SY_ROOTDIR.'/phplib');
+ini_set('include_path', ini_get('include_path').'/'.SY_ROOTDIR.'/phplib');

// setup autoload & take care of any other class initialization
spl_autoload_register('switchyard_autoload');
Reply all
Reply to author
Forward
0 new messages