Tag: Joomla Error

  • Fix “Class JRequest Not Found” in Joomla 4, 5 and 6.2 (Tested)

    Fix “Class JRequest Not Found” in Joomla 4, 5 and 6.2 (Tested)

    Updated 15 October 2026 · By Abhilash Sahoo, Founder, Infyways

    Quick answer: Class "JRequest" not found means some extension, template or override still calls JRequest, a Joomla 3-era class that Joomla 4, 5 and 6 don’t include. To fix it:

    1. Turn on Debug System to see the file and line.
    2. Search the site for JRequest::.
    3. Replace each call with Factory::getApplication()->getInput(), for example JRequest::getInt('id') → $input->getInt('id', 0).
    4. If it’s a third-party extension, update it first. The Backward Compatibility plugin will not bring JRequest back.

    This applies unchanged to Joomla 6.2, the latest version.

    I reproduced this error on a real Joomla 5.4.10 site (PHP 8.2, XAMPP) and tested every replacement below on it. I also checked the Joomla 6.2.0 source package. Images marked “real output” show what the site actually returned. Main reference: Joomla’s official Input documentation.

    What does “Class JRequest not found” mean?

    PHP reached a line such as JRequest::getCmd('view') and couldn’t find a class called JRequest. Joomla 1.5 to 3 used it to read $_GET, $_POST and $_FILES. It was deprecated during the Joomla 3 series in favour of the Input API. Joomla 4 doesn’t include it, and neither do Joomla 5 or 6.

    Because the class is missing, it’s a fatal error and the page stops at that line. With debug off, my test site showed only “Error: 0” and HTTP 500. A search of the Joomla 5.4.10 libraries/ and plugins/ folders found no references to JRequest, so the call always comes from your own code or a third-party extension.

    Which file is causing the error?

    Go to System → Global Configuration → System, set Debug System to Yes, and reload the broken page. The error page now includes a call stack. Row 1 is the file and line that called JRequest:

    Joomla debug call stack for Class "JRequest" not found pointing to the file and line

    Turn debug off again when you’re done. If you can’t reach the admin, set public $debug = true; in configuration.php. You can also check the PHP error log, which records the same file and line.

    If the stack shows nothing useful, your template may not show system messages. Temporarily switch to Cassiopeia. Then disable third-party plugins one at a time until the error goes away.

    How do I find every JRequest call on the site?

    Fixing one file is rarely enough. Old extensions usually call JRequest in several places, and template overrides in templates/*/html/ are easy to miss. From the site root:

    rg -n "JRequest::" .          # ripgrep, fastest
    grep -rn "JRequest::" --include=*.php .   # works on any host
    Searching a Joomla site for JRequest calls with ripgrep, including template overrides

    If you have no shell access, download the site over FTP and search the folder in your code editor. You can also run the extension through JED Checker.

    What replaces JRequest in Joomla 4, 5 and 6?

    Use the application’s Input object:

    use Joomla\CMS\Factory;
    
    $input = Factory::getApplication()->getInput();
    
    $id   = $input->getInt('id', 0);
    $view = $input->getCmd('view', '');
    $q    = $input->getString('q', '');

    Put the use line at the top of the file, after defined('_JEXEC') or die;. Always pass a default value, because the Input methods return it when the parameter is missing.

    Cheat sheet mapping JRequest methods to the Joomla Input API
    Old JRequest call Joomla 4 / 5 / 6 replacement
    JRequest::getInt('id') $input->getInt('id', 0)
    JRequest::getCmd('task') $input->getCmd('task', '')
    JRequest::getString('q') $input->getString('q', '')
    JRequest::getWord('layout') $input->getWord('layout', '')
    JRequest::getVar('x', '', 'post') $input->post->get('x', '', 'string')
    JRequest::getVar('x', '', 'get') $input->get->get('x', '', 'string')
    JRequest::getVar('file', null, 'files') $input->files->get('file')
    JRequest::get('post') $input->post->getArray()
    JRequest::getVar('jform', [], 'post', 'array') $input->post->get('jform', [], 'array')
    JRequest::setVar('a', 1) $input->set('a', 1)
    JRequest::checkToken() Session::checkToken() (use Joomla\CMS\Session\Session;)
    JRequest::getVar('HTTP_REFERER', '', 'server') $input->server->getString('HTTP_REFERER', '')

    Which filter should I use?

    The old JRequest::getVar() was often used with no filter at all. Choose a filter on purpose. The official docs say get() uses CMD when you don’t pass a filter, so $input->get('q') strips spaces and punctuation. Here’s what my test site returned for ?id=7abc&q=<b>hi</b>:

    Tested Joomla Input filter results for getInt, getString, raw and getCmd
    Data Use Tested result
    IDs, counts getInt() / 'uint' 7abc → int(7)
    option, view, task getCmd() missing → your default
    Search text, names getString() <b>hi</b> → "hi"
    Editor HTML 'html', or 'raw' plus your own filtering 'raw' kept <b>hi</b> unchanged
    Form arrays post->get('jform', [], 'array'), then validate in the model No filtering, as with core MVC

    Only use raw when you clean the value afterwards. Raw input that ends up in SQL or HTML is a security hole. See our Joomla security guide.

    How do I fix JRequest inside a controller, model or module?

    • Controllers that extend BaseController already have the input as $this->input, so JRequest::getCmd('task') becomes $this->input->getCmd('task').
    • Models, views, helpers, plugins and template overrides: use Factory::getApplication()->getInput(). In a plugin that has $this->getApplication(), call $this->getApplication()->getInput().
    • Modern modules with a Dispatcher get Input passed into the constructor. The official manual includes a full mod_input example.

    Does the Backward Compatibility plugin fix JRequest?

    No. I tested this directly. With the Behaviour – Backward Compatibility plugins enabled, old aliases such as JFactory and JInput worked. With the plugins disabled, they failed. JRequest didn’t exist in either case:

    Behaviour Backward Compatibility plugin test showing JRequest is never restored

    In Joomla 6.2, the compat6 plugin’s class map has 450 aliases. It still includes JFactory, JInput and JText, but not JRequest. So don’t replace JRequest with JFactory::getApplication()->input, because that still depends on the compatibility layer. Use the namespaced form.

    Is $app->input still OK in Joomla 6.2?

    It works, but it’s deprecated. In the Joomla 6.2.0 source, reading ->input goes through a magic __get() proxy. That proxy triggers a deprecation notice and is marked “will be removed in 8.0”. New code should call getInput().

    Joomla 6.2 source showing the app input property is deprecated in favour of getInput

    What if the error comes from a third-party extension?

    1. Check the developer’s site or the JED for a Joomla 5/6 version. Updating is safer than patching, because code that uses JRequest usually has other Joomla 3-only code (JError, old MVC, Bootstrap 2).
    2. If it’s abandoned, find a maintained replacement.
    3. If you have to patch it, keep a copy of your changes, because the next update will overwrite them.

    Before upgrading, run our Joomla 6 compatibility check to catch these problems first. For the full migration path, see the Joomla 3 to 6 upgrade guide.

    Troubleshooting

    Symptom Cause Fix
    White page or “Error: 0”, HTTP 500 Debug off, fatal error Turn on Debug System and read row 1 of the stack
    Fixed one file, error moved to another Several calls Search the whole tree, including overrides
    Class "Factory" not found Missing use Add use Joomla\CMS\Factory; or write \Joomla\CMS\Factory
    Call to a member function getCmd() on null Code ran before the app was ready, or $this->input outside a controller Use Factory::getApplication()->getInput()
    Search box loses spaces get() defaults to CMD Use getString()
    HTML from an editor gets stripped STRING filter Use 'html', or 'raw' and filter it yourself
    Works on Joomla 5, breaks on 6 Old J* aliases with the compat plugin off Switch to namespaced classes
    Error only in admin Admin module or plugin Disable it via the database, or rename its folder over FTP

    FAQs

    Was JRequest removed in Joomla 4?

    Yes. It was deprecated in the Joomla 3 series. Joomla 4, 5 and 6 don’t include it, so any call causes a fatal error.

    Can I add a JRequest class myself to make the error go away?

    You could write a small shim, but it only hides the problem. Code like that usually breaks on the next Joomla 3 API it uses. Replacing the calls is quicker and safer.

    What is the Joomla 4 equivalent of JRequest::getVar()?

    Factory::getApplication()->getInput()->get('name', $default, 'filter'). Use ->post, ->get or ->files to read from a specific source.

    Is JInput the same as JRequest?

    No. JInput is the old alias for Joomla\Input\Input, which is the replacement. Use the namespaced Input rather than JInput.

    Why does my site show only “Error: 0”?

    Debug mode is off, so Joomla hides the details. Turn on Debug System, or check the PHP error log for the file and line.

    Does this error affect Joomla 6.2?

    Yes, in the same way. Joomla 6.2 is the latest version, and it has no JRequest either.

    Will turning off the Backward Compatibility plugin cause more errors?

    It can. In my test, JFactory and JInput stopped working when it was off. Fix those aliases too before you rely on the site without it.

    How do I read JSON sent by AJAX?

    Use $input->json->get('key'). This only works when the whole request body is JSON.

    Can I fix this without coding?

    Update or replace the extension that causes it. If it’s custom code, a developer will need to change it. We fix these as part of our Joomla upgrade service.