Code Monkey home page Code Monkey logo

Comments (3)

marc-henri avatar marc-henri commented on August 15, 2024

Bonjour @chrishablet
Je me permets d'intervenir dans l'exposé de votre problème afin de savoir si vous lui avez trouvé une issue ?
Je rencontre le même type de message d'erreur :

[2024-03-18 17:21:49] glpiphplog.CRITICAL: *** Uncaught Exception Error: Call to undefined method QRcode::png() in /var/www/glpi-10.0.14/plugins/barcode/inc/qrcode.class.php at line 159
Backtrace :
plugins/barcode/inc/qrcode.class.php:381 PluginBarcodeQRcode->generateQRcode()
src/MassiveAction.php:1420 PluginBarcodeQRcode::processMassiveActionsForOneItemtype()
src/MassiveAction.php:1398 MassiveAction->processForSeveralItemtypes()
front/massiveaction.php:62 MassiveAction->process()
public/index.php:82 require()

Voici, le contenu de la ligne 159 de ce fichier "barcode/inc/qrcode.class.php" :
QRcode::png($codeContents, GLPI_PLUGIN_DOC_DIR.'/barcode/tmp'.$rand.'-'.$number.'.png', QR_ECLEVEL_L, 4);

Il s'avère que, après quelques recherches, je trouve la méthode QRcode::png dans le fichier suivant :

  • barcode/vendor/deltalab/phpqrcode/qrencode.php (ligne 283)

Dès lors que l'erreur est "Call to undefined method QRcode::png()", cela signifie que le fichier barcode/vendor/deltalab/phpqrcode/qrencode.php n'a pas été chargé par le ClassLoader.
Je confirme l'erreur puisque juste avant le chargement de la méthode QRcode::png(), j'ai invoqué un test du type "if (!class_exists('QRcode', false)) {..." et cette condition est VRAI.

Donc, question : comment fonctionne le chargement des fichiers de classe de type "vendor" avec les plugins GLPI ?

from barcode.

EngelenH avatar EngelenH commented on August 15, 2024

For what it is worth ... Decided to go a different way ... The code in question is pretty old (2010 I believe). I just used chillerlan/php-qrcode as a drop-in replacement.

Just ran the composer for it and problem solved...

composer require chillerlan/php-qrcode

Using GLPI through hosting and a cpanel install and got a little tired of looking for needles in haystacks to get all the tidbits working correctly.

from barcode.

marc-henri avatar marc-henri commented on August 15, 2024

I close this monologue, hoping that it will be useful to other users of the GLPI application.

WARNING: On your GLPI 10.0.x instance, if you use the PDF (version 3.0.0) and Barcode (version 2.7.1) plugins together, be aware that Barcode will not work because the autoload function of the external "vendor" classes will give preference to the external classes of the PDF plugin rather than to those of the Barcode plugin.
This results in an incompatibility causing the error:
CRITICAL: *** Uncaught Exception Error: Call to undefined method QRcode::png() in /var/www/glpi-10.0.14/plugins/barcode/inc/qrcode.class.php at line 159

For the moment, I have decided to deactivate the PDF plugin which does not necessarily meet a need (unlike printing QR codes).

This does not change the fact that there is a compartmentalization defect with the GLPI (Core) classLoader, making certain plugins incompatible when other plugins are present.

#-------- Français -----------
Je clôture ce monologue, espérant qu'il sera utile à d'autres usagers de l'application GLPI.

ATTENTION : Sur votre instance de GLPI 10.0.x, si vous utilisez conjointement les plugins PDF (version 3.0.0) et Barcode (version 2.7.1), sachez que Barcode ne fonctionnera pas car la fonction autoload des classes externes "vendor" accordera la préférence aux classes externes du plugin PDF plutôt qu'aux classes externes du plugin Barcode.
Il en résulte une incompatibilité provoquant l'erreur :
CRITICAL: *** Uncaught Exception Error: Call to undefined method QRcode::png() in /var/www/glpi-10.0.14/plugins/barcode/inc/qrcode.class.php at line 159

Pour le moment, je me suis contacté de désactiver le plugin PDF qui ne répond pas nécessairement à un besoin (au contraire de l'impression des QRCode).

Cela n'enlève rien à un défaut de cloisonnement avec le classLoader de GLPI (Core) rendant, de facto, certains plugins incompatible quand d'autres plugins sont présents.

from barcode.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.