From d9954fb6e241b9c16f9f933754a3cc867884542c Mon Sep 17 00:00:00 2001 From: Ben Ramsey Date: Sun, 9 Nov 2014 13:35:59 -0500 Subject: [PATCH 1/6] Beautifying the CHANGELOG --- CHANGELOG.md | 115 ++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 96 insertions(+), 19 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2698915..e672cb7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,63 +1,140 @@ -* 2.7.4 (2014-10-29) +# Rhumsaa\Uuid Changelog + +## 2.7.4 + +_Released: 2014-10-29_ + * Changed loop in `generateBytes()` from `foreach` to `for`; see #33 * Use `toString()` in README examples to avoid confusion * Exclude build/development tools from releases using .gitattributes * Set timezone properly for tests -* 2.7.3 (2014-08-27) + +## 2.7.3 + +_Released: 2014-08-27_ + * Fixed upper range for `mt_rand` used in version 4 UUIDs -* 2.7.2 (2014-07-28) + +## 2.7.2 + +_Released: 2014-07-28_ + * Upgraded to PSR-4 autoloading * Testing upgrades: * Testing against PHP 5.6 * Testing with PHPUnit 4 * Using Coveralls.io to generate code coverage reports * Documentation fixes -* 2.7.1 (2014-02-19) + +## 2.7.1 + +_Released: 2014-02-19_ + * Moved moontoast/math and symfony/console to require-dev; fixes #20 * Now supporting symfony/console for 2.3 (LTS version); fixes #21 * Updated tests to run even when dev packages are not installed (skips tests if requirements are not met) -* 2.7.0 (2014-01-31) + +## 2.7.0 + +_Released: 2014-01-31_ + * Moved UUID validation regex pattern into constant for external use (`Uuid::VALID_PATTERN`) -* 2.6.1 (2014-01-27) + +## 2.6.1 + +_Released: 2014-01-27_ + * Fixed bug where `uuid` console application could not find the Composer autoloader when installed in another project -* 2.6.0 (2014-01-17) + +## 2.6.0 + +_Released: 2014-01-17_ + * Introduced `uuid` console application for generating and decoding UUIDs from CLI (run `./bin/uuid` for details) * Added `Uuid::getInteger()` to retrieve a Moontoast\Math\BigNumber representation of the 128-bit integer representing the UUID * Added `Uuid::getHex()` to retrieve the hexadecimal representation of the UUID * Now using netstat on Linux to capture the node for a version 1 UUID * Now requiring Moontoast\Math as part of the regular package requirements, not just the dev requirements -* 2.5.0 (2013-10-30) + +## 2.5.0 + +_Released: 2013-10-30_ + * Using `openssl_random_pseudo_bytes()`, if available, to generate random bytes, by merging in PR #15 from @dfreudenberger * Fixed test for Rhumsaa\Uuid\Doctrine\UuidType, by merging in PR #17 from @dfreudenberger * Documentation fixes -* 2.4.0 (2013-07-29) + +## 2.4.0 + +_Released: 2013-07-29_ + * `Uuid::getVersion()` now returns null if the UUID isn't an RFC 4122 variant * `Uuid::fromString()` now supports a 128-bit integer formatted as a hexadecimal string (UUID without dashes) * Tests have been greatly enhanced, borrowing from the Python UUID library -* 2.3.0 (2013-07-16) + +## 2.3.0 + +_Released: 2013-07-16_ + * Added `Uuid::fromBytes()` by merging in PR #14 from @asm89 -* 2.2.0 (2013-07-04) + +## 2.2.0 + +_Released: 2013-07-04_ + * Added `Doctrine\UuidType::requiresSQLCommentHint()` method by merging in PR #13 from @zerrvox * Removed `"minimum-stability": "dev"` from composer.json -* 2.1.2 (2013-07-03) + +## 2.1.2 + +_Released: 2013-07-03_ + * @ericthelin found cases where the system node was coming back with uppercase hexadecimal digits; this ensures that case in the node is converted to lowercase -* 2.1.1 (2013-04-29) + +## 2.1.1 + +_Released: 2013-04-29_ + * Fixed NIL bug in `Uuid::isValid()` method, reported by @ocubom in PR #11 -* 2.1.0 (2013-04-15) + +## 2.1.0 + +_Released: 2013-04-15_ + * Added static `Uuid::isValid()` method for checking whether a string is a valid UUID -* 2.0.0 (2013-02-11) + +## 2.0.0 + +_Released: 2013-02-11_ + * Break: `Uuid` class is now marked as "final" * Break: `Uuid::getLeastSignificantBits()` no longer returns an integer on 64-bit platforms; it requires `moontoast/math` * Break: `Uuid::getMostSignificantBits()` no longer returns an integer on 64-bit platforms; it requires `moontoast/math` * Break: Moved `UnsupportedOperationException` to the `Exception` subnamespace * Added support for 32-bit platforms * Added generated API documentation to the repository -* 1.1.2 (2012-11-29) + +## 1.1.2 + +_Released: 2012-11-29_ + * Relaxed Doctrine type conversion rules -* 1.1.1 (2012-08-27) + +## 1.1.1 + +_Released: 2012-08-27_ + * Removed `final` keyword from `Uuid` class -* 1.1.0 (2012-08-06) + +## 1.1.0 + +_Released: 2012-08-06_ + * Added `Doctrine\UuidType` as a field mapping type for the Doctrine Database Abstraction Layer (DBAL) * Improved tests and code coverage -* 1.0.0 (2012-07-19) + +## 1.0.0 + +_Released: 2012-07-19_ + * Initial release From cca98c652cac412c9c2f109c69e5532f313435fc Mon Sep 17 00:00:00 2001 From: Ben Ramsey Date: Sun, 9 Nov 2014 13:42:56 -0500 Subject: [PATCH 2/6] Bumping the version number to 2.8.0 --- CHANGELOG.md | 8 ++++++++ src/Uuid.php | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e672cb7..e4a9b58 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Rhumsaa\Uuid Changelog +## 2.8.0 + +_Released: 2014-11-09_ + + * Added static `fromInteger()` method to create UUIDs from string integer or `\Moontoast\Math\BigNumber`. + * Friendlier Doctrine conversion to Uuid or string. + * Documentation fixes. + ## 2.7.4 _Released: 2014-10-29_ diff --git a/src/Uuid.php b/src/Uuid.php index b25777e..ec03ecd 100644 --- a/src/Uuid.php +++ b/src/Uuid.php @@ -93,7 +93,7 @@ final class Uuid /** * Version of the Rhumsaa\Uuid package */ - const VERSION = '2.8.x-dev'; + const VERSION = '2.8.0'; /** * For testing, 64-bit system override; if true, treat the system as 32-bit From 96a01caa11a2f4136293bf60bbe247597b3eeb36 Mon Sep 17 00:00:00 2001 From: Ben Ramsey Date: Sun, 9 Nov 2014 13:48:45 -0500 Subject: [PATCH 3/6] Setting version in master to 2.8.x-dev --- src/Uuid.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Uuid.php b/src/Uuid.php index ec03ecd..b25777e 100644 --- a/src/Uuid.php +++ b/src/Uuid.php @@ -93,7 +93,7 @@ final class Uuid /** * Version of the Rhumsaa\Uuid package */ - const VERSION = '2.8.0'; + const VERSION = '2.8.x-dev'; /** * For testing, 64-bit system override; if true, treat the system as 32-bit From 610458a6c2711b6578c6874f594d3b06aa275131 Mon Sep 17 00:00:00 2001 From: Larry Lewis Date: Wed, 7 Jan 2015 16:19:19 +1100 Subject: [PATCH 4/6] Added PHPStorm to ignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index de2b378..c9d8ead 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +.idea *.phar .DS_Store build From c90233d6e2b139433c42fe9d6bea2c36fef1ed96 Mon Sep 17 00:00:00 2001 From: Yves Berkholz Date: Wed, 7 Jan 2015 10:12:19 +0100 Subject: [PATCH 5/6] Update Uuid.php - change method "getIfconfig()" to use "passthru()" and an output buffer instead of the "backtick operator" which may be disabled for security reasons - change method "getNodeFromSystem()" to process detection only once per runtime - because of great performance impact (Test: generate 100 UUIDs[v1] before ~21s / after ~200ms) --- src/Uuid.php | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/Uuid.php b/src/Uuid.php index b25777e..b36a833 100644 --- a/src/Uuid.php +++ b/src/Uuid.php @@ -1134,20 +1134,21 @@ final class Uuid */ protected static function getIfconfig() { + ob_start(); switch (strtoupper(substr(php_uname('a'), 0, 3))) { case 'WIN': - $ifconfig = `ipconfig /all 2>&1`; + passthru('ipconfig /all 2>&1'); break; case 'DAR': - $ifconfig = `ifconfig 2>&1`; + passthru('ifconfig 2>&1'); break; case 'LIN': default: - $ifconfig = `netstat -ie 2>&1`; + passthru('netstat -ie 2>&1'); break; } - return $ifconfig; + return ob_get_clean(); } /** @@ -1162,7 +1163,12 @@ final class Uuid */ protected static function getNodeFromSystem() { - $node = null; + static $node = null; + + if($node !== null) { + return $node; + } + $pattern = '/[^:]([0-9A-Fa-f]{2}([:-])[0-9A-Fa-f]{2}(\2[0-9A-Fa-f]{2}){4})[^:]/'; $matches = array(); From 07d06dd3ecfd25b6dce6e00560e7daf9166a36a8 Mon Sep 17 00:00:00 2001 From: Francesco Laffi Date: Mon, 9 Mar 2015 13:55:38 +0100 Subject: [PATCH 6/6] getInteger should suggest getHex getInteger is suggesting getMostSignificantBitsHex if the math library is not available --- src/Uuid.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Uuid.php b/src/Uuid.php index b36a833..dc68d0e 100644 --- a/src/Uuid.php +++ b/src/Uuid.php @@ -448,7 +448,7 @@ final class Uuid 'Cannot call ' . __METHOD__ . ' without support for large ' . 'integers, since integer is an unsigned ' . '128-bit integer; Moontoast\Math\BigNumber is required' - . '; consider calling getMostSignificantBitsHex instead' + . '; consider calling getHex instead' ); }