Browse files

Merge pull request #83 from simonwelsh/master

PHP5.4 Support
  • Loading branch information...
2 parents 919618e + 58bbb36 commit 0cdf52c09ab917ffcd79eee7000d721e22513d22 @sminnee sminnee committed Oct 28, 2011
Showing with 13 additions and 5 deletions.
  1. +4 −0 control/Controller.php
  2. +1 −1 core/Core.php
  3. +2 −1 dev/Backtrace.php
  4. +3 −0 main.php
  5. +2 −2 tests/api/RestfulServiceTest.php
  6. +1 −1 view/SSViewer.php
View
4 control/Controller.php
@@ -368,6 +368,10 @@ public static function has_curr() {
*/
function can($perm, $member = null) {
if(!$member) $member = Member::currentUser();
+ if(is_array($perm)) {
+ $perm = array_map(array($this, 'can'), $perm, array_fill(0, count($perm), $member));
+ return min($perm);
+ }
if($this->hasMethod($methodName = 'can' . $perm)) {
return $this->$methodName($member);
} else {
View
2 core/Core.php
@@ -40,7 +40,7 @@
///////////////////////////////////////////////////////////////////////////////
// ENVIRONMENT CONFIG
-if(defined('E_DEPRECATED')) error_reporting(E_ALL ^ E_DEPRECATED);
+if(defined('E_DEPRECATED')) error_reporting(E_ALL & ~(E_DEPRECATED | E_STRICT));
else error_reporting(E_ALL);
/*
* This is for versions of PHP prior to version 5.2
View
3 dev/Backtrace.php
@@ -136,7 +136,8 @@ static function full_func_name($item, $showArgs = false, $argCharLimit = 10000)
$args = array();
foreach($item['args'] as $arg) {
if(!is_object($arg) || method_exists($arg, '__toString')) {
- $args[] = (strlen((string)$arg) > $argCharLimit) ? substr((string)$arg, 0, $argCharLimit) . '...' : (string)$arg;
+ $sarg = is_array($arg) ? 'Array' : strval($arg);
+ $args[] = (strlen($sarg) > $argCharLimit) ? substr($sarg, 0, $argCharLimit) . '...' : $sarg;
} else {
$args[] = get_class($arg);
}
View
3 main.php
@@ -107,6 +107,9 @@
// Redirect to the installer if no database is selected
if(!isset($databaseConfig) || !isset($databaseConfig['database']) || !$databaseConfig['database']) {
+ if(!file_exists(BASE_PATH . '/install.php')) {
+ die('SilverStripe Framework requires a $databaseConfig defined.');
+ }
$s = (isset($_SERVER['SSL']) || (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off')) ? 's' : '';
$installURL = "http$s://" . $_SERVER['HTTP_HOST'] . BASE_URL . '/install.php';
View
4 tests/api/RestfulServiceTest.php
@@ -218,7 +218,7 @@ class RestfulServiceTest_MockRestfulService extends RestfulService {
public $session = null;
- public function request($subURL = '', $method = "GET", $data = null, $headers = null) {
+ public function request($subURL = '', $method = "GET", $data = null, $headers = null, $curlOptions = array()) {
if(!$this->session) {
$this->session = new Session(array());
@@ -277,7 +277,7 @@ public function request($subURL = '', $method = "GET", $data = null, $headers =
*/
class RestfulServiceTest_MockErrorService extends RestfulService {
- public function curlRequest() {
+ public function curlRequest($url, $method, $data = null, $headers = null, $curlOptions = array()) {
return new RestfulService_Response('<error>HTTP Error</error>', 400);
}
View
2 view/SSViewer.php
@@ -319,7 +319,7 @@ public function __construct($templateList) {
}
}
- if(substr((string) $templateList,-3) == '.ss') {
+ if(!is_array($templateList) && substr((string) $templateList,-3) == '.ss') {
$this->chosenTemplates['main'] = $templateList;
} else {
$this->chosenTemplates = SS_TemplateLoader::instance()->findTemplates(

0 comments on commit 0cdf52c

Please sign in to comment.