bit-wasp / buffertools-php Goto Github PK
View Code? Open in Web Editor NEWToolbox for working with binary and hex data. Similar to NodeJS Buffer.
Toolbox for working with binary and hex data. Similar to NodeJS Buffer.
this has caused problems on occasion, especially if people are using older bitcoin-php versions.. maybe there's no point to using phpecc now that it's GMP only.
An additional zero is added after hex/getHex operations applied.
I've checked and it looks like it is pack/unpack behavior for the 'H*' format.
The commit with a test to demonstrate the issue: olegabr@56d7bb3
$ ./vendor/bin/phpunit
PHPUnit 6.5.14 by Sebastian Bergmann and contributors.
Error: No code coverage driver is available
........F...................................................... 63 / 196 ( 32%)
............................................................... 126 / 196 ( 64%)
............................................................... 189 / 196 ( 96%)
....... 196 / 196 (100%)
Time: 40 ms, Memory: 6.00MB
There was 1 failure:
1) BitWasp\Buffertools\Tests\BufferTest::testSerialize2
Failed asserting that two strings are identical.
--- Expected
+++ Actual
@@ @@
-'12a05f200'
+'12a05f2000'
buffertools-php/tests/BufferTest.php:106
FAILURES!
Tests: 196, Assertions: 592, Failures: 1
Can you tag a new release now that #91 is merged? This fixes an issue when using PHP 7.4 as it will otherwise error on the deprecated use of the ternary operator.
Right now using https://github.com/Bit-Wasp/bitcoin-php does not pull in this fix as it's not in one of the releases.
Is there currently a way to skip a byte and manually move the position forward and backward? I looked for any skip, rewind or any methods that would allow me to modify the position
variable but there doesn't seem to be one.
<?php
(new TemplateFactory())
->uint64le()
->uint8le() // Reading a byte to skip it
->uint64le()
->getTemplate()
->parse($parser);
This is what I am currently doing to skip a byte but that seems rather weird. Is there any better way skip N bytes?
Hey @afk11 (and maybe @btcdrak can butt in too :D?)
I just added 8fe7be5 because they were part of your cleanup PR to bitcoin-php but I don't like it xD
Considering we have a Parser
for writing stuff, would it maybe make sense to make the Buffer
immutable? so prepend
and append
would return a new instance of Buffer
with the result, but not modifying the original instance?
And another is, maybe we could enforce the size that is specified?
much like how zval works in extensions, if there's more data than the size then you won't be able to get it
and we can also use the specified size to zero pad the binary or hex values returned from it?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.