Skip to content

No QR code appearing in settings #17567

Open
Open

Description

@netfiesta

I've upgraded from phpMyAdmin 5.0.2 to 5.2.0. Everything seems fine however after the upgrade the QR code to enable 2FA does not show up anymore. It shows a complete white block.
I did a inspect on the generated HTML code and notices this issue:

<svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="200" height="200" viewBox="0 0 200 200">
<rect x="0" y="0" width="200" height="200" fill="#fefefe"></rect>
<g transform="scale(3,509)">
<g transform="translate(4,4)"><path fill-rule="evenodd" d="[LONG QR CODE]" fill="#000000"></path></g></g></svg>

This <g transform="scale(3,509)"> seems to be incorrect. If I change the comma here to a dot, so 3.509 the QR shows fine.
I now made a workaround to fix this but of course it's a workaround...

I've added the following CSS to \templates\preferences\two_factor\configure.twig:

<style>
/* Added because QR would not appear because of scale(3,509) value instead of 3.509 (dot instead of comma). */
svg > g {scale: 3.5;}
</style>

I've also updated the Google2FA and Google2FA-QR libraries to it's latest versions which seems to be working fine.

Activity

  1. williamdes commented on May 30, 2022

    @williamdes
    Member

    Hi @netfiesta
    Could you share the server specific informations ?
    What processor architecture do you have ?

    Here is the source: https://github.com/Bacon/BaconQrCode/blob/d70c840f68657ce49094b8d91f9ee0cc07fbf66c/src/Renderer/Image/SvgImageBackEnd.php#L100

    Could you debug what the input values are ?

  2. added
    questionUsed when we need feedback from the submitter or when the issue is a question about PMA
    on May 30, 2022
  3. netfiesta commented on May 30, 2022

    @netfiesta
    Author

    Hi @netfiesta Could you share the server specific informations ? What processor architecture do you have ?

    Here is the source: https://github.com/Bacon/BaconQrCode/blob/d70c840f68657ce49094b8d91f9ee0cc07fbf66c/src/Renderer/Image/SvgImageBackEnd.php#L100

    Could you debug what the input values are ?

    Hello @williamdes,

    Thansk for your quick reply. Sure, my environment is a Windows Server 2019 with PHP 7.4.29 x64 NTS and MySQL 8.0.2.
    Hmmm, i'm not really a PHP guru, however I have skills in HTML, CSS, JS and C# (.NET) so no clue how I can debug these input values, but maybe you can help me a little with that? ;-)

  4. williamdes commented on May 30, 2022

    @williamdes
    Member

    Hi @netfiesta Could you share the server specific informations ? What processor architecture do you have ?
    Here is the source: https://github.com/Bacon/BaconQrCode/blob/d70c840f68657ce49094b8d91f9ee0cc07fbf66c/src/Renderer/Image/SvgImageBackEnd.php#L100
    Could you debug what the input values are ?

    Hello @williamdes,

    Thansk for your quick reply. Sure, my environment is a Windows Server 2019 with PHP 7.4.29 x64 NTS and MySQL 8.0.2. Hmmm, i'm not really a PHP guru, however I have skills in HTML, CSS, JS and C# (.NET) so no clue how I can debug these input values, but maybe you can help me a little with that? ;-)

    ;)

    Could you add this lines in the file just after the line (100) I sent you: phpMyAdminFolder/vendor/bacon/bacon-qr-code/src/Renderer/Image/SvgImageBackEnd.php

            $this->xmlWriter->writeAttribute(
                'transform-raw',
                sprintf('(%s, %s)', $size, self::PRECISION)
            );

    And then go back to the QR code page and send the HTML of the <svg zone ?

  5. netfiesta commented on May 30, 2022

    @netfiesta
    Author

    Hi again @williamdes,

    Sure, I just did, this is the output:

    <g transform="scale(3,509)" transform-raw="(3,5087719298246, 3)">
    <g transform="translate(4,4)">
    <path fill-rule="evenodd" d="[[i removed the QR, assueme that thats OK??]]" fill="#000000"></path>
    </g>
    </g>
    

    Is this what you need?

  6. williamdes commented on May 30, 2022

    @williamdes
    Member

    Hi again @williamdes,

    Sure, I just did, this is the output:

    <g transform="scale(3,509)" transform-raw="(3,5087719298246, 3)">
    <g transform="translate(4,4)">
    <path fill-rule="evenodd" d="[[i removed the QR, assueme that thats OK??]]" fill="#000000"></path>
    </g>
    </g>
    

    Is this what you need?

    Perfect !
    This strange, the xml writer maybe uses some system specific setting to format floats

    I did narrow down this to
    test.php

    <?php
    
    setlocale(LC_ALL, 'fr');
    
    $writer = new XMLWriter();
    $writer->openURI('php://output');
    $writer->startDocument('1.0','UTF-8');
    $writer->setIndent(TRUE);
    $size = 3.5087719298246;
    $writer->startElement('g');
    $writer->writeAttribute(
                'transform',
                sprintf('scale(%s)', round($size, 3))
            );
    php -f test.php

    On my workstation it does output <g transform="scale(3.509)"

    cc @DASPRiD (the author of the lib)

  7. added
    BugA problem or regression with an existing feature
    and removed
    questionUsed when we need feedback from the submitter or when the issue is a question about PMA
    on May 30, 2022
  8. liviuconcioiu commented on May 31, 2022

    @liviuconcioiu
    Contributor

    Decimal point is different. I've also found another issue like this on Github PHPOffice/PHPWord#1268.

    <?php
    
    setlocale(LC_ALL, 'fr_FR');
    print_r(localeconv());
    
    setlocale(LC_ALL, 'fr');
    print_r(localeconv());
    Array
    (
        [decimal_point] => .
        [thousands_sep] => 
        [int_curr_symbol] => 
        [currency_symbol] => 
        [mon_decimal_point] => 
        [mon_thousands_sep] => 
        [positive_sign] => 
        [negative_sign] => 
        [int_frac_digits] => 127
        [frac_digits] => 127
        [p_cs_precedes] => 127
        [p_sep_by_space] => 127
        [n_cs_precedes] => 127
        [n_sep_by_space] => 127
        [p_sign_posn] => 127
        [n_sign_posn] => 127
        [grouping] => Array
            (
            )
    
        [mon_grouping] => Array
            (
            )
    
    )
    Array
    (
        [decimal_point] => ,
        [thousands_sep] => �
        [int_curr_symbol] => EUR
        [currency_symbol] => �
        [mon_decimal_point] => ,
        [mon_thousands_sep] => �
        [positive_sign] => 
        [negative_sign] => -
        [int_frac_digits] => 2
        [frac_digits] => 2
        [p_cs_precedes] => 0
        [p_sep_by_space] => 1
        [n_cs_precedes] => 0
        [n_sep_by_space] => 1
        [p_sign_posn] => 1
        [n_sign_posn] => 1
        [grouping] => Array
            (
                [0] => 3
            )
    
        [mon_grouping] => Array
            (
                [0] => 3
            )
    
    )
    
  9. netfiesta commented on May 31, 2022

    @netfiesta
    Author

    Ok, can I do anything more to help here...?

  10. williamdes commented on May 31, 2022

    @williamdes
    Member

    Ok, can I do anything more to help here...?

    Thank you for your help, no for now it's okay
    I will try do make a fix

  11. netfiesta commented on May 31, 2022

    @netfiesta
    Author

    Ok, can I do anything more to help here...?

    Thank you for your help, no for now it's okay I will try do make a fix

    OK, that's great! For now I fixed it with the CSS workaround I made, at least it shows the QR again, but a definate solution would be great! Thanks again for the quick reply! :-)

  12. DASPRiD commented on Apr 18, 2024

    @DASPRiD

    FYI, there is a pull request to address this (for BaconQrCode v3), waiting for the author to address some outstanding issues:

    Bacon/BaconQrCode#177

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA problem or regression with an existing featurewaiting on upstreamIssues blocked by a third-party

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions