picqer / php-barcode-generator

Barcode generator in PHP that is easy to use, non-bloated and framework independent.
GNU Lesser General Public License v3.0
1.66k stars 400 forks source link

thrown in /home/devspedi/public_html/wp-content/themes/additrans/lib/php-barcode-generator/src/BarcodeGenerator.php on line 140 #177

Closed rux2 closed 1 year ago

rux2 commented 1 year ago

i have this piece of code : require_once get_template_directory().'/lib/php-barcode-generator/src/BarcodeGenerator.php'; require_once get_template_directory().'/lib/php-barcode-generator/src/BarcodeGeneratorHTML.php';

add_action( 'woocommerce_email_order_meta', 'aggiungi_codice_a_barre_email_conferma_ordine', 10, 3 ); function aggiungi_codice_a_barre_email_conferma_ordine( $order, $sent_to_admin, $plain_text ) { $string = $order->get_order_number(); // Utilizza il numero dell'ordine come stringa per generare il codice a barre $bar_code= genera_codice_a_barre( $stringa ); // Genera il codice a barre $colli = $_POST['peso_colli']; for ($i = 0; $i < count($colli); $i++){ if ($colli[$i]){ $stringa_per_codice_a_barre = $_POST['codicecollo'.$i]; echo '

Bar code

'; echo $bar_code; } } } function genera_codice_a_barre( $string ) { $generator = new Picqer\Barcode\BarcodeGeneratorHTML(); $bar_code= $generator->getBarcode($string, $generator::TYPE_CODE_39); // Restituisci il codice a barre HTML return $bar_code; } that generates the error : thrown in /home/devspedi/public_html/wp-content/themes/additrans/lib/php-barcode-generator/src/BarcodeGenerator.php on line 113.

casperbakker commented 1 year ago

Without the error itself and the value in $string, I cannot start to debug this.