?
avatar silverboyir
silverboyir
7 May 2017

Steps to reproduce the issue

create a cli class that extends from JApplicationCli and put JFactory::getUser() in doExecute method
run the file from command line

Expected result

Actual result

System information (as much as possible)

Additional comments

Im not sure this happend in older version too or not
i need to run JHtml::('date', $date, JText::('DATE_FORMAT_LC2')) from CLI

avatar silverboyir silverboyir - open - 7 May 2017
avatar joomla-cms-bot joomla-cms-bot - labeled - 7 May 2017
avatar franz-wohlkoenig franz-wohlkoenig - change - 8 May 2017
Priority Critical Medium
avatar PhilETaylor
PhilETaylor - comment - 8 May 2017

Cannot replicate with the facts provided. JFactory::getUser() doesnt cause an issue for me at all.

However, reading between the lines this is NOT a problem with JFactory::getUser() but a problem with the JDate in Joomla 3.7.0

Running

JHtml::_('date', time(), JText::_('DATE_FORMAT_LC2'))

with PHP 7.1 CLI - I get

Error displaying the error page: Application Instantiation Error: Application Instantiation Error

avatar PhilETaylor
PhilETaylor - comment - 8 May 2017

Code to reproduce this bug, save this gist to /cli/test15876.php and run at the command line

#15853

<?php
/**
 * @package    Joomla.Cli
 *
 * @copyright  Copyright (C) 2005 - 2017 Open Source Matters, Inc. All rights reserved.
 * @license    GNU General Public License version 2 or later; see LICENSE.txt
 */

// We are a valid entry point.
const _JEXEC = 1;

// Load system defines
if (file_exists(dirname(__DIR__) . '/defines.php'))
{
	require_once dirname(__DIR__) . '/defines.php';
}

if (!defined('_JDEFINES'))
{
	define('JPATH_BASE', dirname(__DIR__));
	require_once JPATH_BASE . '/includes/defines.php';
}

// Get the framework.
require_once JPATH_LIBRARIES . '/import.legacy.php';

// Bootstrap the CMS libraries.
require_once JPATH_LIBRARIES . '/cms.php';

// Configure error reporting to maximum for CLI output.
error_reporting(E_ALL);
ini_set('display_errors', 1);

/**
 * A command line cron job to attempt to remove files that should have been deleted at update.
 *
 * @since  3.0
 */
class Test15876Cli extends JApplicationCli
{
	/**
	 * Entry point for CLI script
	 *
	 * @return  void
	 *
	 * @since   3.0
	 */
	public function doExecute()
	{
		var_dump(JHtml::_('date', time(), JText::_('DATE_FORMAT_LC2')) );
	}
}

// Instantiate the application object, passing the class name to JCli::getInstance
// and use chaining to execute the application.
JApplicationCli::getInstance('Test15876Cli')->execute();
avatar PhilETaylor
PhilETaylor - comment - 8 May 2017

Testing in PHP 5.6 and 5.3 with Joomla 3.7.0 gives the same issue.

avatar silverboyir
silverboyir - comment - 8 May 2017

Problem comes from JFactory::getUser(); and from getSession()


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/15876.

avatar franz-wohlkoenig franz-wohlkoenig - change - 8 May 2017
Status New Discussion
avatar mbabker
mbabker - comment - 8 May 2017

Was fixed by #15605

avatar mbabker mbabker - close - 8 May 2017
avatar mbabker mbabker - change - 8 May 2017
Status Discussion Closed
Closed_Date 0000-00-00 00:00:00 2017-05-08 17:39:35
Closed_By mbabker
avatar PhilETaylor
PhilETaylor - comment - 8 May 2017

Thanks @mbabker - I could not find it but was sure it was fixed/addressed somewhere after nic's rants...

Add a Comment

Login with GitHub to post a comment