You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<?php
require_once('vendor/autoload.php');
use rikudou\SkQrPayment\QrPayment;
use Rikudou\Iban\Iban\IBAN;
$payment = new QrPayment();
$payment
->setXzBinary('xz')
->setCurrency('EUR')
->setAmount(10)
->setComment('financny dar, ')
->setIbans([
new IBAN('SK6807200002891987426353')
]);
$qrString = $payment->getQrString();
echo $qrString;
?>
Output string is 0005C00 ???
Likewise, if I use your example from this webpage:
<?php
require_once('vendor/autoload.php');
use rikudou\SkQrPayment\QrPayment;
use Rikudou\Iban\Iban\IBAN;
$payment = new QrPayment(new IBAN('SK6807200002891987426353'));
$payment
->setXzBinary('xz')
->setAmount(500)
->setVariableSymbol('123456')
->setDueDate(new DateTime('+1 week'))
;
$qrString = $payment->getQrString();
// $qrString now holds the string to embed inside the QR code, in this example:
// 0004U0001M8GLP3E8KPT058IQ99QISMB02IH36MOD4BCKQQGVDE4641AOA2NURPCOPSALFG0LPG1C6N0E2JMC7RG2F4L2E57OCSHOUROGHOC8VTTPHHRFHU6VFTM8N80
echo $qrString;
?>
Output string is 0004U00 instead of supposed 0004U0001M8GLP3E8KPT058IQ99QISMB02IH36MOD4BCKQQGVDE4641AOA2NURPCOPSALFG0LPG1C6N0E2JMC7RG2F4L2E57OCSHOUROGHOC8VTTPHHRFHU6VFTM8N80
Did I miss to enable something somewhere, like some PHP extension or what?
Using QrPaymentSK v4.2.1
UPDATE
I was investigating some more in your getQrString() function in QrPayment.php file, and I found out that until the line 196 proc_close($xzProcess); variable $hashedData still holds all the correct values that were defined in $payment options (Ô ŔŹ 1 1 10 EUR 20240611 financny dar, 1 SK7783605207004206972399 BREXSKBX 0 0).
BUT as soon as the line $hashedData = bin2hex("\x00\x00" . pack('v', strlen($hashedData)) . $pipeOutput); happens, the new variable $hashedData suddenly becomes 00005600.
Investigating even more: important variable $pipeOutput is (seems to be) EMPTY, which means that stream_get_contents($xzProcessPipes[1]) returns nothing?!
Now as I search for the src of the $pipeOutput I see it is probably made by $xzProcess (cos that is the 1st time in the code it appears, thus my impression) which trying to call proc_open and I see it is the only call to proc_open in the file (so what I write further would have its logic, I guess), but interestingly enough, when I was trying to make Composer work I had to run it on a different PC, where I had to manually install PHP 8.1 from scratch, cos here on my PC where I run my testserver with PHP 8.1 it was Unable to launch a new process, which I was told by one guy (I guess author of the Composer, I'm not sure now) might be caused because my server - for some reason - does not allow proc_open. Which by itself is strange cos it is not disabled in the php.ini at all!
These are just my thoughts - still waiting for your actual answer tho!
UPDATE 2
Well, I tried it on that another PC where I was able successfully running Composer (= no problem with launching new process there), but the result is the same, thus I now think it is not the case of my server possibly not allowing proc_open - IT HAS TO BE SOMETHING ELSE!!! Indeed, I tested on my actual local testserver if proc_open works with this code, and it does work (output is echoed into the webpage in a loop):
If I save to a text file values with file_put_contents("test.txt", $pipeOutput.'<br>'.$hashedData.'<br>'.$xzProcessPipes[0].'<br>'.$xzProcessPipes[1]); right after the line 200 $hashedData = bin2hex("\x00\x00" . pack('v', strlen($hashedData)) . $pipeOutput);, then the result is: <br>00005600<br>Resource id #25<br>Resource id #26 (in case this info would help you somehow in your investigation at all).
Hmm, maybe the xz binary ($xzProcess) is not producing expected result = no result at all, actually (maybe if you know some 100% functional xz binaries download link that you are using yourself, I could try those instead of those I have now)?
I just deleted everything in the xy folder and...no error was produced, and code works still - how come??? There are literally no files in the xz folder now, yet all seems to working OK (except the broken output string, of course) - WHAT IS GOING ON HERE???
I WOULD SAY THIS REVELATION ALONE BASICALLY SAYING WHERE THE RPOBLEM IS: does your script actually check not only for the xz binaries folder, but also for the actual binary files in there it requires for the actual code/output? Seems not...
Everything here is just my uncompetent thoughts...7+ hrs passed and I still wait for any reaction from you. :-(((
The text was updated successfully, but these errors were encountered:
fafayqa
changed the title
$qrString broken?
$payment->getQrString(); broken?
Jun 11, 2024
Hi there, my guess would be that your xz binaries are wrong and don't produce the required results. You might try this for the xz tools: https://tukaani.org/xz/xz-5.2.9-windows.zip. Inside there's a bin_x86-64 directory which is most likely the one you need. Inside it there's the xz.exe, you might want to set the binary path to it.
Edit: Though I haven't tested it, I don't use Windows myself.
Output string is
0005C00
???Likewise, if I use your example from this webpage:
Output string is
0004U00
instead of supposed0004U0001M8GLP3E8KPT058IQ99QISMB02IH36MOD4BCKQQGVDE4641AOA2NURPCOPSALFG0LPG1C6N0E2JMC7RG2F4L2E57OCSHOUROGHOC8VTTPHHRFHU6VFTM8N80
Did I miss to enable something somewhere, like some PHP extension or what?
Using QrPaymentSK v4.2.1
UPDATE
I was investigating some more in your
getQrString()
function in QrPayment.php file, and I found out that until the line 196proc_close($xzProcess);
variable$hashedData
still holds all the correct values that were defined in$payment
options (Ô ŔŹ 1 1 10 EUR 20240611 financny dar, 1 SK7783605207004206972399 BREXSKBX 0 0
).BUT as soon as the line
$hashedData = bin2hex("\x00\x00" . pack('v', strlen($hashedData)) . $pipeOutput);
happens, the new variable$hashedData
suddenly becomes00005600
.Investigating even more: important variable
$pipeOutput
is (seems to be) EMPTY, which means thatstream_get_contents($xzProcessPipes[1])
returns nothing?!Now as I search for the src of the
$pipeOutput
I see it is probably made by$xzProcess
(cos that is the 1st time in the code it appears, thus my impression) which trying to callproc_open
and I see it is the only call toproc_open
in the file (so what I write further would have its logic, I guess), but interestingly enough, when I was trying to make Composer work I had to run it on a different PC, where I had to manually install PHP 8.1 from scratch, cos here on my PC where I run my testserver with PHP 8.1 it wasUnable to launch a new process
, which I was told by one guy (I guess author of the Composer, I'm not sure now) might be caused because my server - for some reason - does not allowproc_open
. Which by itself is strange cos it is not disabled in the php.ini at all!These are just my thoughts - still waiting for your actual answer tho!
UPDATE 2
Well, I tried it on that another PC where I was able successfully running Composer (= no problem with launching new process there), but the result is the same, thus I now think it is not the case of my server possibly not allowing
proc_open
- IT HAS TO BE SOMETHING ELSE!!! Indeed, I tested on my actual local testserver ifproc_open
works with this code, and it does work (output is echoed into the webpage in a loop):If I save to a text file values with
file_put_contents("test.txt", $pipeOutput.'<br>'.$hashedData.'<br>'.$xzProcessPipes[0].'<br>'.$xzProcessPipes[1]);
right after the line 200$hashedData = bin2hex("\x00\x00" . pack('v', strlen($hashedData)) . $pipeOutput);
, then the result is:<br>00005600<br>Resource id #25<br>Resource id #26
(in case this info would help you somehow in your investigation at all).Hmm, maybe the xz binary (
$xzProcess
) is not producing expected result = no result at all, actually (maybe if you know some 100% functional xz binaries download link that you are using yourself, I could try those instead of those I have now)?I just deleted everything in the xy folder and...no error was produced, and code works still - how come??? There are literally no files in the xz folder now, yet all seems to working OK (except the broken output string, of course) - WHAT IS GOING ON HERE???
I WOULD SAY THIS REVELATION ALONE BASICALLY SAYING WHERE THE RPOBLEM IS: does your script actually check not only for the xz binaries folder, but also for the actual binary files in there it requires for the actual code/output? Seems not...
Everything here is just my uncompetent thoughts...7+ hrs passed and I still wait for any reaction from you. :-(((
The text was updated successfully, but these errors were encountered: