diff --git a/lib/action/sfAction.class.php b/lib/action/sfAction.class.php index f796cd30d..14b0223d4 100644 --- a/lib/action/sfAction.class.php +++ b/lib/action/sfAction.class.php @@ -404,7 +404,7 @@ public function setSecurityConfiguration($security) */ public function getSecurityValue($name, $default = null) { - $actionName = strtolower($this->getActionName()); + $actionName = strtolower((string) $this->getActionName()); if (isset($this->security[$actionName][$name])) { @@ -517,7 +517,7 @@ public function getLayout() */ public function setViewClass($class) { - sfConfig::set('mod_'.strtolower($this->getModuleName()).'_view_class', $class); + sfConfig::set('mod_'.strtolower((string) $this->getModuleName()).'_view_class', $class); } /** diff --git a/lib/autoload/sfAutoload.class.php b/lib/autoload/sfAutoload.class.php index 5f68f8039..982822ca4 100644 --- a/lib/autoload/sfAutoload.class.php +++ b/lib/autoload/sfAutoload.class.php @@ -83,7 +83,7 @@ static public function unregister() */ public function setClassPath($class, $path) { - $class = strtolower($class); + $class = strtolower((string) $class); $this->overriden[$class] = $path; @@ -99,7 +99,7 @@ public function setClassPath($class, $path) */ public function getClassPath($class) { - $class = strtolower($class); + $class = strtolower((string) $class); return isset($this->classes[$class]) ? $this->classes[$class] : null; } @@ -185,7 +185,7 @@ public function autoload($class) */ public function loadClass($class) { - $class = strtolower($class); + $class = strtolower((string) $class); // class already exists if (class_exists($class, false) || interface_exists($class, false) || (function_exists('trait_exists') && trait_exists($class, false))) diff --git a/lib/autoload/sfCoreAutoload.class.php b/lib/autoload/sfCoreAutoload.class.php index ff6dfce1b..c92e9ba89 100755 --- a/lib/autoload/sfCoreAutoload.class.php +++ b/lib/autoload/sfCoreAutoload.class.php @@ -116,7 +116,7 @@ public function autoload($class) */ public function getClassPath($class) { - $class = strtolower($class); + $class = strtolower((string) $class); if (!isset($this->classes[$class])) { @@ -169,7 +169,7 @@ static public function make() || false !== stripos($contents, 'interface '.$class) || false !== stripos($contents, 'trait '.$class)) { - $classes .= sprintf(" '%s' => '%s',\n", strtolower($class), substr(str_replace($libDir, '', $file), 1)); + $classes .= sprintf(" '%s' => '%s',\n", strtolower((string) $class), substr(str_replace($libDir, '', $file), 1)); } } diff --git a/lib/autoload/sfSimpleAutoload.class.php b/lib/autoload/sfSimpleAutoload.class.php index 66ff5c1b4..8b44a7cbb 100755 --- a/lib/autoload/sfSimpleAutoload.class.php +++ b/lib/autoload/sfSimpleAutoload.class.php @@ -109,7 +109,7 @@ static public function unregister() */ public function autoload($class) { - $class = strtolower($class); + $class = strtolower((string) $class); // class already exists if (class_exists($class, false) || interface_exists($class, false)) @@ -291,7 +291,7 @@ public function addFile($file, $register = true) preg_match_all('~^\s*(?:abstract\s+|final\s+)?(?:class|interface|trait)\s+(\w+)~mi', file_get_contents($file), $classes); foreach ($classes[1] as $class) { - $this->classes[strtolower($class)] = $file; + $this->classes[strtolower((string) $class)] = $file; } } @@ -303,7 +303,7 @@ public function addFile($file, $register = true) */ public function setClassPath($class, $path) { - $class = strtolower($class); + $class = strtolower((string) $class); $this->overriden[$class] = $path; @@ -319,7 +319,7 @@ public function setClassPath($class, $path) */ public function getClassPath($class) { - $class = strtolower($class); + $class = strtolower((string) $class); return isset($this->classes[$class]) ? $this->classes[$class] : null; } diff --git a/lib/config/sfAutoloadConfigHandler.class.php b/lib/config/sfAutoloadConfigHandler.class.php index 9132e5ce1..3b14b64f5 100755 --- a/lib/config/sfAutoloadConfigHandler.class.php +++ b/lib/config/sfAutoloadConfigHandler.class.php @@ -82,7 +82,7 @@ protected function parse(array $configFiles) // file mapping foreach ($entry['files'] as $class => $file) { - $mapping[strtolower($class)] = $file; + $mapping[strtolower((string) $class)] = $file; } } else @@ -140,7 +140,7 @@ static public function parseFile($path, $file, $prefix) } } - $mapping[$localPrefix.strtolower($class)] = $file; + $mapping[$localPrefix.strtolower((string) $class)] = $file; } return $mapping; diff --git a/lib/config/sfDefineEnvironmentConfigHandler.class.php b/lib/config/sfDefineEnvironmentConfigHandler.class.php index 224dc2525..84ebeeac0 100644 --- a/lib/config/sfDefineEnvironmentConfigHandler.class.php +++ b/lib/config/sfDefineEnvironmentConfigHandler.class.php @@ -30,14 +30,14 @@ class sfDefineEnvironmentConfigHandler extends sfYamlConfigHandler public function execute($configFiles) { // get our prefix - $prefix = strtolower($this->getParameterHolder()->get('prefix', '')); + $prefix = strtolower((string) $this->getParameterHolder()->get('prefix', '')); // add module prefix if needed if ($this->getParameterHolder()->get('module', false)) { $wildcardValues = $this->getParameterHolder()->get('wildcardValues'); // either the module name is in wildcard values, or it needs to be inserted on runtime - $moduleName = $wildcardValues ? strtolower($wildcardValues[0]) : "'.strtolower(\$moduleName).'"; + $moduleName = $wildcardValues ? strtolower((string) $wildcardValues[0]) : "'.strtolower(\$moduleName).'"; $prefix .= $moduleName."_"; } @@ -82,7 +82,7 @@ protected function getValues($prefix, $category, $keys) { if (!is_array($keys)) { - list($key, $value) = $this->fixCategoryValue($prefix.strtolower($category), '', $keys); + list($key, $value) = $this->fixCategoryValue($prefix.strtolower((string) $category), '', $keys); return array($key => $value); } diff --git a/lib/controller/sfController.class.php b/lib/controller/sfController.class.php index 6b69b857d..c2cef1684 100644 --- a/lib/controller/sfController.class.php +++ b/lib/controller/sfController.class.php @@ -108,8 +108,8 @@ protected function controllerExists($moduleName, $controllerName, $extension, $t $this->context->getConfigCache()->import('modules/'.$moduleName.'/config/generator.yml', false, true); // one action per file or one file for all actions - $classFile = strtolower($extension); - $classSuffix = ucfirst(strtolower($extension)); + $classFile = strtolower((string) $extension); + $classSuffix = ucfirst(strtolower((string) $extension)); $file = $dir.'/'.$controllerName.$classSuffix.'.class.php'; if (is_readable($file)) { @@ -208,15 +208,15 @@ public function forward($moduleName, $actionName) $this->getActionStack()->addEntry($moduleName, $actionName, $actionInstance); // include module configuration - $viewClass = sfConfig::get('mod_'.strtolower($moduleName).'_view_class', false); + $viewClass = sfConfig::get('mod_'.strtolower((string) $moduleName).'_view_class', false); require($this->context->getConfigCache()->checkConfig('modules/'.$moduleName.'/config/module.yml')); if (false !== $viewClass) { - sfConfig::set('mod_'.strtolower($moduleName).'_view_class', $viewClass); + sfConfig::set('mod_'.strtolower((string) $moduleName).'_view_class', $viewClass); } // module enabled? - if (sfConfig::get('mod_'.strtolower($moduleName).'_enabled')) + if (sfConfig::get('mod_'.strtolower((string) $moduleName).'_enabled')) { // check for a module config.php $moduleConfig = sfConfig::get('sf_app_module_dir').'/'.$moduleName.'/config/config.php'; @@ -296,7 +296,7 @@ public function getComponent($moduleName, $componentName) */ protected function getController($moduleName, $controllerName, $extension) { - $classSuffix = ucfirst(strtolower($extension)); + $classSuffix = ucfirst(strtolower((string) $extension)); if (!isset($this->controllerClasses[$moduleName.'_'.$controllerName.'_'.$classSuffix])) { if (!$this->controllerExists($moduleName, $controllerName, $extension, true)) @@ -371,7 +371,7 @@ public function getView($moduleName, $actionName, $viewName) else { // view class (as configured in module.yml or defined in action) - $class = sfConfig::get('mod_'.strtolower($moduleName).'_view_class', 'sfPHP').'View'; + $class = sfConfig::get('mod_'.strtolower((string) $moduleName).'_view_class', 'sfPHP').'View'; } return new $class($this->context, $moduleName, $actionName, $viewName); @@ -411,8 +411,8 @@ public function getPresentationFor($module, $action, $viewName = null) // set viewName if needed if ($viewName) { - $currentViewName = sfConfig::get('mod_'.strtolower($module).'_view_class'); - sfConfig::set('mod_'.strtolower($module).'_view_class', $viewName); + $currentViewName = sfConfig::get('mod_'.strtolower((string) $module).'_view_class'); + sfConfig::set('mod_'.strtolower((string) $module).'_view_class', $viewName); } try @@ -428,7 +428,7 @@ public function getPresentationFor($module, $action, $viewName = null) // remove viewName if ($viewName) { - sfConfig::set('mod_'.strtolower($module).'_view_class', $currentViewName); + sfConfig::set('mod_'.strtolower((string) $module).'_view_class', $currentViewName); } throw $e; @@ -462,7 +462,7 @@ public function getPresentationFor($module, $action, $viewName = null) // remove viewName if ($viewName) { - sfConfig::set('mod_'.strtolower($module).'_view_class', $currentViewName); + sfConfig::set('mod_'.strtolower((string) $module).'_view_class', $currentViewName); } return $presentation; diff --git a/lib/debug/sfWebDebugPanelConfig.class.php b/lib/debug/sfWebDebugPanelConfig.class.php index 5e212203b..8ff8645ed 100644 --- a/lib/debug/sfWebDebugPanelConfig.class.php +++ b/lib/debug/sfWebDebugPanelConfig.class.php @@ -71,7 +71,7 @@ public function getPanelContent() */ protected function formatArrayAsHtml($id, $values) { - $id = ucfirst(strtolower($id)); + $id = ucfirst(strtolower((string) $id)); return '

'.$id.' '.$this->getToggler('sfWebDebug'.$id).'

diff --git a/lib/form/sfForm.class.php b/lib/form/sfForm.class.php index 2db45bbde..c23b133bf 100644 --- a/lib/form/sfForm.class.php +++ b/lib/form/sfForm.class.php @@ -1035,7 +1035,7 @@ public function isMultipart() public function renderFormTag($url, array $attributes = array()) { $attributes['action'] = $url; - $attributes['method'] = isset($attributes['method']) ? strtolower($attributes['method']) : 'post'; + $attributes['method'] = isset($attributes['method']) ? strtolower((string) $attributes['method']) : 'post'; if ($this->isMultipart()) { $attributes['enctype'] = 'multipart/form-data'; diff --git a/lib/helper/PartialHelper.php b/lib/helper/PartialHelper.php index e20d0b9c2..78aa5ecb2 100644 --- a/lib/helper/PartialHelper.php +++ b/lib/helper/PartialHelper.php @@ -84,7 +84,7 @@ function has_component_slot($name) { return false; } - + // check to see if component slot is empty (null) if ($viewInstance->getComponentSlot($name)) { @@ -138,7 +138,7 @@ function get_component($moduleName, $componentName, $vars = array()) require($context->getConfigCache()->checkConfig('modules/'.$moduleName.'/config/module.yml')); - $class = sfConfig::get('mod_'.strtolower($moduleName).'_partial_view_class', 'sf').'PartialView'; + $class = sfConfig::get('mod_'.strtolower((string) $moduleName).'_partial_view_class', 'sf').'PartialView'; $view = new $class($context, $moduleName, $actionName, ''); $view->setPartialVars(true === sfConfig::get('sf_escaping_strategy') ? sfOutputEscaper::unescape($vars) : $vars); @@ -213,7 +213,7 @@ function get_partial($templateName, $vars = array()) } $actionName = '_'.$templateName; - $class = sfConfig::get('mod_'.strtolower($moduleName).'_partial_view_class', 'sf').'PartialView'; + $class = sfConfig::get('mod_'.strtolower((string) $moduleName).'_partial_view_class', 'sf').'PartialView'; $view = new $class($context, $moduleName, $actionName, ''); $view->setPartialVars(true === sfConfig::get('sf_escaping_strategy') ? sfOutputEscaper::unescape($vars) : $vars); diff --git a/lib/helper/TextHelper.php b/lib/helper/TextHelper.php index 5109b7798..ee6e2e57b 100644 --- a/lib/helper/TextHelper.php +++ b/lib/helper/TextHelper.php @@ -155,7 +155,7 @@ function excerpt_text($text, $phrase, $radius = 100, $excerpt_string = '...', $e $strtolower = ($mbstring) ? 'mb_strtolower' : 'strtolower'; $substr = ($mbstring) ? 'mb_substr' : 'substr'; - $found_pos = $strpos($strtolower($text), $strtolower($phrase)); + $found_pos = $strpos($strtolower((string) $text), $strtolower((string) $phrase)); $return_string = ''; if ($found_pos !== false) { diff --git a/lib/helper/UrlHelper.php b/lib/helper/UrlHelper.php index de61246d2..1b11a9154 100644 --- a/lib/helper/UrlHelper.php +++ b/lib/helper/UrlHelper.php @@ -438,7 +438,7 @@ function form_tag($url_for_options = '', $options = array()) $html_options = $options; - $html_options['method'] = isset($html_options['method']) ? strtolower($html_options['method']) : 'post'; + $html_options['method'] = isset($html_options['method']) ? strtolower((string) $html_options['method']) : 'post'; if (_get_option($html_options, 'multipart')) { @@ -496,7 +496,7 @@ function mail_to($email, $name = '', $options = array(), $default_value = array( $default = array(); foreach ($default_tmp as $key => $value) { - $default[] = urlencode($key).'='.urlencode($value); + $default[] = urlencode((string) $key).'='.urlencode((string) $value); } $options = count($default) ? '?'.implode('&', $default) : ''; @@ -605,10 +605,10 @@ function _method_javascript_function($method) { $function = "var f = document.createElement('form'); f.style.display = 'none'; this.parentNode.appendChild(f); f.method = 'post'; f.action = this.href;"; - if ('post' != strtolower($method)) + if ('post' != strtolower((string) $method)) { $function .= "var m = document.createElement('input'); m.setAttribute('type', 'hidden'); "; - $function .= sprintf("m.setAttribute('name', 'sf_method'); m.setAttribute('value', '%s'); f.appendChild(m);", strtolower($method)); + $function .= sprintf("m.setAttribute('name', 'sf_method'); m.setAttribute('value', '%s'); f.appendChild(m);", strtolower((string) $method)); } // CSRF protection diff --git a/lib/i18n/sfNumberFormat.class.php b/lib/i18n/sfNumberFormat.class.php index bcf948d55..c84023349 100644 --- a/lib/i18n/sfNumberFormat.class.php +++ b/lib/i18n/sfNumberFormat.class.php @@ -116,7 +116,7 @@ function format($number, $pattern = 'd', $currency = 'USD', $charset = 'UTF-8') { $this->setPattern($pattern); - if (strtolower($pattern) == 'p') + if (strtolower((string) $pattern) == 'p') { $number *= 100; } diff --git a/lib/mailer/sfMailer.class.php b/lib/mailer/sfMailer.class.php index 86afba3e3..c688eb6e3 100755 --- a/lib/mailer/sfMailer.class.php +++ b/lib/mailer/sfMailer.class.php @@ -94,7 +94,7 @@ public function __construct(sfEventDispatcher $dispatcher, $options) { foreach ($transport->getExtensionHandlers() as $handler) { - if (in_array(strtolower($method), array_map('strtolower', (array) $handler->exposeMixinMethods()))) + if (in_array(strtolower((string) $method), array_map('strtolower', (array) $handler->exposeMixinMethods()))) { $transport->$method($value); } diff --git a/lib/plugin/sfPearRestPlugin.class.php b/lib/plugin/sfPearRestPlugin.class.php index 74b9dbabf..16f04a9f7 100644 --- a/lib/plugin/sfPearRestPlugin.class.php +++ b/lib/plugin/sfPearRestPlugin.class.php @@ -3,7 +3,7 @@ /* * This file is part of the symfony package. * (c) Fabien Potencier - * + * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ @@ -86,7 +86,7 @@ public function getPluginLicense($plugin, $version) if (PEAR::isError($info)) { - throw new sfPluginRestException(sprintf('Unable to get plugin licence information for plugin "%s": %s', $plugin, $info->getMessage())); + throw new sfPluginRestException(sprintf('Unable to get plugin licence information for plugin "%s": %s', $plugin, $info->getMessage())); } if (null === $info) @@ -113,7 +113,7 @@ public function getPluginLicense($plugin, $version) */ public function getPluginVersions($plugin, $stability = null) { - $allreleases = $this->_rest->retrieveData($this->restBase.'r/'.strtolower($plugin).'/allreleases.xml'); + $allreleases = $this->_rest->retrieveData($this->restBase.'r/'.strtolower((string) $plugin).'/allreleases.xml'); if (PEAR::isError($allreleases)) { throw new sfPluginRestException(sprintf('Unable to get information for plugin "%s": %s', $plugin, $allreleases->getMessage())); @@ -159,7 +159,7 @@ public function getPluginVersions($plugin, $stability = null) */ public function getPluginDependencies($plugin, $version) { - $dependencies = $this->_rest->retrieveData($this->restBase.'r/'.strtolower($plugin).'/deps.'.$version.'.txt'); + $dependencies = $this->_rest->retrieveData($this->restBase.'r/'.strtolower((string) $plugin).'/deps.'.$version.'.txt'); if (PEAR::isError($dependencies)) { throw new sfPluginRestException(sprintf('Unable to get dependencies information for plugin "%s": %s', $plugin, $dependencies->getMessage())); diff --git a/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/admin/parts/sortingAction.php b/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/admin/parts/sortingAction.php index 937859a38..32e5c8158 100644 --- a/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/admin/parts/sortingAction.php +++ b/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/admin/parts/sortingAction.php @@ -5,7 +5,7 @@ protected function addSortQuery($query) return; } - if (!in_array(strtolower($sort[1]), array('asc', 'desc'))) + if (!in_array(strtolower((string) $sort[1]), array('asc', 'desc'))) { $sort[1] = 'asc'; } diff --git a/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/admin/template/templates/_filters.php b/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/admin/template/templates/_filters.php index b8259edb3..7530bd7b6 100644 --- a/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/admin/template/templates/_filters.php +++ b/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/admin/template/templates/_filters.php @@ -27,7 +27,7 @@ 'help' => $field->getConfig('help'), 'form' => $form, 'field' => $field, - 'class' => 'sf_admin_form_row sf_admin_'.strtolower($field->getType()).' sf_admin_filter_field_'.$name, + 'class' => 'sf_admin_form_row sf_admin_'.strtolower((string) $field->getType()).' sf_admin_filter_field_'.$name, )) ?] [?php endforeach; ?] diff --git a/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/admin/template/templates/_form_fieldset.php b/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/admin/template/templates/_form_fieldset.php index ae30a30e6..093e47e1f 100644 --- a/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/admin/template/templates/_form_fieldset.php +++ b/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/admin/template/templates/_form_fieldset.php @@ -1,4 +1,4 @@ -
+
[?php if ('NONE' != $fieldset): ?]

[?php echo __($fieldset, array(), 'getI18nCatalogue() ?>') ?]

[?php endif; ?] @@ -12,7 +12,7 @@ 'help' => $field->getConfig('help'), 'form' => $form, 'field' => $field, - 'class' => 'sf_admin_form_row sf_admin_'.strtolower($field->getType()).' sf_admin_form_field_'.$name, + 'class' => 'sf_admin_form_row sf_admin_'.strtolower((string) $field->getType()).' sf_admin_form_field_'.$name, )) ?] [?php endforeach; ?]
diff --git a/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/admin/template/templates/_list_td_tabular.php b/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/admin/template/templates/_list_td_tabular.php index 4d56b50ef..97b003466 100644 --- a/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/admin/template/templates/_list_td_tabular.php +++ b/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/admin/template/templates/_list_td_tabular.php @@ -5,5 +5,5 @@ EOF -, strtolower($field->getType()), $name, $this->renderField($field)), $field->getConfig()) ?> +, strtolower((string) $field->getType()), $name, $this->renderField($field)), $field->getConfig()) ?> diff --git a/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/admin/template/templates/_list_th_tabular.php b/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/admin/template/templates/_list_th_tabular.php index 298b900ee..7e8c13b4c 100644 --- a/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/admin/template/templates/_list_th_tabular.php +++ b/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/admin/template/templates/_list_th_tabular.php @@ -1,6 +1,6 @@ configuration->getValue('list.display') as $name => $field): ?> [?php slot('sf_admin.current_header') ?] - + isReal()): ?> [?php if ('' == $sort[0]): ?] [?php echo link_to(__('getConfig('label', '', true) ?>', array(), 'getI18nCatalogue() ?>'), '@getUrlForAction('list') ?>', array('query_string' => 'sort=&sort_type='.($sort[1] == 'asc' ? 'desc' : 'asc'))) ?] diff --git a/lib/plugins/sfDoctrinePlugin/lib/generator/sfDoctrineColumn.class.php b/lib/plugins/sfDoctrinePlugin/lib/generator/sfDoctrineColumn.class.php index f693ebb55..a7ef82e15 100644 --- a/lib/plugins/sfDoctrinePlugin/lib/generator/sfDoctrineColumn.class.php +++ b/lib/plugins/sfDoctrinePlugin/lib/generator/sfDoctrineColumn.class.php @@ -203,7 +203,7 @@ public function getRelationKey($key) { $local = (array) $relation['local']; $local = array_map('strtolower', $local); - if (in_array(strtolower($this->name), $local)) + if (in_array(strtolower((string) $this->name), $local)) { return $relation[$key]; } @@ -268,7 +268,7 @@ public function isForeignKey() { $local = (array) $relation['local']; $local = array_map('strtolower', $local); - if (in_array(strtolower($this->name), $local)) + if (in_array(strtolower((string) $this->name), $local)) { $this->foreignClassName = $relation['class']; if ($relation->getType() === Doctrine_Relation::ONE) diff --git a/lib/plugins/sfDoctrinePlugin/lib/record/sfDoctrineRecord.class.php b/lib/plugins/sfDoctrinePlugin/lib/record/sfDoctrineRecord.class.php index c281b3358..9c0ea8086 100644 --- a/lib/plugins/sfDoctrinePlugin/lib/record/sfDoctrineRecord.class.php +++ b/lib/plugins/sfDoctrinePlugin/lib/record/sfDoctrineRecord.class.php @@ -152,7 +152,7 @@ public function __call($method, $arguments) } else if ($table->hasField($fieldName = $table->getFieldName($name))) { - $entityNameLower = strtolower($fieldName); + $entityNameLower = strtolower((string) $fieldName); if ($table->hasField($entityNameLower)) { $entityName = $entityNameLower; @@ -166,11 +166,11 @@ public function __call($method, $arguments) if ($table->hasField($underScored) || $table->hasRelation($underScored)) { $entityName = $underScored; - } else if ($table->hasField(strtolower($name)) || $table->hasRelation(strtolower($name))) { - $entityName = strtolower($name); + } else if ($table->hasField(strtolower((string) $name)) || $table->hasRelation(strtolower((string) $name))) { + $entityName = strtolower((string) $name); } else { $camelCase = $table->getFieldName(sfInflector::camelize($name)); - $camelCase = strtolower($camelCase[0]).substr($camelCase, 1, strlen($camelCase)); + $camelCase = strtolower((string) $camelCase[0]).substr($camelCase, 1, strlen($camelCase)); if ($table->hasField($camelCase) || $table->hasRelation($camelCase)) { $entityName = $camelCase; diff --git a/lib/plugins/sfDoctrinePlugin/lib/task/sfDoctrineCompileTask.class.php b/lib/plugins/sfDoctrinePlugin/lib/task/sfDoctrineCompileTask.class.php index 11a9224e6..c2054d397 100644 --- a/lib/plugins/sfDoctrinePlugin/lib/task/sfDoctrineCompileTask.class.php +++ b/lib/plugins/sfDoctrinePlugin/lib/task/sfDoctrineCompileTask.class.php @@ -66,7 +66,7 @@ protected function execute($arguments = array(), $options = array()) $drivers = array(); foreach ($databaseManager->getNames() as $name) { - $drivers[] = strtolower($databaseManager->getDatabase($name)->getDoctrineConnection()->getDriverName()); + $drivers[] = strtolower((string) $databaseManager->getDatabase($name)->getDoctrineConnection()->getDriverName()); } $drivers = array_unique($drivers); diff --git a/lib/request/sfWebRequest.class.php b/lib/request/sfWebRequest.class.php index 99f8616e3..b46e2e5b9 100644 --- a/lib/request/sfWebRequest.class.php +++ b/lib/request/sfWebRequest.class.php @@ -507,7 +507,7 @@ public function getLanguages() { if ($i == 0) { - $lang = strtolower($codes[0]); + $lang = strtolower((string) $codes[0]); } else { @@ -638,9 +638,9 @@ public function isSecure() $pathArray = $this->getPathInfoArray(); return - (isset($pathArray['HTTPS']) && (('on' == strtolower($pathArray['HTTPS']) || 1 == $pathArray['HTTPS']))) + (isset($pathArray['HTTPS']) && (('on' == strtolower((string) $pathArray['HTTPS']) || 1 == $pathArray['HTTPS']))) || - ($this->getOption('trust_proxy') && isset($pathArray['HTTP_SSL_HTTPS']) && (('on' == strtolower($pathArray['HTTP_SSL_HTTPS']) || 1 == $pathArray['HTTP_SSL_HTTPS']))) + ($this->getOption('trust_proxy') && isset($pathArray['HTTP_SSL_HTTPS']) && (('on' == strtolower((string) $pathArray['HTTP_SSL_HTTPS']) || 1 == $pathArray['HTTP_SSL_HTTPS']))) || ($this->getOption('trust_proxy') && $this->isForwardedSecure()) ; @@ -655,7 +655,7 @@ protected function isForwardedSecure() { $pathArray = $this->getPathInfoArray(); - return isset($pathArray['HTTP_X_FORWARDED_PROTO']) && 'https' == strtolower($pathArray['HTTP_X_FORWARDED_PROTO']); + return isset($pathArray['HTTP_X_FORWARDED_PROTO']) && 'https' == strtolower((string) $pathArray['HTTP_X_FORWARDED_PROTO']); } /** diff --git a/lib/response/sfWebResponse.class.php b/lib/response/sfWebResponse.class.php index 3bdc87639..786b67046 100644 --- a/lib/response/sfWebResponse.class.php +++ b/lib/response/sfWebResponse.class.php @@ -413,7 +413,7 @@ public function send() */ protected function normalizeHeaderName($name) { - return strtr(ucwords(strtr(strtolower($name), array('_' => ' ', '-' => ' '))), array(' ' => '-')); + return strtr(ucwords(strtr(strtolower((string) $name), array('_' => ' ', '-' => ' '))), array(' ' => '-')); } /** @@ -426,7 +426,7 @@ protected function normalizeHeaderName($name) */ static public function getDate($timestamp, $type = 'rfc1123') { - $type = strtolower($type); + $type = strtolower((string) $type); if ($type == 'rfc1123') { @@ -486,7 +486,7 @@ public function addCacheControlHttpHeader($name, $value = null) $currentHeaders[$tmp[0]] = isset($tmp[1]) ? $tmp[1] : null; } } - $currentHeaders[str_replace('_', '-', strtolower($name))] = $value; + $currentHeaders[str_replace('_', '-', strtolower((string) $name))] = $value; $headers = array(); foreach ($currentHeaders as $key => $value) @@ -561,7 +561,7 @@ public function getMetas() */ public function addMeta($key, $value, $replace = true, $escape = true) { - $key = strtolower($key); + $key = strtolower((string) $key); if (null === $value) { diff --git a/lib/routing/sfRequestRoute.class.php b/lib/routing/sfRequestRoute.class.php index db3056fa5..4913500e0 100644 --- a/lib/routing/sfRequestRoute.class.php +++ b/lib/routing/sfRequestRoute.class.php @@ -57,7 +57,7 @@ public function matchesUrl($url, $context = array()) } // enforce the sf_method requirement - if (in_array(strtolower($context['method']), $this->requirements['sf_method'])) + if (in_array(strtolower((string) $context['method']), $this->requirements['sf_method'])) { return $parameters; } @@ -78,7 +78,7 @@ public function matchesParameters($params, $context = array()) if (isset($params['sf_method'])) { // enforce the sf_method requirement - if (!in_array(strtolower($params['sf_method']), $this->requirements['sf_method'])) + if (!in_array(strtolower((string) $params['sf_method']), $this->requirements['sf_method'])) { return false; } diff --git a/lib/routing/sfRoute.class.php b/lib/routing/sfRoute.class.php index f8a6ea7a5..d6c5c2b17 100644 --- a/lib/routing/sfRoute.class.php +++ b/lib/routing/sfRoute.class.php @@ -237,7 +237,7 @@ public function generate($params, $context = array(), $absolute = false) uasort($variables, array('sfRoute', 'generateCompareVarsByStrlen')); foreach ($variables as $variable => $value) { - $url = str_replace($value, urlencode($tparams[$variable]), $url); + $url = str_replace($value, urlencode((string) $tparams[$variable]), $url); } if(!in_array($this->suffix, $this->options['segment_separators'])) @@ -286,7 +286,7 @@ protected function generateWithTokens($parameters) case 'variable': if (!$optional || !isset($this->defaults[$token[3]]) || (isset($parameters[$token[3]]) && $parameters[$token[3]] != $this->defaults[$token[3]])) { - $url[] = urlencode($parameters[$token[3]]); + $url[] = urlencode((string) $parameters[$token[3]]); $optional = false; } break; @@ -753,12 +753,12 @@ protected function generateStarParameter($url, $defaults, $parameters) { foreach ($value as $v) { - $tmp[] = $key.'='.urlencode($v); + $tmp[] = $key.'='.urlencode((string) $v); } } else { - $tmp[] = urlencode($key).'/'.urlencode($value); + $tmp[] = urlencode((string) $key).'/'.urlencode((string) $value); } } $tmp = implode('/', $tmp); diff --git a/lib/service/sfServiceContainer.class.php b/lib/service/sfServiceContainer.class.php index 35c5b70f6..d2fad8a01 100644 --- a/lib/service/sfServiceContainer.class.php +++ b/lib/service/sfServiceContainer.class.php @@ -70,7 +70,7 @@ public function setParameters(array $parameters) $this->parameters = array(); foreach ($parameters as $key => $value) { - $this->parameters[strtolower($key)] = $value; + $this->parameters[strtolower((string) $key)] = $value; } } @@ -107,7 +107,7 @@ public function getParameter($name) { if ($this->hasParameter($name)) { - return $this->parameters[strtolower($name)]; + return $this->parameters[strtolower((string) $name)]; } if (sfConfig::has($name)) @@ -126,7 +126,7 @@ public function getParameter($name) */ public function setParameter($name, $value) { - $this->parameters[strtolower($name)] = $value; + $this->parameters[strtolower((string) $name)] = $value; } /** @@ -138,7 +138,7 @@ public function setParameter($name, $value) */ public function hasParameter($name) { - return array_key_exists(strtolower($name), $this->parameters); + return array_key_exists(strtolower((string) $name), $this->parameters); } /** diff --git a/lib/service/sfServiceContainerDumperPhp.class.php b/lib/service/sfServiceContainerDumperPhp.class.php index 88095c7ce..b13b1e4fc 100644 --- a/lib/service/sfServiceContainerDumperPhp.class.php +++ b/lib/service/sfServiceContainerDumperPhp.class.php @@ -339,7 +339,7 @@ protected function dumpValue($value) } elseif (is_object($value) && $value instanceof sfServiceParameter) { - return sprintf("\$this->getParameter('%s')", strtolower($value)); + return sprintf("\$this->getParameter('%s')", strtolower((string) $value)); } elseif (is_string($value)) { @@ -347,7 +347,7 @@ protected function dumpValue($value) { // we do this to deal with non string values (boolean, integer, ...) // the preg_replace_callback converts them to strings - return sprintf("\$this->getParameter('%s')", strtolower($match[1])); + return sprintf("\$this->getParameter('%s')", strtolower((string) $match[1])); } else { @@ -371,7 +371,7 @@ protected function dumpValue($value) public function replaceParameter($match) { - return sprintf("'.\$this->getParameter('%s').'", strtolower($match[2])); + return sprintf("'.\$this->getParameter('%s').'", strtolower((string) $match[2])); } protected function getServiceCall($id) diff --git a/lib/service/sfServiceContainerLoaderArray.class.php b/lib/service/sfServiceContainerLoaderArray.class.php index b5c214291..436464944 100644 --- a/lib/service/sfServiceContainerLoaderArray.class.php +++ b/lib/service/sfServiceContainerLoaderArray.class.php @@ -31,7 +31,7 @@ public function doLoad($content) { foreach ($content['parameters'] as $key => $value) { - $parameters[strtolower($key)] = $this->resolveServices($value); + $parameters[strtolower((string) $key)] = $this->resolveServices($value); } } diff --git a/lib/task/generator/sfGenerateProjectTask.class.php b/lib/task/generator/sfGenerateProjectTask.class.php index 1cfcb4343..c2099956b 100755 --- a/lib/task/generator/sfGenerateProjectTask.class.php +++ b/lib/task/generator/sfGenerateProjectTask.class.php @@ -87,7 +87,7 @@ protected function execute($arguments = array(), $options = array()) throw new sfCommandException(sprintf('A symfony project already exists in this directory (%s).', getcwd())); } - if (!in_array(strtolower($options['orm']), array('doctrine', 'none'))) + if (!in_array(strtolower((string) $options['orm']), array('doctrine', 'none'))) { throw new InvalidArgumentException(sprintf('Invalid ORM name "%s".', $options['orm'])); } @@ -98,7 +98,7 @@ protected function execute($arguments = array(), $options = array()) } // clean orm option - $options['orm'] = ucfirst(strtolower($options['orm'])); + $options['orm'] = ucfirst(strtolower((string) $options['orm'])); $this->arguments = $arguments; $this->options = $options; diff --git a/lib/task/plugin/sfPluginInstallTask.class.php b/lib/task/plugin/sfPluginInstallTask.class.php index a6b1fe1f6..5434f80b2 100644 --- a/lib/task/plugin/sfPluginInstallTask.class.php +++ b/lib/task/plugin/sfPluginInstallTask.class.php @@ -3,7 +3,7 @@ /* * This file is part of the symfony package. * (c) 2004-2006 Fabien Potencier - * + * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ @@ -111,7 +111,7 @@ protected function execute($arguments = array(), $options = array()) if (false !== $license) { - $temp = trim(str_replace('license', '', strtolower($license))); + $temp = trim(str_replace('license', '', strtolower((string) $license))); if (null !== $license && !in_array($temp, array('mit', 'bsd', 'lgpl', 'php', 'apache'))) { throw new sfCommandException(sprintf('The license of this plugin "%s" is not MIT like (use --force-license to force installation).', $license)); diff --git a/lib/task/sfTask.class.php b/lib/task/sfTask.class.php index 0a4e69072..5f52d84fd 100644 --- a/lib/task/sfTask.class.php +++ b/lib/task/sfTask.class.php @@ -496,18 +496,18 @@ public function ask($question, $style = 'QUESTION', $default = null) public function askConfirmation($question, $style = 'QUESTION', $default = true) { $answer = 'z'; - while ($answer && !in_array(strtolower($answer[0]), array('y', 'n'))) + while ($answer && !in_array(strtolower((string) $answer[0]), array('y', 'n'))) { $answer = $this->ask($question, $style); } if (false === $default) { - return $answer && 'y' == strtolower($answer[0]); + return $answer && 'y' == strtolower((string) $answer[0]); } else { - return !$answer || 'y' == strtolower($answer[0]); + return !$answer || 'y' == strtolower((string) $answer[0]); } } diff --git a/lib/test/sfTestFunctionalBase.class.php b/lib/test/sfTestFunctionalBase.class.php index fc83df3b5..a32569fc8 100644 --- a/lib/test/sfTestFunctionalBase.class.php +++ b/lib/test/sfTestFunctionalBase.class.php @@ -236,7 +236,7 @@ public function call($uri, $method = 'get', $parameters = array(), $changeStack $uri = $this->browser->fixUri($uri); - $this->test()->comment(sprintf('%s %s', strtolower($method), $uri)); + $this->test()->comment(sprintf('%s %s', strtolower((string) $method), $uri)); foreach ($this->testers as $tester) { diff --git a/lib/util/sfDomCssSelector.class.php b/lib/util/sfDomCssSelector.class.php index a207f4e75..df094eac8 100644 --- a/lib/util/sfDomCssSelector.class.php +++ b/lib/util/sfDomCssSelector.class.php @@ -118,7 +118,7 @@ protected function getElementsForNode($selector, $root_node) $id = substr($token, $pos + 1); $xpath = new DomXPath($root_node); $element = $xpath->query(sprintf("//*[@id = '%s']", $id))->item(0); - if (!$element || ($tagName && strtolower($element->nodeName) != $tagName)) + if (!$element || ($tagName && strtolower((string) $element->nodeName) != $tagName)) { // tag with that ID not found return array(); diff --git a/lib/util/sfFinder.class.php b/lib/util/sfFinder.class.php index be56137a3..fab6c73fd 100644 --- a/lib/util/sfFinder.class.php +++ b/lib/util/sfFinder.class.php @@ -97,7 +97,7 @@ public static function type($name) */ public function setType($name) { - $name = strtolower($name); + $name = strtolower((string) $name); if (substr($name, 0, 3) === 'dir') { @@ -759,12 +759,12 @@ public function test($number) $target = array_key_exists(2, $matches) ? $matches[2] : ''; $magnitude = array_key_exists(3, $matches) ? $matches[3] : ''; - if (strtolower($magnitude) === 'k') $target *= 1000; - if (strtolower($magnitude) === 'ki') $target *= 1024; - if (strtolower($magnitude) === 'm') $target *= 1000000; - if (strtolower($magnitude) === 'mi') $target *= 1024*1024; - if (strtolower($magnitude) === 'g') $target *= 1000000000; - if (strtolower($magnitude) === 'gi') $target *= 1024*1024*1024; + if (strtolower((string) $magnitude) === 'k') $target *= 1000; + if (strtolower((string) $magnitude) === 'ki') $target *= 1024; + if (strtolower((string) $magnitude) === 'm') $target *= 1000000; + if (strtolower((string) $magnitude) === 'mi') $target *= 1024*1024; + if (strtolower((string) $magnitude) === 'g') $target *= 1000000000; + if (strtolower((string) $magnitude) === 'gi') $target *= 1024*1024*1024; $comparison = array_key_exists(1, $matches) ? $matches[1] : '=='; if ($comparison === '==' || $comparison == '') diff --git a/lib/util/sfInflector.class.php b/lib/util/sfInflector.class.php index f1676eb06..507bf6e80 100644 --- a/lib/util/sfInflector.class.php +++ b/lib/util/sfInflector.class.php @@ -45,7 +45,7 @@ public static function underscore($camel_cased_word) $tmp = sfToolkit::pregtr($tmp, array('/([A-Z]+)([A-Z][a-z])/' => '\\1_\\2', '/([a-z\d])([A-Z])/' => '\\1_\\2')); - return strtolower($tmp); + return strtolower((string) $tmp); } /** diff --git a/lib/util/sfToolkit.class.php b/lib/util/sfToolkit.class.php index 811df0edb..38081a809 100644 --- a/lib/util/sfToolkit.class.php +++ b/lib/util/sfToolkit.class.php @@ -305,7 +305,7 @@ public static function literalize($value, $quoted = false) { // lowercase our value for comparison $value = trim($value); - $lvalue = strtolower($value); + $lvalue = strtolower((string) $value); if (in_array($lvalue, array('null', '~', ''))) { @@ -354,7 +354,7 @@ public static function replaceConstants($value) } return preg_replace_callback('/%(.+?)%/', function ($v) { - return sfConfig::has(strtolower($v[1])) ? sfConfig::get(strtolower($v[1])) : '%'.$v[1].'%'; + return sfConfig::has(strtolower((string) $v[1])) ? sfConfig::get(strtolower((string) $v[1])) : '%'.$v[1].'%'; }, $value); } diff --git a/lib/validator/sfValidatorFile.class.php b/lib/validator/sfValidatorFile.class.php index 294dea8c0..7fad1006b 100644 --- a/lib/validator/sfValidatorFile.class.php +++ b/lib/validator/sfValidatorFile.class.php @@ -132,7 +132,7 @@ protected function doClean($value) $max = min($max, $this->getOption('max_size')); } throw new sfValidatorError($this, 'max_size', array( - 'max_size' => round($max / 1024, 0), + 'max_size' => round($max / 1024, 0), 'size' => (int) $value['size'] )); case UPLOAD_ERR_FORM_SIZE: @@ -154,7 +154,7 @@ protected function doClean($value) if ($this->hasOption('max_size') && $this->getOption('max_size') < (int) $value['size']) { throw new sfValidatorError($this, 'max_size', array( - 'max_size' => round($this->getOption('max_size') / 1024, 0), + 'max_size' => round($this->getOption('max_size') / 1024, 0), 'size' => (int) $value['size'] )); } @@ -198,11 +198,11 @@ protected function getMimeType($file, $fallback) if (null !== $type && $type !== false) { - return strtolower($type); + return strtolower((string) $type); } } - return strtolower($fallback); + return strtolower((string) $fallback); } /** diff --git a/lib/validator/sfValidatorFromDescription.class.php b/lib/validator/sfValidatorFromDescription.class.php index 16bd206fd..c870821fc 100644 --- a/lib/validator/sfValidatorFromDescription.class.php +++ b/lib/validator/sfValidatorFromDescription.class.php @@ -104,7 +104,7 @@ protected function tokenize($string) // arguments (optional) $arguments = $this->parseArguments($string, $i); - $tokens[] = new sfValidatorFDTokenOperator(strtolower($match[1]), $arguments); + $tokens[] = new sfValidatorFDTokenOperator(strtolower((string) $match[1]), $arguments); } else if (preg_match('/^(?:([a-z0-9_\-]+)\:)?([a-z0-9_\-]+)/i', substr($string, $i), $match)) { diff --git a/lib/validator/sfValidatorSchema.class.php b/lib/validator/sfValidatorSchema.class.php index 34c97180e..7ff321f52 100644 --- a/lib/validator/sfValidatorSchema.class.php +++ b/lib/validator/sfValidatorSchema.class.php @@ -396,7 +396,7 @@ protected function getBytes($value) { $value = trim($value); $number = (float) $value; - $modifier = strtolower($value[strlen($value) - 1]); + $modifier = strtolower((string) $value[strlen($value) - 1]); $exp_by_modifier = array( 'k' => 1, diff --git a/lib/view/sfView.class.php b/lib/view/sfView.class.php index 87107d59c..b72d2fca5 100644 --- a/lib/view/sfView.class.php +++ b/lib/view/sfView.class.php @@ -117,7 +117,7 @@ public function initialize($context, $moduleName, $actionName, $viewName) $this->attributeHolder = $this->initializeAttributeHolder(); $this->parameterHolder = new sfParameterHolder(); - $this->parameterHolder->add(sfConfig::get('mod_'.strtolower($moduleName).'_view_param', array())); + $this->parameterHolder->add(sfConfig::get('mod_'.strtolower((string) $moduleName).'_view_param', array())); $request = $context->getRequest(); diff --git a/lib/view/sfViewCacheManager.class.php b/lib/view/sfViewCacheManager.class.php index 70198e10f..332c875b2 100644 --- a/lib/view/sfViewCacheManager.class.php +++ b/lib/view/sfViewCacheManager.class.php @@ -263,7 +263,7 @@ protected function getCacheKeyHostNamePart($hostName = '') $hostName = preg_replace('/[^a-z0-9\*]/i', '_', $hostName); $hostName = preg_replace('/_+/', '_', $hostName); - return strtolower($hostName); + return strtolower((string) $hostName); } /** @@ -307,7 +307,7 @@ public function addCache($moduleName, $actionName, $options = array()) { foreach ($options['vary'] as $key => $name) { - $options['vary'][$key] = str_replace('_', '-', strtolower($name)); + $options['vary'][$key] = str_replace('_', '-', strtolower((string) $name)); } } diff --git a/lib/widget/sfWidget.class.php b/lib/widget/sfWidget.class.php index 80a4c4b63..58e45c327 100644 --- a/lib/widget/sfWidget.class.php +++ b/lib/widget/sfWidget.class.php @@ -332,7 +332,7 @@ public function renderTag($tag, $attributes = array()) return ''; } - return sprintf('<%s%s%s', $tag, $this->attributesToHtml($attributes), self::$xhtml ? ' />' : (strtolower($tag) == 'input' ? '>' : sprintf('>', $tag))); + return sprintf('<%s%s%s', $tag, $this->attributesToHtml($attributes), self::$xhtml ? ' />' : (strtolower((string) $tag) == 'input' ? '>' : sprintf('>', $tag))); } /** diff --git a/lib/yaml/sfYamlInline.class.php b/lib/yaml/sfYamlInline.class.php index 97d8c5b03..2b96ef231 100644 --- a/lib/yaml/sfYamlInline.class.php +++ b/lib/yaml/sfYamlInline.class.php @@ -109,11 +109,11 @@ static public function dump($value) return "''"; case preg_match(self::getTimestampRegex(), $value): return "'$value'"; - case in_array(strtolower($value), $trueValues): + case in_array(strtolower((string) $value), $trueValues): return "'$value'"; - case in_array(strtolower($value), $falseValues): + case in_array(strtolower((string) $value), $falseValues): return "'$value'"; - case in_array(strtolower($value), array('null', '~')): + case in_array(strtolower((string) $value), array('null', '~')): return "'$value'"; default: return $value; @@ -387,7 +387,7 @@ static protected function evaluateScalar($scalar) switch (true) { - case 'null' == strtolower($scalar): + case 'null' == strtolower((string) $scalar): case '' == $scalar: case '~' == $scalar: return null; @@ -401,9 +401,9 @@ static protected function evaluateScalar($scalar) $raw = $scalar; $cast = (int) $scalar; return '0' == $scalar[0] ? octdec($scalar) : (((string) $raw == (string) $cast) ? $cast : $raw); - case in_array(strtolower($scalar), $trueValues): + case in_array(strtolower((string) $scalar), $trueValues): return true; - case in_array(strtolower($scalar), $falseValues): + case in_array(strtolower((string) $scalar), $falseValues): return false; case 0 === strpos($scalar, '0x'): return hexdec($scalar); diff --git a/test/unit/routing/sfRouteTest.php b/test/unit/routing/sfRouteTest.php index ff50cee0b..1d42d45f4 100644 --- a/test/unit/routing/sfRouteTest.php +++ b/test/unit/routing/sfRouteTest.php @@ -3,7 +3,7 @@ /* * This file is part of the symfony package. * (c) Fabien Potencier - * + * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ @@ -227,7 +227,7 @@ protected function generateForLabel($optional, $tparams, $separator, $name, $var { if (!empty($tparams[$variable]) && (!$optional || !isset($this->defaults[$variable]) || $tparams[$variable] != $this->defaults[$variable])) { - return $variable . '/' . urlencode($tparams[$variable]); + return $variable . '/' . urlencode((string) $tparams[$variable]); } } }