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-05-16 12:39:52 +00:00
parent 21cda45334
commit 0f42a2f916
15 changed files with 38 additions and 26 deletions

View File

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

View File

@ -738,7 +738,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
* @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'])) {
$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 $old
* @param int|string $receiver nummeric account_id or email address
* @return string
*/
function get_message($data,$old)
protected function get_message($data,$old,$receiver=null)
{
if (!$data['modified'] || !$old)
{
@ -194,9 +195,11 @@ class addressbook_tracking extends bo_tracking
*
* @param array $data
* @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
*/
function get_subject($data,$old)
protected function get_subject($data,$old,$deleted=null,$receiver=null)
{
if ($data['is_contactform'])
{
@ -208,11 +211,11 @@ class addressbook_tracking extends bo_tracking
/**
* 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'
*/
function get_details($data)
function get_details($data,$receiver=null)
{
foreach($this->contacts->contact_fields as $name => $label)
{

View File

@ -1463,7 +1463,8 @@ abstract class bo_merge
foreach($files as $file)
{
// 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;
$list[$prefix.$file['name']] = egw_vfs::decodePath($file['name']);
}
@ -1525,7 +1526,8 @@ abstract class bo_merge
foreach($files as $key => $file)
{
// 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
$file['path'] === $default_doc) // default doc already added
{

View File

@ -420,7 +420,7 @@ class soetemplate
{
$lang = $name['lang'];
}
if ($lang == 'default' || $name['lang'] == 'default')
if ($lang == 'default')
{
$where[] = '(et_lang='.$this->db->quote($pref_lang)." OR et_lang='')";
}

View File

@ -195,7 +195,8 @@ class vfs_widget
}
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['type'] = 'hbox';

View File

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

View File

@ -675,9 +675,9 @@ class infolog_ui
}
if (!$action)
{
$action = $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_title = $values['action_title'] ? $values['action_title'] : get_var('action_title',array('POST','GET'));
$action = is_array($values) && $values['action'] ? $values['action'] : get_var('action',array('POST','GET'));
$action_id = is_array($values) && $values['action_id'] ? $values['action_id'] : get_var('action_id',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);
if (!is_array($values))

View File

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

View File

@ -132,7 +132,7 @@ class accounts_sql
$data['account_lastname'] = $data['account_type'] == 'g' ? 'Group' : 'User';
// if we call lang() before the translation-class is correctly setup,
// 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']);
}

View File

@ -54,9 +54,11 @@ class solink
* @param string $id2 id in $app2
* @param string $remark='' Remark to be saved with the link (defaults to '')
* @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)
{
@ -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
* @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)
{

View File

@ -260,7 +260,7 @@ class translation
//$start = microtime(true);
// for loginscreen we have to use a instance specific cache!
$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);
// do NOT use automatic callback to cache result, as installing languages in setup can create

View File

@ -17,7 +17,11 @@
* @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())
{
set_magic_quotes_runtime(false);

View File

@ -630,7 +630,7 @@ class idots_framework extends egw_framework
* @param array $apps
* @return string
*/
function topmenu(array &$vars,array &$apps)
function topmenu(array $vars,array $apps)
{
$this->tplsav2->menuitems = array();
$this->tplsav2->menuinfoitems = array();

View File

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