php8.1 dompdf output errors

ontarget

Active Member
I am using Fabriks List > Layout > PDF output
Debug PDF = Yes , leads to no errors in the rendered output

Turning Debug pdf = No and (J! errors on maximum) leads to the following errors

Code:
Deprecated: Required parameter $dompdf follows optional parameter $paper in /libraries/fabrik/vendor/dompdf/dompdf/src/Adapter/CPDF.php on line 183

Deprecated: Required parameter $dompdf follows optional parameter $paper in /libraries/fabrik/vendor/dompdf/dompdf/src/Canvas.php on line 27

Deprecated: Required parameter $img follows optional parameter $w in /libraries/fabrik/vendor/dompdf/dompdf/lib/Cpdf.php on line 5546

Deprecated: Required parameter $data follows optional parameter $w in /libraries/fabrik/vendor/dompdf/dompdf/lib/Cpdf.php on line 5892

Deprecated: Required parameter $imageWidth follows optional parameter $w in /libraries/fabrik/vendor/dompdf/dompdf/lib/Cpdf.php on line 6236

Deprecated: Required parameter $imageHeight follows optional parameter $w in /libraries/fabrik/vendor/dompdf/dompdf/lib/Cpdf.php on line 6236

Deprecated: Required parameter $imgname follows optional parameter $w in /libraries/fabrik/vendor/dompdf/dompdf/lib/Cpdf.php on line 6236

Deprecated: Required parameter $pattern_name follows optional parameter $corner_style in /libraries/fabrik/vendor/dompdf/dompdf/src/Renderer/AbstractRenderer.php on line 848

I also have a error underneath
Code:
0
round(): Argument #1 ($num) must be of type int|float, string given
I have been through every calc / field element on my site and checked that all instances of round are being outputted as e.g return round((int)$foo,2);

round.png


I have also ensured the pdf output is using float data in views/list/tmpl/mypdftemplate/default.php
e.g
echo "<td>".(float)$group[0]->data->aaa_participant_claim___total_claim_raw."</td>

How can i find out exactly where that error is coming from? There are no indicators in my error log...
Thanks for any help.
 
Last edited:
I did a var_dump of my pdf template and the looped item reveals data that should be numerical is actually string data.
E.g my course hours field is a number type and decimal format in the fabrik field element settings yet it is being cast as a string in the pdf output (this is just one of many examples...)

PHP:
foreach ($this->rows as $group) {
    echo var_dump($this->rows);

EXAMPLE OUTPUT
PHP:
 ["aaa_participant_claim___course_hours"]=> string(4) "2.50" ["aaa_participant_claim___course_hours_raw"]=> string(4) "2.50" ["aaa_participant_claim___tutor_preparation_hours"]=> string(4) "2.50" ["aaa_participant_claim___tutor_preparation_hours_raw"]=> string(4) "2.50"
I wonder if this issue is causing the error:
0 round(): Argument #1 ($num) must be of type int|float, string given
All the round() functions are done in my calc elements before form submission, there is no round() functions in my template code which I'm posting below. I'm totally flumoxed by this having spent all day going over the same lines of code.

PHP:
<?php
/**
 * Bootstrap List Template - Default
 *
 * @package     Joomla
 * @subpackage  Fabrik
 * @copyright   Copyright (C) 2005-2013 fabrikar.com - All rights reserved.
 * @license     GNU/GPL http://www.gnu.org/copyleft/gpl.html
 * @since       3.1
 */

// No direct access
defined('_JEXEC') or die('Restricted access');

$pageClass = $this->params->get('pageclass_sfx', '');




//echo $this->newv;  // Get var from view

foreach ($this->rows as $group) {
    echo var_dump($this->rows);
    echo "<h2 style='text-align: center;'>Tutor Claim Form</h2>";
    echo "<table width='100%' border='1' cellspacing='2' cellpadding='2'>";
    echo "<tr>";
    echo "<td>";
    echo "<p>TUTOR NAME: " . $group[0]->data->aaa_participant_claim___full_name_raw. "</p>";
    echo "<p>SCHOOL DETAILS: ".$group[0]->data->aaa_participant_claim___school_details_raw."</p>";
    echo "<p>SCHOOL ROLL: ".$group[0]->data->aaa_participant_claim___school_roll_raw."</p>";
    echo "</td>";
   
    echo "<td>";
    echo "<p>TUTOR PPS NUMBER: ".$group[0]->data->aaa_participant_claim___tcn_raw . "</p>";
    echo "<p>EMPLOYMENT STATUS: ".$group[0]->data->aaa_participant_claim___teaching_status."</p>";
    echo "<p>TAX TCAN: ".$group[0]->data->aaa_participant_claim___tax_pin_raw."</p>";
    echo "<p>PRSI CLASS: ".$group[0]->data->aaa_participant_claim___prsi_class_raw."</p>";
    echo "</td>";
    echo "<td>";
    echo "<p>HOME ADDRESS: ".$group[0]->data->aaa_participant_claim___address_1_raw."<br>";
    echo "".$group[0]->data->aaa_participant_claim___address_2_raw."</p>";
    echo "<p>HOME EIRCODE: ".$group[0]->data->aaa_participant_claim___start_eircode_raw."</p>";
    echo "<p>MOBILE: ".$group[0]->data->aaa_participant_claim___contact_tel_raw . "</p>";
    echo "<p>EMAIL: ".$group[0]->data->aaa_participant_claim___email_raw."</p>";
    echo "</td>";
    echo "</tr>";
   

    echo "<tr>";
    echo "<td>";
    echo "<p>COURSE DATE: ".$group[0]->data->aaa_participant_claim___date_placeholder_raw."</p>";
    echo "<p>COURSE CODE: ".$group[0]->data->aaa_participant_claim___course_code_raw."</p>";
    echo "</td>";
    echo "<td>";
    echo "<p>COURSE TITLE: ".$group[0]->data->aaa_participant_claim___course_title_raw."</p>";
    echo "<p>COURSE VENUE: ".$group[0]->data->aaa_participant_claim___venue_raw."</p>";
    echo "<p>VENUE EIRCODE: ".$group[0]->data->aaa_participant_claim___venue_ec_raw."</p>";
    echo "</td>";
    echo "<td>";
    echo "<p>COURSE HOURS: ".(float)$group[0]->data->aaa_participant_claim___course_hours_raw."</p>";
    //echo gettype((float)$group[0]->data->aaa_participant_claim___course_hours_raw);
    echo "<p>PREP HOURS: ".(float)$group[0]->data->aaa_participant_claim___tutor_preparation_hours_raw. "</p>";
    echo "<p>DURING SCHOOL HOURS: ".$group[0]->data->aaa_participant_claim___course_during_school."<i style='color:#ccc;'> (1 = Yes, 0 = No)</i></p>";
    echo "</td>";
    echo "</tr>";
    echo "</table>";


    echo "<p>ACCUMULATED DISTANCE TO DATE: ".(float)$group[0]->data->aaa_participant_claim___distance_this_year_raw."</p>";
   



echo "<table width='100%' border='1' cellspacing='2' cellpadding='2'>";
echo "  <tr>";
    echo "<th scope='col'>Date</th>";
    echo "<th scope='col'>Round Trip KM</th>";
    echo "<th scope='col'>KM claim €</th>";
    echo "<th scope='col'>Travel Expenses <br />(check email for receipt)</th>";
    echo "<th scope='col'>Subsistence Expenses</th>";
    echo "<th scope='col'>Lecture Hours</th>";
    echo "<th scope='col'>Prep Hours</th>";
    echo "<th scope='col'>Lecture Fee</th>";
    echo "<th scope='col'>Mode of Transport</th>";
    echo "<th scope='col'>Engine Size</th>";
    echo "<th scope='col'>Number Overnights</th>";
    echo "<th scope='col'>Total Claim</th>";
    echo "  </tr>";

  echo "<tr>";
    echo "<td>".$group[0]->data->aaa_participant_claim___date_placeholder_raw."</td>
    ";
    echo "<td>".(float)$group[0]->data->aaa_participant_claim___total_distance_raw."</td>
    ";
    echo "<td>".(float)$group[0]->data->aaa_participant_claim___mileage_claim_s2_raw."</td>
    ";
    echo "<td>".(float)$group[0]->data->aaa_participant_claim___tolls_paid_raw."</td>
    ";
    echo "<td>".(float)$group[0]->data->aaa_participant_claim___tutor_subs_calc."</td>
    ";
    echo "<td>".(float)$group[0]->data->aaa_participant_claim___course_hours_raw."</td>
    ";
    echo "<td>".(float)$group[0]->data->aaa_participant_claim___tutor_preparation_hours_raw."</td>
    ";
    echo "<td>".(float)$group[0]->data->aaa_participant_claim___lecture_fee_raw."</td>
    ";
     echo "<td>".$group[0]->data->aaa_participant_claim___mode_of_transport_raw."</td>
    ";
    echo "<td>".$group[0]->data->aaa_participant_claim___engine_size_raw."</td>
    ";
    echo "<td>".$group[0]->data->aaa_participant_claim___overnights_raw."</td>
    ";
    echo "<td>".(float)$group[0]->data->aaa_participant_claim___total_claim_raw."</td>
    ";
   
echo "  </tr>";
echo "</table>";

echo "<hr />";

    echo "<p>BIC: ".$group[0]->data->aaa_participant_claim___showbic_raw."<br>";
    echo "IBAN: ".$group[0]->data->aaa_participant_claim___IBAN_raw."</p>";
    echo "<p><a href='https://circulars.gov.ie/pdf/circular/education/2017/40.pdf' target='_blank'>Information about rates on the system</a></p>";
    echo "<p>APPROVAL STATUS:<span style='color:green;'> ".$group[0]->data->aaa_participant_claim___approve_claim. "</span></p>"; 

   
   
echo "</div>";   

}


?>
 
Ok the fix for this issue was to upgrade the dompdf library from v.0.8.6 to 1.2.2 in fabrik.
Latest dompdf V2.01 gave a Mastermind / Html5 error so dont upload this version.
v1.2.2 works perfectly
Instructions for anyone wishing to upgrade fabrik.
  1. Go to the dir: /libraries/fabrik/vendor/dompdf/dompdf (backup your current dompdf files)
  2. Go to the github repo for dompdf v1.2.2: https://github.com/dompdf/dompdf/tree/v1.2.2
  3. Download the zip / extract and upload to your /libraries/fabrik/vendor/dompdf/dompdf dir
The 0 round(): Argument #1 ($num) must be of type int|float, string given error goes away!!:)
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top