Eventlist - Erro Function ereg() is deprecated

  • liclopes
  • Avatar de liclopes Autor do Tópico
  • Offline
  • JCB! Professional
  • JCB! Professional
Mais
14 anos 3 meses atrás #50695 por liclopes
liclopes created the topic: Eventlist - Erro Function ereg() is deprecated
No PHP 5.3.5 a função ereg não funciona dreito.
Preciso trocar o ereg para preg_match e preciso usar os delimitadores / / mas não funciona. não to sabendo fazer a mudança

Deprecated: Function ereg() is deprecated in C:\wamp\www\metamorph\components\com_eventlist\views\details\view.html.php on line 166
// generate Metatags
$meta_keywords_content = "";
if (!empty($row->meta_keywords)) 
{
	$keywords = explode(",",$row->meta_keywords);
	foreach($keywords as $keyword) 
	{

		if ($meta_keywords_content != "") 
		{
			$meta_keywords_content .= ", ";
		}

		//LINHA 166
		if (ereg('[/[/]',$keyword)) 
		{
			$keyword = trim(str_replace("[","",str_replace("]","",$keyword)));
			$buffer = $this->keyword_switcher($keyword, $row, $elsettings->formattime, $elsettings->formatdate);

			if ($buffer != "") 
			{
				$meta_keywords_content .= $buffer;
			} 
			else 
			{
				// remove the comma and the white space
				$meta_keywords_content = substr($meta_keywords_content,0,strlen($meta_keywords_content) - 2);	
			}
		} 
		else 
		{
			$meta_keywords_content .= $keyword;
		}
	}
}


Warning: preg_match() [function.preg-match]: Unknown modifier '[' in C:\wamp\www\metamorph\components\com_eventlist\views\details\view.html.php on line 166
//LINHA 166
if (preg_match('/[/[/]/',$keyword))
{ 

Please Entrar ou Registrar to join the conversation.


Mais
14 anos 3 meses atrás #51198 por matheusoliveira
matheusoliveira replied the topic: Re: Eventlist - Erro Function ereg() is deprecated
O meu eu conseguir fazer isso:
// generate Metatags
		$meta_keywords_content = "";
		if (!empty($row->meta_keywords)) {
			$keywords = '/explode(",",$row->meta_keywords)/';
			foreach($keywords as $keyword) {
				if ($meta_keywords_content != "") {
					$meta_keywords_content .= ", ";
				}
				if (preg_match("[/[/]",$keyword)) {
					$keyword = trim(str_replace("[","",str_replace("]","",$keyword)));
					$buffer = $this->keyword_switcher($keyword, $row, $elsettings->formattime, $elsettings->formatdate);
					if ($buffer != "") {
						$meta_keywords_content .= $buffer;
					} else {
						$meta_keywords_content = substr($meta_keywords_content,0,strlen($meta_keywords_content) - 2);	// remove the comma and the white space

Porém deu erro na linha 162
Warning: Invalid argument supplied for foreach() in C:\wamp\www\futebol\components\com_eventlist\views\details\view.html.php on line 162

Quem resolver ficarei grato.

Please Entrar ou Registrar to join the conversation.

  • liclopes
  • Avatar de liclopes Autor do Tópico
  • Offline
  • JCB! Professional
  • JCB! Professional
Mais
14 anos 3 meses atrás #51800 por liclopes
liclopes replied the topic: Re: Eventlist - Erro Function ereg() is deprecated
Warning: Invalid argument supplied for foreach(), o objeto que a função foreach recebeu pode esta vázio ou não é um vetor ou matriz
função foreach(null as $element)
function foo($anArray) {
   foreach($anArray as $element) {
     echo $element;
   }
}
function foo($anArray) {
   if(empty($anArray)) {
     return false;
   }
   foreach($anArray as $element) {
     echo $element;
   }
   return true;
 }

E vá em Configuração Global:
- Em Servidor ~> Configurações do Servidor ~> Relatório de Erros ~> escolha Máximo e Configurações de Depuração
- Em Sistema ~> Ativar Depuração do Sistema ~> Escolha Sim

Please Entrar ou Registrar to join the conversation.

  • liclopes
  • Avatar de liclopes Autor do Tópico
  • Offline
  • JCB! Professional
  • JCB! Professional
Mais
14 anos 2 meses atrás #52730 por liclopes
liclopes replied the topic: Re: Eventlist - Erro Function ereg() is deprecated
talvez resolva substituindo ->
if (ereg('[/[/]',$keyword))
por ->
if (preg_match('/[/[/]/', $keyword))

igual como oi feito em ->
if(preg_match("msie", $br))
que foi substituido por
if(preg_match('/msie/', $br))

<!-- l --><a class="postlink-local" href=" www.joomlaclube.com.br/site/forum/viewto...?f=12&t=7466&start=0 " onclick="window.open(this.href);return false;]viewtopic.php?f=12&t=7466&start=0[/url]<!-- l -->

Please Entrar ou Registrar to join the conversation.