Parse error: syntax error, unexpected T_STRING, expecting T_

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
ismael84
Forum Newbie
Posts: 1
Joined: Thu Apr 18, 2013 3:13 pm

Parse error: syntax error, unexpected T_STRING, expecting T_

Post by ismael84 »

Hello

When I run this command-bash-3.2 $ php magmi.cli.php-mode = update-profile = default SSH to import a csv file Magento products in my shop I get this message:

Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /home/content/17/10622317/html/magmi/inc/magmi_loggers.php on line 4

Code: Select all

<?php 
class FileLogger
{
protected $_fname;

public function __construct($fname=null)
{
if($fname==null)
{
$fname=Magmi_StateManager::getProgressFile(true);
}
$this->_fname=$fname;
$f=fopen($this->_fname,"w");
if($f==false)
{
throw new Exception("CANNOT WRITE PROGRESS FILE ");
}
fclose($f);
}

public function log($data,$type)
{

$f=fopen($this->_fname,"a");
if($f==false)
{
throw new Exception("CANNOT WRITE PROGRESS FILE ");
}
$data=preg_replace ("/(\r|\n|\r\n)/", "<br>", $data);
fwrite($f,"$type:$data\n");
fclose($f);
}

}

class EchoLogger
{
public function log($data,$type)
{
$info=explode(";",$type);
$type=$info[0];
echo('<p class="logentry log_'.$type.'">'.$data."</p>");
}

}
class CLILogger
{
public function log($data,$type)
{
echo("$type:$data\n");
}
}
?>
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: Parse error: syntax error, unexpected T_STRING, expectin

Post by Christopher »

What version of PHP is your CLI version? It looks like it may not like the "protected" keyword. You can use it in PHP4.
(#10850)
Post Reply