fixes for PHP 5.4 warnings and strict warnings, thought disabled E_STRICT for now, because of various strict warnings in working code, which could not be easy fixed in all areas (see comment in phpgwapi/inc/functions.inc.php)

This commit is contained in:
Ralf Becker 2012-03-04 13:33:10 +00:00
parent bade774bfa
commit f676a23821
15 changed files with 192 additions and 180 deletions

View File

@ -305,7 +305,7 @@ class addressbook_so
$this->content_types = config::get_content_types('addressbook'); $this->content_types = config::get_content_types('addressbook');
if (!$this->content_types) if (!$this->content_types)
{ {
$this->content_types = $custom->content_types = array('n' => array( $this->content_types = array('n' => array(
'name' => 'contact', 'name' => 'contact',
'options' => array( 'options' => array(
'template' => 'addressbook.edit', 'template' => 'addressbook.edit',

View File

@ -723,7 +723,7 @@ class addressbook_sql extends so_sql_cf
* @param string|array $extra_where=null extra where clause, eg. to check the etag, returns 'nothing_affected' if not affected rows * @param string|array $extra_where=null extra where clause, eg. to check the etag, returns 'nothing_affected' if not affected rows
* @return int 0 on success and errno != 0 else * @return int 0 on success and errno != 0 else
*/ */
function save($keys=null) function save($keys = NULL, $extra_where = NULL)
{ {
if (isset($GLOBALS['egw_info']['user']['preferences']['syncml']['minimum_uid_length'])) { if (isset($GLOBALS['egw_info']['user']['preferences']['syncml']['minimum_uid_length'])) {
$minimum_uid_length = $GLOBALS['egw_info']['user']['preferences']['syncml']['minimum_uid_length']; $minimum_uid_length = $GLOBALS['egw_info']['user']['preferences']['syncml']['minimum_uid_length'];

View File

@ -174,9 +174,10 @@ class addressbook_tracking extends bo_tracking
* *
* @param array $data * @param array $data
* @param array $old * @param array $old
* @param int|string $receiver nummeric account_id or email address
* @return string * @return string
*/ */
function get_message($data,$old) protected function get_message($data,$old,$receiver=null)
{ {
if (!$data['modified'] || !$old) if (!$data['modified'] || !$old)
{ {
@ -194,9 +195,11 @@ class addressbook_tracking extends bo_tracking
* *
* @param array $data * @param array $data
* @param array $old * @param array $old
* @param boolean $deleted=null can be set to true to let the tracking know the item got deleted or undelted
* @param int|string $receiver nummeric account_id or email address
* @return string * @return string
*/ */
function get_subject($data,$old) protected function get_subject($data,$old,$deleted=null,$receiver=null)
{ {
if ($data['is_contactform']) if ($data['is_contactform'])
{ {
@ -208,11 +211,11 @@ class addressbook_tracking extends bo_tracking
/** /**
* Get the details of an entry * Get the details of an entry
* *
* @param array $data * @param array|object $data
* * @param int|string $receiver nummeric account_id or email address
* @return array of details as array with values for keys 'label','value','type' * @return array of details as array with values for keys 'label','value','type'
*/ */
function get_details($data) function get_details($data,$receiver=null)
{ {
foreach($this->contacts->contact_fields as $name => $label) foreach($this->contacts->contact_fields as $name => $label)
{ {

View File

@ -1415,7 +1415,8 @@ abstract class bo_merge
foreach($files as $file) foreach($files as $file)
{ {
// return only the mime-types we support // return only the mime-types we support
if (!self::is_implemented($file['mime'],'.'.array_pop($parts=explode('.',$file['name'])))) continue; $parts = explode('.',$file['name']);
if (!self::is_implemented($file['mime'],'.'.array_pop($parts))) continue;
if ($mime_filter && $negativ_filter === in_array($file['mime'], (array)$mime_filter)) continue; if ($mime_filter && $negativ_filter === in_array($file['mime'], (array)$mime_filter)) continue;
$list[$prefix.$file['name']] = egw_vfs::decodePath($file['name']); $list[$prefix.$file['name']] = egw_vfs::decodePath($file['name']);
} }
@ -1477,7 +1478,8 @@ abstract class bo_merge
foreach($files as $key => $file) foreach($files as $key => $file)
{ {
// use only the mime-types we support // use only the mime-types we support
if (!self::is_implemented($file['mime'],'.'.array_pop($parts=explode('.',$file['name']))) || $parts = explode('.',$file['name']);
if (!self::is_implemented($file['mime'],'.'.array_pop($parts)) ||
!egw_vfs::check_access($file['path'], egw_vfs::READABLE, $file) || // remove files not readable by user !egw_vfs::check_access($file['path'], egw_vfs::READABLE, $file) || // remove files not readable by user
$file['path'] === $default_doc) // default doc already added $file['path'] === $default_doc) // default doc already added
{ {

View File

@ -195,7 +195,8 @@ class vfs_widget
} }
if (($cell_name = $cell['name']) == '$row') if (($cell_name = $cell['name']) == '$row')
{ {
$cell_name = array_pop($arr=explode('][',substr($form_name,0,-1))); $arr = explode('][',substr($form_name,0,-1));
$cell_name = array_pop($arr);
} }
$cell['name'] = ''; $cell['name'] = '';
$cell['type'] = 'hbox'; $cell['type'] = 'hbox';

View File

@ -84,7 +84,7 @@ class filemanager_ui
* *
* @return string * @return string
*/ */
public function get_view() public static function get_view()
{ {
$view =& egw_cache::getSession('filemanager', 'view'); $view =& egw_cache::getSession('filemanager', 'view');
if (isset($_GET['view'])) if (isset($_GET['view']))

View File

@ -660,9 +660,9 @@ class infolog_ui
} }
if (!$action) if (!$action)
{ {
$action = $values['action'] ? $values['action'] : get_var('action',array('POST','GET')); $action = is_array($values) && $values['action'] ? $values['action'] : get_var('action',array('POST','GET'));
$action_id = $values['action_id'] ? $values['action_id'] : get_var('action_id',array('POST','GET')); $action_id = is_array($values) && $values['action_id'] ? $values['action_id'] : get_var('action_id',array('POST','GET'));
$action_title = $values['action_title'] ? $values['action_title'] : get_var('action_title',array('POST','GET')); $action_title = is_array($values) && $values['action_title'] ? $values['action_title'] : get_var('action_title',array('POST','GET'));
} }
//echo "<p>".__METHOD__."(action='$action/$action_id',called_as='$called_as/$values[referer]',own_referer='$own_referer') values=\n"; _debug_array($values); //echo "<p>".__METHOD__."(action='$action/$action_id',called_as='$called_as/$values[referer]',own_referer='$own_referer') values=\n"; _debug_array($values);
if (!is_array($values)) if (!is_array($values))

View File

@ -378,7 +378,7 @@ class ADODB_mysql extends ADOConnection {
return $this->_connect($argHostname, $argUsername, $argPassword, $argDatabasename); return $this->_connect($argHostname, $argUsername, $argPassword, $argDatabasename);
} }
function &MetaColumns($table) function &MetaColumns($table,$upper=true)
{ {
$this->_findschema($table,$schema); $this->_findschema($table,$schema);
if ($schema) { if ($schema) {

View File

@ -133,7 +133,7 @@ class accounts_sql
$data['account_lastname'] = $data['account_type'] == 'g' ? 'Group' : 'User'; $data['account_lastname'] = $data['account_type'] == 'g' ? 'Group' : 'User';
// if we call lang() before the translation-class is correctly setup, // if we call lang() before the translation-class is correctly setup,
// we can't switch away from english language anymore! // we can't switch away from english language anymore!
if ($GLOBALS['egw']->translation->lang_arr) if (translation::$lang_arr)
{ {
$data['account_lastname'] = lang($data['account_lastname']); $data['account_lastname'] = lang($data['account_lastname']);
} }

View File

@ -86,7 +86,7 @@ abstract class egw_framework
/** /**
* Constructor for static variables * Constructor for static variables
*/ */
public function init_static() public static function init_static()
{ {
self::$js_include_mgr = new egw_include_mgr(array( self::$js_include_mgr = new egw_include_mgr(array(
// allways load jquery (not -ui) and egw_json first // allways load jquery (not -ui) and egw_json first

View File

@ -54,9 +54,11 @@ class solink
* @param string $id2 id in $app2 * @param string $id2 id in $app2
* @param string $remark='' Remark to be saved with the link (defaults to '') * @param string $remark='' Remark to be saved with the link (defaults to '')
* @param int $owner=0 Owner of the link (defaults to user) * @param int $owner=0 Owner of the link (defaults to user)
* @return boolean/int False (for db or param-error) or link_id for success * @param int $lastmod=0 timestamp of last modification (defaults to now=time())
* @param int $no_notify=0 &1 dont notify $app1, &2 dont notify $app2
* @return int/boolean False (for db or param-error) or on success link_id (Please not the return-value of $id1)
*/ */
static function link( $app1,$id1,$app2,$id2,$remark='',$owner=0,$lastmod=0 ) static function link( $app1,&$id1,$app2,$id2='',$remark='',$owner=0,$lastmod=0,$no_notify=0 )
{ {
if (self::DEBUG) if (self::DEBUG)
{ {
@ -235,7 +237,7 @@ class solink
* @param boolean $hold_for_purge Don't really delete the link, just mark it as deleted and wait for final delete of linked entry * @param boolean $hold_for_purge Don't really delete the link, just mark it as deleted and wait for final delete of linked entry
* @return array with deleted links * @return array with deleted links
*/ */
static function &unlink($link_id,$app='',$id='',$owner=0,$app2='',$id2='',$hold_for_purge=false) static function unlink($link_id,$app='',$id='',$owner=0,$app2='',$id2='',$hold_for_purge=false)
{ {
if (self::DEBUG) if (self::DEBUG)
{ {

View File

@ -260,7 +260,7 @@ class translation
//$start = microtime(true); //$start = microtime(true);
// for loginscreen we have to use a instance specific cache! // for loginscreen we have to use a instance specific cache!
$instance_specific = in_array($app,self::$instance_specific_translations); $instance_specific = in_array($app,self::$instance_specific_translations);
$loaded =& egw_cache::getCache($instance_specific ? egw_cache::INSTANCE : egw_cache::TREE, $loaded = egw_cache::getCache($instance_specific ? egw_cache::INSTANCE : egw_cache::TREE,
__CLASS__,$app.':'.$lang); __CLASS__,$app.':'.$lang);
// do NOT use automatic callback to cache result, as installing languages in setup can create // do NOT use automatic callback to cache result, as installing languages in setup can create

View File

@ -17,7 +17,11 @@
* @version $Id$ * @version $Id$
*/ */
error_reporting(E_ALL & ~E_NOTICE); // E_STRICT in PHP 5.4 gives various strict warnings in working code, which can NOT be easy fixed in all use-cases :-(
// Only variables should be assigned by reference, eg. soetemplate::tree_walk()
// Declaration of <extended method> should be compatible with <parent method>, varios places where method parameters change
// --> switching it off for now, as it makes error-log unusable
error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT);
if (function_exists('get_magic_quotes_runtime') && get_magic_quotes_runtime()) if (function_exists('get_magic_quotes_runtime') && get_magic_quotes_runtime())
{ {
set_magic_quotes_runtime(false); set_magic_quotes_runtime(false);

View File

@ -629,7 +629,7 @@ egw.set_user('.$GLOBALS['egw']->accounts->json($GLOBALS['egw_info']['user']['acc
* @param array $apps * @param array $apps
* @return string * @return string
*/ */
function topmenu(array &$vars,array &$apps) function topmenu(array $vars,array $apps)
{ {
$this->tplsav2->menuitems = array(); $this->tplsav2->menuitems = array();
$this->tplsav2->menuinfoitems = array(); $this->tplsav2->menuinfoitems = array();

View File

@ -31,7 +31,7 @@ class jerryr_framework extends idots_framework
parent::__construct($template); parent::__construct($template);
} }
function topmenu(array &$vars,array &$apps) function topmenu(array $vars,array $apps)
{ {
$this->tplsav2->menuitems = array(); $this->tplsav2->menuitems = array();
$this->tplsav2->menuinfoitems = array(); $this->tplsav2->menuinfoitems = array();