• Hello Fabrik Community

    Fabrik is now in the hands of the development team that brought you Fabrik for Joomla 4. We have recently transitioned the Fabrik site over to a new server and are busy trying to clean it up. We have upgraded the site to Joomla 4 and are running the latest version of Fabrik 4. We have also upgraded the Xenforo forum software to the latest version. Many of the widgets you might have been used to on the forum are no longer operational, many abandoned by the developers. We hope to bring back some of the important ones as we have time.

    Exciting times to be sure.

    The Fabrik 4.0 Official release is now available. In addition, the Fabrik codebase is now available in a public repository. See the notices about these in the announcements section

    We wish to shout out a very big Thank You to all of you who have made donations. They have really helped. But we can always use more...wink..wink..

    Also a big Thank You to those of you who have been assisting others in the forum. This takes a very big burden off of us as we work on bugs, the website and the future of Fabrik.


  • Views Views: 14,589
  • Last updated Last updated:
  • There are several ways you can debug your php code depending on the issues you are having. Most of the methods below will display a string, so you also need to know how to convert arrays and objects to strings in order to display them.

    Converting other types of data to strings​

    Converting an array to a string​
    $string = json_encode($array);
    Converting an object to a string​
    Assumiong that your object implements a __toString() function:
    $string = (string) $object;

    PHP echo​

    The most obvious way to output debugging information is to use the php "echo" statement. However, this is not always as straightforward as you might think because the output will often appear somewhere in your HTML which may not be immediately obvious or even visible, but can sometimes be missing altogether if you outputted it during a php output buffer capture ("ob_start"):
    echo "$string = " .  $string;

    You may need to use your browser's Developer's Tools to search for the output.

    You also need to be aware that if page headers are still being created, your output will terminate these and may create other output oddities.

    Joomla's standard message area​

    Possibly the easiest way to put a debug message on screen is to send it to Joomla's standard message area:
    JFactory::getApplication()->enqueueMessage($string, 'message');

    Fabrik's debugging infrastructure​

    If you want to leave debugging code permanently in your php, then you can use Fabrik's own debugging system.

    Turning on Fabrik's debugging system​
    To view additional debug output showing what Fabrik is doing, you need to do two things:
    1. Set 'allow fabrik debug' to either 'Yes' or 'Debug JS' in Fabrik's global parameters.
    2. Add to the end of the URL the following string:
      if there are no query parameters in the URL already.

    Permanent debugging statements​
    To display your own debugging information alongside Fabrik's, use:
    FabrikHelperHTML::debug($string, 'debug:heading');

    Browser Developer's Tools​

    To get debugging information when the output is being sent in response to an Ajax call for e.g. field or form Validation or for calc Elements, and is not immediately visible the browser window.

    You can use the following methods :

    Use your browser's Developer's Tools​
    To display variables, you can use the PHP var_dump() function :
    var_dump("MY_VAR : ",$my_var);
    When the , this will stop the execution of the plugin and you will get the following error on your form :
    SyntaxError: JSON.parse: unexpected character

    For example in Firefox's Developer's Tools / Firebug, in the Javascript Console you will see a POST with:
    SyntaxError: JSON.parse: unexpected character

    Click on the '+' symbol before "POST". You will see a new menu, by default on "Response" tab. Click on "HTML" tab, you will see your dump in a more visible way.

    If you want to display many variables, you can write :
    echo "found : " . $found . "\n";
    echo "status : " . $status; exit;
    The "\n" is to display the next variable on a new line.
    And don't forget to write "exit;" on the last line !


    Joomla JDump extension​

    JDump allows you to display your debugging output in a popup window, without stopping the execution of your code. Just insert in your code something like:
    dump($variable, 'Variable Name');

    In case if you get the following error at the backend of Joomla after installing JDump:
    Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; plgSystemDump has a deprecated constructor in /home/

    Replace this code:
    function plgSystemDump(& $subject, $params) {
    parent::__construct($subject, $params);
    function __construct(& $subject, $params) {
    parent::__construct($subject, $params);
    in /plugins/system/dump/dump.php on lines 27 / 28

    See also...​