Parse error: syntax error | Forum

peter Apr 23 '11


Parse error: syntax error, unexpected T_OBJECT_OPERATOR in /home/sites/dadpeter.co.uk/public_html/dp_11/ow_cron/run.php on line 45

Getting this output from my cron logs

here is a copy of my run php file


/**
* EXHIBIT A. Common Public Attribution License Version 1.0
* The contents of this file are subject to the Common Public Attribution License Version 1.0 (the “License”);
* you may not use this file except in compliance with the License. You may obtain a copy of the License at
* http://www.oxwall.org/license.php. The License is based on the Mozilla Public License Version 1.1
* but Sections 14 and 15 have been added to cover use of software over a computer network and provide for
* limited attribution for the Original Developer. In addition, Exhibit A has been modified to be consistent
* with Exhibit B. Software distributed under the License is distributed on an “AS IS” basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language
* governing rights and limitations under the License. The Original Code is Oxwall software.
* The Initial Developer of the Original Code is Skalfa LLC (http://www.skalfa.com/).
* All portions of the code written by Skalfa LLC are Copyright (c) 2009. All Rights Reserved.

* EXHIBIT B. Attribution Information
* Attribution Copyright Notice: Copyright 2009 Skalfa LLC. All rights reserved.
* Attribution Phrase (not exceeding 10 words): Powered by Oxwall community software
* Attribution URL: http://www.oxwall.org/
* Graphic Image as provided in the Covered Code.
* Display of Attribution Information is required in Larger Works which are defined in the CPAL as a work
* which combines Covered Code or portions thereof with code not governed by the terms of the CPAL.
*/
/**
* @author Nurlan Dzhumakaliev [email protected]>
* @package ow_cron
* @since 1.0
*/
define('_OW_', true);

define('DS', DIRECTORY_SEPARATOR);

define('OW_DIR_ROOT', substr(dirname(__FILE__), 0, - strlen('ow_cron')));

define('OW_CRON', true);

$_SERVER['REQUEST_URI'] = ''; // just a hack that kills the annoying notice

require_once(OW_DIR_ROOT . 'ow_includes' . DS . 'init.php');

$application = OW_Application::getInstance();

$application->init();

$plugins = BOL_PluginService::getInstance()->findActivePlugins();

foreach ( $plugins as $plugin )
{
/* @var $plugin BOL_Plugin */
$pluginRootDir = OW::getPluginManager()->getPlugin($plugin->getKey())->getRootDir();
if ( file_exists($pluginRootDir . DS . 'cron.php') )
{
include $pluginRootDir . DS . 'cron.php';
$className = strtoupper($plugin->getKey()) . '_Cron';
$cron = new $className;

$runJobs = array();
$newRunJobDtos = array();

foreach ( BOL_CronService::getInstance()->findJobList() as $runJob )
{
/* @var $runJob BOL_CronJob */
$runJobs[$runJob->methodName] = $runJob->runStamp;
}

$jobs = $cron->getJobList();

foreach ( $jobs as $job => $interval )
{
$methodName = $className . '::' . $job;
$runStamp = ( isset($runJobs[$methodName]) ) ? $runJobs[$methodName] : 0;
$currentStamp = time();
if ( ( $currentStamp - $runStamp ) > ( $interval * 60 ) )
{
$cron->$job();

$runJobDto = new BOL_CronJob();
$runJobDto->methodName = $methodName;
$runJobDto->runStamp = $currentStamp;
$newRunJobDtos[] = $runJobDto;
}
}

if ( count($newRunJobDtos) > 0 )
{
BOL_CronService::getInstance()->batchSave($newRunJobDtos);
}
}
}





peter
The Forum post is edited by peter Apr 26 '11
peter Apr 24 '11
can anybody help me to sort this out on hear ,its ov that there is a fault with the php code on line 45 ,its been coded wrong
peter Apr 24 '11
I thought people got good support on hear?.A parse error is when the programming (code) is in the process of being translated by the compiler and there is an error in the coding. Php (compilier is very strict when it comes to coding, if you omit one semi-colon in the wrong place, it throws the entire coding off. SO COULD THE PERSON THAT WROTE THIS CODE PLEASE CHECK IT AND TELL ME WHAT`S MISSING
The Forum post is edited by peter Apr 24 '11
peter Apr 24 '11
I had to go and find out else were .

it was this that was causeing it :: and it should of been ->

$plugins = BOL_PluginService->getInstance()->findActivePlugins(); correct edit
$plugins = BOL_PluginService::getInstance()->findActivePlugins(); wrong edit

here is the amended file

its not uploading the file so you can`t add atachments on this forum,so you will just have to edit your cron run.php file and edit line 45
The Forum post is edited by peter Apr 24 '11
Team
Den Apr 26 '11
Hi peter, what version of PHP is run for cron execution on your hosting? The right way of object's static method calling is to use "::". getInstance() is a static method of class BOL_PluginService.

P.S PHP files is not allowed to upload on this forum due to security reasons :)
The Forum post is edited by Den Apr 26 '11
Team
Den Nov 21 '11
Topic was moved from Bug reports and troubleshooting.
Robert Heck Jan 12 '12
I'm running into this same issue.  I tried peter's "fix" and it gave the same error message so I just reverted back to the original code.
Edit: Info that might be helpful:
Host: 1and1
Using Shared Server
PHP Ver: 5.2
Not installed into a sub folder

Edit2:
Forgot to mention I setup the cron job without a problem, the error happens when I try to manually execute the command.
The Forum post is edited by Robert Heck Jan 12 '12
Robert Heck Jan 12 '12
Ok found the fix.

I had to use /usr/bin/php5 to fix the error.