Index: plugins/Dashboard/Dashboard.php =================================================================== --- plugins/Dashboard/Dashboard.php (revision 1269) +++ plugins/Dashboard/Dashboard.php (working copy) @@ -58,7 +58,7 @@ } catch(Zend_Db_Statement_Exception $e){ // mysql code error 1050:table already exists // see bug #153 http://dev.piwik.org/trac/ticket/153 - if(ereg('1050',$e->getMessage())) + if(preg_match('/1050/',$e->getMessage())) { return; } Index: plugins/ExampleFeedburner/ExampleFeedburner.php =================================================================== --- plugins/ExampleFeedburner/ExampleFeedburner.php (revision 1269) +++ plugins/ExampleFeedburner/ExampleFeedburner.php (working copy) @@ -29,7 +29,7 @@ } catch(Zend_Db_Statement_Exception $e){ // mysql code error 1060: column already exists // if there is another error we throw the exception, otherwise it is OK as we are simply reinstalling the plugin - if(!ereg('1060',$e->getMessage())) + if(!preg_match('/1060/',$e->getMessage())) { throw $e; } Index: plugins/Installation/Controller.php =================================================================== --- plugins/Installation/Controller.php (revision 1269) +++ plugins/Installation/Controller.php (working copy) @@ -136,7 +136,7 @@ Piwik::createDatabaseObject($dbInfos); } catch (Zend_Db_Adapter_Exception $e) { // database not found, we try to create it - if(ereg('[1049]',$e->getMessage() )) + if(preg_match('/[1049]/',$e->getMessage() )) { $dbInfosConnectOnly = $dbInfos; $dbInfosConnectOnly['dbname'] = null; @@ -489,7 +489,7 @@ { $gdInfo = gd_info(); $infos['gd_version'] = $gdInfo['GD Version']; - ereg ("([0-9]{1})", $gdInfo['GD Version'], $gdVersion); + preg_match ("/([0-9]{1})/", $gdInfo['GD Version'], $gdVersion); if($gdVersion[0] >= 2) { $infos['gd_ok'] = true; Index: plugins/CoreHome/templates/piwik_tag.tpl =================================================================== --- plugins/CoreHome/templates/piwik_tag.tpl (revision 1269) +++ plugins/CoreHome/templates/piwik_tag.tpl (working copy) @@ -1,4 +1,4 @@ -{if ereg('http://127.0.0.1|http://localhost|http://piwik.org', $url)} +{if preg_match('/http:\/\/127.0.0.1|http:\/\/localhost|http:\/\/piwik.org/', $url)}
{literal} Index: plugins/LanguagesManager/LanguagesManager.php =================================================================== --- plugins/LanguagesManager/LanguagesManager.php (revision 1269) +++ plugins/LanguagesManager/LanguagesManager.php (working copy) @@ -68,7 +68,7 @@ } catch(Zend_Db_Statement_Exception $e){ // mysql code error 1050:table already exists // see bug #153 http://dev.piwik.org/trac/ticket/153 - if(ereg('1050',$e->getMessage())) + if(preg_match('/1050/',$e->getMessage())) { return; } Index: core/Period/Range.php =================================================================== --- core/Period/Range.php (revision 1269) +++ core/Period/Range.php (working copy) @@ -112,7 +112,7 @@ } parent::generate(); - if(ereg('(last|previous)([0-9]*)', $this->strDate, $regs)) + if(preg_match('/(last|previous)([0-9]*)/', $this->strDate, $regs)) { $lastN = $regs[2]; $lastOrPrevious = $regs[1]; @@ -141,7 +141,7 @@ $startDate = $this->removePeriod($endDate, $lastN); } - elseif(ereg('([0-9]{4}-[0-9]{1,2}-[0-9]{1,2}),([0-9]{4}-[0-9]{1,2}-[0-9]{1,2})', $this->strDate, $regs)) + elseif(preg_match('/([0-9]{4}-[0-9]{1,2}-[0-9]{1,2}),([0-9]{4}-[0-9]{1,2}-[0-9]{1,2})/', $this->strDate, $regs)) { $strDateStart = $regs[1]; $strDateEnd = $regs[2]; Index: core/API/DocumentationGenerator.php =================================================================== --- core/API/DocumentationGenerator.php (revision 1269) +++ core/API/DocumentationGenerator.php (working copy) @@ -67,7 +67,10 @@ if($exampleUrl !== false) { $lastNUrls = ''; - if( ereg('(&period)|(&date)',$exampleUrl)) + /** + * @TODO TODO Somebody should check this regex with pregex + */ + if( preg_match('/(&period)|(&date)/',$exampleUrl)) { $exampleUrlRss1 = $prefixUrls . $this->getExampleUrl($class, $methodName, array('date' => 'last10') + $parametersToSet) ; $exampleUrlRss2 = $prefixUrls . $this->getExampleUrl($class, $methodName, array('date' => 'last5','period' => 'week',) + $parametersToSet ); Index: core/PluginsFunctions/Menu.php =================================================================== --- core/PluginsFunctions/Menu.php (revision 1269) +++ core/PluginsFunctions/Menu.php (working copy) @@ -165,8 +165,8 @@ // we want to move some submenus in the first position foreach($element as $nameSubmenu => $submenu) { - if(ereg('Evolution', $nameSubmenu) !== false - || ereg('Overview', $nameSubmenu) !== false) + if(preg_match('/Evolution/', $nameSubmenu) !== false + || preg_match('/Overview/', $nameSubmenu) !== false) { $newElement = array($nameSubmenu => $submenu); unset($element[$nameSubmenu]); Index: core/TablePartitioning.php =================================================================== --- core/TablePartitioning.php (revision 1269) +++ core/TablePartitioning.php (working copy) @@ -86,7 +86,7 @@ } } - protected function __toString() + public function __toString() { return $this->getTableName(); } Index: core/Archive.php =================================================================== --- core/Archive.php (revision 1269) +++ core/Archive.php (working copy) @@ -141,8 +141,8 @@ // if a period date string is detected: either 'last30', 'previous10' or 'YYYY-MM-DD,YYYY-MM-DD' elseif(is_string($strDate) && ( - ereg('^(last|previous){1}([0-9]*)$', $strDate, $regs) - || ereg('^([0-9]{4}-[0-9]{1,2}-[0-9]{1,2}),([0-9]{4}-[0-9]{1,2}-[0-9]{1,2})$', $strDate, $regs) + preg_match('/^(last|previous){1}([0-9]*)$/', $strDate, $regs) + || preg_match('/^([0-9]{4}-[0-9]{1,2}-[0-9]{1,2}),([0-9]{4}-[0-9]{1,2}-[0-9]{1,2})$/', $strDate, $regs) ) ) { Index: core/Piwik.php =================================================================== --- core/Piwik.php (revision 1269) +++ core/Piwik.php (working copy) @@ -85,7 +85,7 @@ $resultCheck = array(); foreach($directoriesToCheck as $directoryToCheck) { - if( !ereg('^'.preg_quote(PIWIK_INCLUDE_PATH), $directoryToCheck) ) + if( !preg_match('/^'.preg_quote(PIWIK_INCLUDE_PATH, '/').'/', $directoryToCheck) ) { $directoryToCheck = PIWIK_INCLUDE_PATH . $directoryToCheck; } @@ -1299,14 +1299,14 @@ $tablesAlreadyInstalled = self::getTablesInstalled(); $db = Zend_Registry::get('db'); - $doNotDeletePattern = "(".implode("|",$doNotDelete).")"; + $doNotDeletePattern = "/(".implode("|",$doNotDelete).")/"; foreach($tablesAlreadyInstalled as $tableName) { if( count($doNotDelete) == 0 || (!in_array($tableName,$doNotDelete) - && !ereg($doNotDeletePattern,$tableName) + && !preg_match($doNotDeletePattern,$tableName) ) ) { Index: libs/Event/Dispatcher.php =================================================================== --- libs/Event/Dispatcher.php (revision 1269) +++ libs/Event/Dispatcher.php (working copy) @@ -268,8 +268,12 @@ if ($pending === true) { $this->_pending[$nName][] =& $notification; } - $objClass = get_class($notification->getNotificationObject()); - + if ($notification!=null && $notification->getNotificationObject()!=null) { + $objClass = get_class($notification->getNotificationObject()); + } else { + $objClass = null; + } + // Find the registered observers if (isset($this->_ro[$nName])) { foreach (array_keys($this->_ro[$nName]) as $k) { Index: index.php =================================================================== --- index.php (revision 1269) +++ index.php (working copy) @@ -33,7 +33,9 @@ require_once "core/testMinimumPhpVersion.php"; // NOTE: the code above this comment must be PHP4 compatible +$oldErrorReporting = error_reporting(0); date_default_timezone_set(date_default_timezone_get()); +error_reporting($oldErrorReporting); if(!defined('PIWIK_ENABLE_ERROR_HANDLER') || PIWIK_ENABLE_ERROR_HANDLER) { Index: tests/core/Tracker/Action.test.php =================================================================== --- tests/core/Tracker/Action.test.php (revision 1269) +++ tests/core/Tracker/Action.test.php (working copy) @@ -84,6 +84,13 @@ 'url' => 'http://example.org/category/test///test wOw', 'type' => Piwik_Tracker_Action::TYPE_ACTION), ), + // testing: inclusion of zero values in action name + array ( + 'request'=>array( 'url' => "http://example.org/category/1/0/t/test"), + 'expected'=>array( 'name' => 'category/1/0/t/test', + 'url' => 'http://example.org/category/1/0/t/test', + 'type' => Piwik_Tracker_Action::TYPE_ACTION), + ), ); foreach($tests as $test) { $request = $test['request']; Index: config/global.ini.php =================================================================== --- config/global.ini.php (revision 1269) +++ config/global.ini.php (working copy) @@ -69,7 +69,7 @@ action_category_delimiter = / ; currency used by default when reporting money in Piwik -default_currency = "$" +default_currency = '$' ; if you want all your users to use Piwik in only one language, disable the LanguagesManager ; plugin, and set this default_language (users won't see the language drop down) @@ -103,7 +103,7 @@ ; email address that appears as a Sender in the password recovery email ; if specified, {DOMAIN} will be replaced by the current Piwik domain -login_password_recovery_email_address = "password-recovery@{DOMAIN}" +login_password_recovery_email_address = 'password-recovery@{DOMAIN}' ; name that appears as a Sender in the password recovery email login_password_recovery_email_name = Piwik @@ -142,7 +142,7 @@ ; However when most users have the same IP, and the same configuration, it is advised to set it to 0 enable_detect_unique_visitor_using_settings = 1 -; if set to 1, Piwik attempts a "best guess" at the visitor's country of +; if set to 1, Piwik attempts a 'best guess' at the visitor's country of ; origin when the preferred language tag omits region information. ; The mapping is defined in core/DataFiles/LanguageToCountry.php, enable_language_to_country_guess = 1