Quantcast
Channel: Joomla! Forum - community, help and support
Viewing all articles
Browse latest Browse all 1440

Joomla! 4.x Coding • Re: old script failing in joomla 4 - Factory:: issue

$
0
0
i tried implementing the code from toivo. problems popped up in multiple places. i don't understand what the script is trying to do, how the code is supposed to work or how to track down/correct the problems.

1) define('JPATH_BASE', realpath(dirname(__FILE__) . '/..'));
failed immediately by not being able to find anything
i restored define( 'JPATH_BASE', $_SERVER['DOCUMENT_ROOT'] ); and was able to progress a littl

2) $app = $container->get(\Joomla\CMS\Application\SiteApplication::class);
Warning: session_name(): Session name cannot be changed after headers have already been sent in /home/usbf/public_html/libraries/vendor/joomla/session/src/Storage/NativeStorage.php on line 405

i tried reading NativeStorage.php but couldn't backtrack to identify what was trying to reset session name

3) $user= $app->getSession()->get('user');
runtime exception
Failed to start the session because headers have already been sent by "/home/usbf/public_html/apps/includes/session.php" at line 33.

line 33 in my script is just echoing some information about which command is about to or was just executed.
it exists between the command to define JPATH_BASE and require_once defines.php

trace is:

RuntimeException:
Failed to start the session because headers have already been sent by "/home/usbf/public_html/apps/includes/session.php" at line 33.

at /home/usbf/public_html/libraries/vendor/joomla/session/src/Storage/NativeStorage.php:473
at Joomla\Session\Storage\NativeStorage->start()
(/home/usbf/public_html/libraries/src/Session/Storage/JoomlaStorage.php:295)
at Joomla\CMS\Session\Storage\JoomlaStorage->start()
(/home/usbf/public_html/libraries/vendor/joomla/session/src/Session.php:406)
at Joomla\Session\Session->start()
(/home/usbf/public_html/libraries/vendor/joomla/session/src/Session.php:333)
at Joomla\Session\Session->has('user')
(/home/usbf/public_html/libraries/src/Session/Session.php:194)
at Joomla\CMS\Session\Session->get('user')
(/home/usbf/public_html/apps/includes/session.php:92)


i'm lost

Statistics: Posted by ahollan1 — Sun Nov 24, 2024 3:09 am



Viewing all articles
Browse latest Browse all 1440

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>