Skip to content

Commit

Permalink
Merge develop for new release
Browse files Browse the repository at this point in the history
  • Loading branch information
Woody Gilk committed May 7, 2014
2 parents 9e192d7 + 76ed4c5 commit 04b3c36
Show file tree
Hide file tree
Showing 54 changed files with 495 additions and 206 deletions.
10 changes: 9 additions & 1 deletion classes/kohana/arr.php
Expand Up @@ -441,7 +441,15 @@ public static function merge(array $a1, array $a2)
else
{
// Find the values that are not already present
$diff = array_diff($val, $result[$key]);
$diff = array();

foreach ($val as $val_val)
{
if ( ! in_array($val_val, $result[$key], TRUE))
{
$diff[] = $val_val;
}
}

// Indexed arrays are merged to prevent duplicates
$result[$key] = array_merge($result[$key], $diff);
Expand Down
2 changes: 1 addition & 1 deletion classes/kohana/config/group.php
Expand Up @@ -12,7 +12,7 @@
* @category Configuration
* @author Kohana Team
* @copyright (c) 2012 Kohana Team
* @license http://kohanaphp.com/license
* @license http://kohanaframework.org/license
*/
class Kohana_Config_Group extends ArrayObject {

Expand Down
2 changes: 1 addition & 1 deletion classes/kohana/config/reader.php
Expand Up @@ -13,7 +13,7 @@ interface Kohana_Config_Reader extends Kohana_Config_Source
{

/**
* Tries to load the specificed configuration group
* Tries to load the specified configuration group
*
* Returns FALSE if group does not exist or an array if it does
*
Expand Down
2 changes: 1 addition & 1 deletion classes/kohana/config/source.php
Expand Up @@ -8,7 +8,7 @@
* @category Configuration
* @author Kohana Team
* @copyright (c) 2012 Kohana Team
* @license http://kohanaphp.com/license
* @license http://kohanaframework.org/license
*/

interface Kohana_Config_Source {}
2 changes: 1 addition & 1 deletion classes/kohana/config/writer.php
Expand Up @@ -8,7 +8,7 @@
* @package Kohana
* @author Kohana Team
* @copyright (c) 2008-2012 Kohana Team
* @license http://kohanaphp.com/license
* @license http://kohanaframework.org/license
*/
interface Kohana_Config_Writer extends Kohana_Config_Source
{
Expand Down
1 change: 0 additions & 1 deletion classes/kohana/cookie.php
Expand Up @@ -124,7 +124,6 @@ public static function set($name, $value, $expiration = NULL)
*
* @param string $name cookie name
* @return boolean
* @uses Cookie::set
*/
public static function delete($name)
{
Expand Down
31 changes: 25 additions & 6 deletions classes/kohana/core.php
Expand Up @@ -327,7 +327,7 @@ public static function init(array $settings = NULL)
}

// Determine if the extremely evil magic quotes are enabled
Kohana::$magic_quotes = version_compare(PHP_VERSION, '5.4') < 0 AND get_magic_quotes_gpc();
Kohana::$magic_quotes = (version_compare(PHP_VERSION, '5.4') < 0 AND get_magic_quotes_gpc());

// Sanitize all request variables
$_GET = Kohana::sanitize($_GET);
Expand Down Expand Up @@ -388,7 +388,7 @@ public static function deinit()

/**
* Reverts the effects of the `register_globals` PHP setting by unsetting
* all global varibles except for the default super globals (GPCS, etc),
* all global variables except for the default super globals (GPCS, etc),
* which is a [potential security hole.][ref-wikibooks]
*
* This is called automatically by [Kohana::init] if `register_globals` is
Expand Down Expand Up @@ -898,7 +898,7 @@ public static function cache($name, $data = NULL, $lifetime = NULL)
}

/**
* Get a message from a file. Messages are arbitary strings that are stored
* Get a message from a file. Messages are arbitrary strings that are stored
* in the `messages/` directory and reference by a key. Translation is not
* performed on the returned values. See [message files](kohana/files/messages)
* for more information.
Expand Down Expand Up @@ -967,18 +967,37 @@ public static function error_handler($code, $error, $file = NULL, $line = NULL)

/**
* Catches errors that are not caught by the error handler, such as E_PARSE.
*
* In case of an exception, the Kohana exception handler registers
* this shutdown_handler again. We'll count the number of visits to
* this function using a local static function variable, and exit(1)
* on the second visit.
* @see issue #3931
*
* @uses Kohana_Exception::handler
* @return void
*/
public static function shutdown_handler()
{
// test if we have already shutdown, if TRUE, exit(1)
static $shutdown_handler_visited = FALSE;
if ($shutdown_handler_visited)
{
exit(1);
}
$shutdown_handler_visited = TRUE;

if ( ! Kohana::$_init)
{
// Do not execute when not active
return;
}

// Retrieve the current exception handler
$handler = set_exception_handler(array('Kohana_Exception', 'handler'));

// Restore it back to it's previous state
restore_exception_handler();

try
{
if (Kohana::$caching === TRUE AND Kohana::$_files_changed === TRUE)
Expand All @@ -990,7 +1009,7 @@ public static function shutdown_handler()
catch (Exception $e)
{
// Pass the exception to the handler
Kohana_Exception::handler($e);
call_user_func($handler, $e);
}

if (Kohana::$errors AND $error = error_get_last() AND in_array($error['type'], Kohana::$shutdown_errors))
Expand All @@ -999,7 +1018,7 @@ public static function shutdown_handler()
ob_get_level() and ob_clean();

// Fake an exception for nice debugging
Kohana_Exception::handler(new ErrorException($error['message'], $error['type'], 0, $error['file'], $error['line']));
call_user_func($handler, new ErrorException($error['message'], $error['type'], 0, $error['file'], $error['line']));

// Shutdown now to avoid a "death loop"
exit(1);
Expand Down
2 changes: 1 addition & 1 deletion classes/kohana/debug.php
Expand Up @@ -6,7 +6,7 @@
* @category Base
* @author Kohana Team
* @copyright (c) 2008-2012 Kohana Team
* @license http://kohanaphp.com/license
* @license http://kohanaframework.org/license
*/
class Kohana_Debug {

Expand Down
14 changes: 7 additions & 7 deletions classes/kohana/file.php
Expand Up @@ -163,16 +163,16 @@ public static function split($filename, $piece_size = 10)
// Write files in 8k blocks
$block_size = 1024 * 8;

// Total number of peices
$peices = 0;
// Total number of pieces
$pieces = 0;

while ( ! feof($file))
{
// Create another piece
$peices += 1;
$pieces += 1;

// Create a new file piece
$piece = str_pad($peices, 3, '0', STR_PAD_LEFT);
$piece = str_pad($pieces, 3, '0', STR_PAD_LEFT);
$piece = fopen($filename.'.'.$piece, 'wb+');

// Number of bytes read
Expand All @@ -195,7 +195,7 @@ public static function split($filename, $piece_size = 10)
// Close the file
fclose($file);

return $peices;
return $pieces;
}

/**
Expand All @@ -214,7 +214,7 @@ public static function join($filename)
// Read files in 8k blocks
$block_size = 1024 * 8;

// Total number of peices
// Total number of pieces
$pieces = 0;

while (is_file($piece = $filename.'.'.str_pad($pieces + 1, 3, '0', STR_PAD_LEFT)))
Expand All @@ -231,7 +231,7 @@ public static function join($filename)
fwrite($file, fread($piece, $block_size));
}

// Close the peice
// Close the piece
fclose($piece);
}

Expand Down
4 changes: 2 additions & 2 deletions classes/kohana/form.php
Expand Up @@ -2,7 +2,7 @@
/**
* Form helper class. Unless otherwise noted, all generated HTML will be made
* safe using the [HTML::chars] method. This prevents against simple XSS
* attacks that could otherwise be trigged by inserting HTML characters into
* attacks that could otherwise be triggered by inserting HTML characters into
* form fields.
*
* @package Kohana
Expand All @@ -28,7 +28,7 @@ class Kohana_Form {
* @param mixed $action form action, defaults to the current request URI, or [Request] class to use
* @param array $attributes html attributes
* @return string
* @uses Request::instance
* @uses Request
* @uses URL::site
* @uses HTML::attributes
*/
Expand Down
2 changes: 1 addition & 1 deletion classes/kohana/http.php
Expand Up @@ -12,7 +12,7 @@
* @author Kohana Team
* @since 3.1.0
* @copyright (c) 2008-2012 Kohana Team
* @license http://kohanaphp.com/license
* @license http://kohanaframework.org/license
*/
abstract class Kohana_HTTP {

Expand Down
2 changes: 1 addition & 1 deletion classes/kohana/http/cache.php
@@ -1,6 +1,6 @@
<?php defined('SYSPATH') or die('No direct script access.');
/**
* HTTT Caching adaptor class that provides caching services to the
* HTTP Caching adaptor class that provides caching services to the
* [Request_Client] class, using HTTP cache control logic as defined in
* RFC 2616.
*
Expand Down
2 changes: 1 addition & 1 deletion classes/kohana/http/header.php
Expand Up @@ -10,7 +10,7 @@
* @author Kohana Team
* @since 3.1.0
* @copyright (c) 2008-2012 Kohana Team
* @license http://kohanaphp.com/license
* @license http://kohanaframework.org/license
*/
class Kohana_HTTP_Header extends ArrayObject {

Expand Down
2 changes: 1 addition & 1 deletion classes/kohana/http/message.php
Expand Up @@ -8,7 +8,7 @@
* @author Kohana Team
* @since 3.1.0
* @copyright (c) 2008-2012 Kohana Team
* @license http://kohanaphp.com/license
* @license http://kohanaframework.org/license
*/
interface Kohana_HTTP_Message {

Expand Down
2 changes: 1 addition & 1 deletion classes/kohana/http/request.php
Expand Up @@ -9,7 +9,7 @@
* @author Kohana Team
* @since 3.1.0
* @copyright (c) 2008-2012 Kohana Team
* @license http://kohanaphp.com/license
* @license http://kohanaframework.org/license
*/
interface Kohana_HTTP_Request extends HTTP_Message {

Expand Down
4 changes: 2 additions & 2 deletions classes/kohana/http/response.php
@@ -1,6 +1,6 @@
<?php defined('SYSPATH') or die('No direct script access.');
/**
* A HTTP Reponse specific interface that adds the methods required
* A HTTP Response specific interface that adds the methods required
* by HTTP responses. Over and above [Kohana_HTTP_Interaction], this
* interface provides status.
*
Expand All @@ -9,7 +9,7 @@
* @author Kohana Team
* @since 3.1.0
* @copyright (c) 2008-2012 Kohana Team
* @license http://kohanaphp.com/license
* @license http://kohanaframework.org/license
*/
interface Kohana_HTTP_Response extends HTTP_Message {

Expand Down
4 changes: 2 additions & 2 deletions classes/kohana/inflector.php
Expand Up @@ -70,7 +70,7 @@ public static function uncountable($str)
*
* [!!] Special inflections are defined in `config/inflector.php`.
*
* @param string $str word to singularize
* @param string $str word to make singular
* @param integer $count count of thing
* @return string
* @uses Inflector::uncountable
Expand Down Expand Up @@ -197,7 +197,7 @@ public static function plural($str, $count = NULL)
$str .= 's';
}

// Convert to uppsecase if nessasary
// Convert to uppercase if necessary
if ($is_uppercase)
{
$str = strtoupper($str);
Expand Down
18 changes: 12 additions & 6 deletions classes/kohana/kohana/exception.php
Expand Up @@ -80,7 +80,11 @@ public function __toString()
/**
* Inline exception handler, displays the error message, source of the
* exception, and the stack trace of the error.
*
*
* Re-registers Kohana::shutdown_handler to make the PHP engine
* run the shutdown twice. We'll be exit(1)-ing from there.
* @see issue #3931
*
* @uses Kohana_Exception::text
* @param Exception $e
* @return boolean
Expand All @@ -89,6 +93,8 @@ public static function handler(Exception $e)
{
try
{
register_shutdown_function(array('Kohana', 'shutdown_handler'));

// Get the exception information
$type = get_class($e);
$code = $e->getCode();
Expand Down Expand Up @@ -146,7 +152,7 @@ public static function handler(Exception $e)
// Just display the text of the exception
echo "\n{$error}\n";

exit(1);
return TRUE;
}

if ( ! headers_sent())
Expand All @@ -162,7 +168,7 @@ public static function handler(Exception $e)
// Just display the text of the exception
echo "\n{$error}\n";

exit(1);
return TRUE;
}

// Start an output buffer
Expand All @@ -183,7 +189,7 @@ public static function handler(Exception $e)
// Display the contents of the output buffer
echo ob_get_clean();

exit(1);
return TRUE;
}
catch (Exception $e)
{
Expand All @@ -193,8 +199,8 @@ public static function handler(Exception $e)
// Display the exception text
echo Kohana_Exception::text($e), "\n";

// Exit with an error status
exit(1);
// return
return TRUE;
}
}

Expand Down
7 changes: 2 additions & 5 deletions classes/kohana/log/stderr.php
Expand Up @@ -6,7 +6,7 @@
* @category Logging
* @author Kohana Team
* @copyright (c) 2008-2012 Kohana Team
* @license http://kohanaphp.com/license
* @license http://kohanaframework.org/license
*/
class Kohana_Log_StdErr extends Log_Writer {
/**
Expand All @@ -19,13 +19,10 @@ class Kohana_Log_StdErr extends Log_Writer {
*/
public function write(array $messages)
{
// Set the log line format
$format = 'time --- type: body';

foreach ($messages as $message)
{
// Writes out each message
fwrite(STDERR, PHP_EOL.strtr($format, $message));
fwrite(STDERR, PHP_EOL.$message['time'].' --- '.$this->_log_levels[$message['level']].': '.$message['body']);
}
}
} // End Kohana_Log_StdErr

0 comments on commit 04b3c36

Please sign in to comment.