Hello,

I am not sure if I should open a ticket on this or not, that is why I am emailing you. Is there a 26 character limit on the "Pattern for QR-Code Content:" field? I am trying to make a sticker sheet of URL's. The module works if I do a simple URL, for example, "http://www.google.com" is fine. However, when I try something bigger, for example, "http://sports.espn.go.com/nfl/bottomline/scores", the module will generate a blank page. I also get the following error,

"user error: QRcode : Overflow error in G:\xampplite\htdocs\drupal\sites\all\modules\qrs_sheets\materials\lib\qr_img\qr_img.php on line 354."

When I go on the "Reports -> Recent log entries" section, I get the following details,

Details
Type php
Date Tuesday, October 19, 2010 - 18:40
User admin
Location http://localhost/drupal/content/qr-sticker
Referrer http://localhost/drupal/admin/content/node
Message QRcode : Overflow error in G:\xampplite\htdocs\drupal\sites\all\modules\qrs_sheets\materials\lib\qr_img\qr_img.php on line 354.
Severity error
Hostname ::1
Operations

Another test I did was, I inputted the following text, "abcdefghijklmnopqrstuvwxyz". That generated the sheet with no problem. However, when I inputted the text, "abcdefghijklmnopqrstuvwxyz1", I got the aforementioned error.

I did some research and I thought the issue is a memory issue with the php.ini. I upped the memory to 256MB and the issue still persists.

Any help will be appreciated.

Thanks!

Comments

john.karahalis’s picture

Thanks for reporting the issue, royb0y.

We just wanted to let you know that we are aware of your report and currently looking into it. We'll get back to you as soon as possible.

john.karahalis’s picture

Quick update.

We are seeing the same behavior. This seems to be related to a bug in the QR library we use, but we still have a bit more research to do before we can know how to fix it.

While we continue to look into this problem, there is one workaround you can use. It's not a permanent solution, but it should work for the time being.

Workaround
If you would like to use a URL with more than 26 characters as the "QR Pattern", first shorten the URL with a shortening service such as is.gd. This will provide you with a URL that is much shorter (in the case of is.gd, only 18 characters) that brings you to the same place.

john.karahalis’s picture

Version: 6.x-1.0-rc1 » 6.x-1.x-dev
Component: Sticker Sheets » Code
Assigned: Unassigned » john.karahalis
Category: support » bug
Priority: Normal » Major
royb0y’s picture

Thanks for the feedback, and thanks for a temporary workaround. Good to know that we came to the same conclusion with the workaround =).

However, this temporary solution is not going to work for me in the long run. I know you guys are working on this issue, and I hope you come to a resolution as soon as possible.

Please, keep me updated.

royb0y’s picture

Hello,

Just want to know if there's an update on this issue. Please let me know if you have an approximate timeline on when this issue is going to be resolved.

Thanks,

john.karahalis’s picture

Hey royb0y.

I'm sorry we've been a bit sluggish on this issue. We're a student research and development lab currently working on many projects simultaneously. I know a lot of us wouldn't mind working on this and other meetü software full-time (I know I'd love to), but unfortunately we don't always have that capacity.

I'm going to forward your thoughts onto the faculty lead for this project. I really do care about your interest in this module, so hopefully we find a way to help you out with the limited capacity that we do have.

In the mean time (and I don't mean for this to sound like a cop-out), we do have the benefit that the project is open-source. If anyone in your group or a similar group has a solution, we would be very happy to accept a patch.

krem’s picture

Hello,

Thanks for this great module !

I'm also getting blocked with this issue, I tried to check the source code but so far it seems that the problem comes from the QR library as you said...
Unfortunately I do not have the php skills to fix this, so I just hope that you will have at some point the time to look at it.

Best regards,
Clem

john.karahalis’s picture

Thanks for confirming this bug, Clem. We'll try to squeeze some time into researching this in more detail soon.

john.karahalis’s picture

So it looks like something weird is happening in the QR code library, and I'm starting to piece together what exactly it is. I'll post a more detailed response later today.

In the meantime...

Workaround 2
If your "Pattern for QR-Code Content" does not contain lower-case letters, your pattern can be up to 38 characters long. For example:
Does not work: http://opl.rit.edu/affiliates/
Works: HTTP://OPL.RIT.EDU/AFFILIATES/

I have determined what part of the code makes this distinction, but I do not know why it makes the distinction. As I said, a more detailed post will come shortly.

john.karahalis’s picture

It seems that the library is correct to allow text strings without lowercase letters to be longer. As far as I can tell, the QR code specification defines alphanumeric strings to be those containing numbers, capital letters, and certain symbols. Strings with lowercase letters are considered to be binary data. The following documents seem to confirm this understanding. (Unfortunately, ISO/IEC 18004:2006 (the QR Code standard) is not freely available, making it difficult to claim this with absolute certainty.)

http://mdn.morovia.com/manuals/qrcode-fontware/ch02s01.php#N1012B
http://www.qrme.co.uk/qr-code-forum.html?func=view&catid=3&id=324

Now consider the following table, detailing QR code capacity.

http://www.denso-wave.com/qrcode/vertable1-e.html

In this module, we are using "Version" 2 and "ECC Level" M. The table clearly specifies that QR codes of this type can contain 38 characters in alphanumeric mode (no lowercase letters), but only 26 characters in binary mode. That explains it.

Of course, this does not explain the solution. More on that next.

john.karahalis’s picture

So at the end of the day (literally, check the timestamps), it looks like the QR Code library is not fully to blame. It could have done more to fail gracefully ("Overflow error" didn't really tell us much), but the behavior itself was not wrong. We allowed the user to provide text strings longer than could possibly fit into a "Version 2" QR Code. The library realized this and refused to generate a QR Code.

Moving forward, I see two things that we need to do to fix this problem.

  1. If possible, this module should generate larger QR Codes. A Version 3 QR Code could hold 42 mixed-case characters and a Version 4 QR Code could hold 62 mixed-case characters (enough to contain the ESPN URL). Ideally, we might even want to leave the choice of QR Code size up to the user.
  2. There will always be some character limit, so we must enforce that limit in a way that makes sense to the user. We can't allow the user to provide a string that is too long and then allow the QR Code library to throw a mysterious error after the fact. If the limit is 62 characters, we should make it impossible for the users to enter 63 characters. We should make it impossible for the user to make a mistake, and fail gracefully if he somehow does.

Our institute (RIT) is closed down until after the new year, but we will try to look into these fixes after that time. I again cannot make any promises on behalf of my Lab, as we are a bit overbooked with other projects as always. (I hope that the December 24, 2am timestamp of this post lends credibility to my argument that we are happy to work on this, but sometimes have trouble finding time to do so.)

In the meantime, I hope that the technical information provided here is enough to be useful to other Drupal developers. If anyone would be interested in signing on as a co-maintainer of this module, feel free to get in touch with us. We would of course love and welcome the help.

john.karahalis’s picture

royb0y: Now that I have an understanding of the problem, I have a workaround that should actually work for you.

Workaround 3: Manually allow pattern to contain up to 62 characters

  1. Navigate to the location of the qrs_sheets module.
    • royb0y: In your case, it looks like the module is located at G:\xampplite\htdocs\drupal\sites\all\modules\qrs_sheets
  2. Navigate through the following directories: materials → lib → qr_img
  • royb0y: In your case, you should end up at G:\xampplite\htdocs\drupal\sites\all\modules\qrs_sheets\materials\lib\qr_img
  • Edit the file qr_img.php
  • Comment line 67 so that it looks like the following: //$qrcode_version=@$_GET["v"];
  • Add the following line directly after line 67: $qrcode_version=4;
  • You should now be able to use patterns up to 62 characters in length. If you need to use patterns that are even longer, try incrementally bumping this number up to 5, then 6, etc.
    Keep in mind that we can't guarantee that this workaround will not cause other problems -- we haven't tested it extensively as we have the rest of the software. If you run into any problems with this workaround, please let us know and we will try to work with you to resolve those new issues.
  • (While we're on the topic, it's worth noting that the QR Code library claims that it will adjust QR Code Version automatically, but it obviously doesn't seem to be doing that. Perhaps it does have a of bug after all. Something to look into while we work a fix for this problem.)