Re: [PHP-CVS] com php-src: Fixed bug in new stream_get_line() when using NUL as a delimiter.: ext/standard/tests/streams/stream_get_line_NUL_delimiter.phpt main/streams/streams.c

2012-04-08 Thread Gustavo Lopes
On Sun, 08 Apr 2012 05:36:38 +0100, Christopher Jones  
 wrote:





On 4/7/12 8:32 AM, Gustavo André dos Santos Lopes wrote:

Commit:0f180a63ebb2d65bbe49b68d2430639b20443e9a
Author:Gustavo André dos Santos Lopes   
Sat, 7 Apr 2012 16:32:19 +0100

Parents:   9bf8cd4b3437f6335e20843c9e3668b44761feba
Branches:  PHP-5.3 PHP-5.4 master

Link:
http://git.php.net/?p=php-src.git;a=commitdiff;h=0f180a63ebb2d65bbe49b68d2430639b20443e9a


Log:
Fixed bug in new stream_get_line() when using NUL as a delimiter.

This is the issue Derick spotted a few days ago..

Changed paths:
   A  ext/standard/tests/streams/stream_get_line_NUL_delimiter.phpt
   M  main/streams/streams.c


Can you add a NEWS entry?



This fixes a problem caused by a change that's not in any released PHP  
version.


--
Gustavo Lopes

--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] com php-src: Fix bug #61660: bin2hex(hex2bin($data)) != $data: NEWS ext/standard/string.c ext/standard/tests/strings/bug61660.phpt

2012-04-08 Thread Nikita Popov
Commit:7ae93a2c4c8a51cc2aec9977ce3c83c100e382a0
Author:Nikita Popov  Sun, 8 Apr 2012 22:36:50 +0200
Parents:   f7d407678570f8e4063b70bd30f3fc19c10442ea
Branches:  PHP-5.4 master

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=7ae93a2c4c8a51cc2aec9977ce3c83c100e382a0

Log:
Fix bug #61660: bin2hex(hex2bin($data)) != $data

If the input data has an odd length a warning is thrown and false is returned.

Bugs:
https://bugs.php.net/61660

Changed paths:
  M  NEWS
  M  ext/standard/string.c
  A  ext/standard/tests/strings/bug61660.phpt


Diff:
diff --git a/NEWS b/NEWS
index 7b80084..42f7cd9 100644
--- a/NEWS
+++ b/NEWS
@@ -9,6 +9,7 @@ PHP 
   NEWS
   . "Connection: close" instead of "Connection: closed" (Gustavo)
 
 - Core:
+  . Fixed bug #61660 (bin2hex(hex2bin($data)) != $data). (Nikita Popov)
   . Fixed bug #61650 (ini parser crashes when using ${} ini variables
 (without apache2)). (Laruence)
   . Fixed bug #61605 (header_remove() does not remove all headers). (Laruence)
diff --git a/ext/standard/string.c b/ext/standard/string.c
index 0aade78..5c33232 100644
--- a/ext/standard/string.c
+++ b/ext/standard/string.c
@@ -266,6 +266,11 @@ PHP_FUNCTION(hex2bin)
return;
}
 
+   if (datalen % 2 != 0) {
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, "Hexadecimal input 
string must have an even length");
+   RETURN_FALSE;
+   }
+
result = php_hex2bin((unsigned char *)data, datalen, &newlen);
 
if (!result) {
diff --git a/ext/standard/tests/strings/bug61660.phpt 
b/ext/standard/tests/strings/bug61660.phpt
new file mode 100644
index 000..010ea47
--- /dev/null
+++ b/ext/standard/tests/strings/bug61660.phpt
@@ -0,0 +1,11 @@
+--TEST--
+Bug #61660: bin2hex(hex2bin($data)) != $data
+--FILE--
+
+--EXPECTF--
+Warning: hex2bin(): Hexadecimal input string must have an even length in %s on 
line %d
+bool(false)


--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-CVS] com php-src: Fix bug #61660: bin2hex(hex2bin($data)) != $data: NEWS ext/standard/string.c ext/standard/tests/strings/bug61660.phpt

2012-04-08 Thread Pierre Joye
hi!

UPGRADING note too please :)

Cheers,

On Sun, Apr 8, 2012 at 10:36 PM, Nikita Popov  wrote:
> Commit:    7ae93a2c4c8a51cc2aec9977ce3c83c100e382a0
> Author:    Nikita Popov          Sun, 8 Apr 2012 22:36:50 +0200
> Parents:   f7d407678570f8e4063b70bd30f3fc19c10442ea
> Branches:  PHP-5.4 master
>
> Link:       
> http://git.php.net/?p=php-src.git;a=commitdiff;h=7ae93a2c4c8a51cc2aec9977ce3c83c100e382a0
>
> Log:
> Fix bug #61660: bin2hex(hex2bin($data)) != $data
>
> If the input data has an odd length a warning is thrown and false is returned.
>
> Bugs:
> https://bugs.php.net/61660
>
> Changed paths:
>  M  NEWS
>  M  ext/standard/string.c
>  A  ext/standard/tests/strings/bug61660.phpt
>
>
> Diff:
> diff --git a/NEWS b/NEWS
> index 7b80084..42f7cd9 100644
> --- a/NEWS
> +++ b/NEWS
> @@ -9,6 +9,7 @@ PHP                                                           
>              NEWS
>   . "Connection: close" instead of "Connection: closed" (Gustavo)
>
>  - Core:
> +  . Fixed bug #61660 (bin2hex(hex2bin($data)) != $data). (Nikita Popov)
>   . Fixed bug #61650 (ini parser crashes when using ${} ini variables
>     (without apache2)). (Laruence)
>   . Fixed bug #61605 (header_remove() does not remove all headers). (Laruence)
> diff --git a/ext/standard/string.c b/ext/standard/string.c
> index 0aade78..5c33232 100644
> --- a/ext/standard/string.c
> +++ b/ext/standard/string.c
> @@ -266,6 +266,11 @@ PHP_FUNCTION(hex2bin)
>                return;
>        }
>
> +       if (datalen % 2 != 0) {
> +               php_error_docref(NULL TSRMLS_CC, E_WARNING, "Hexadecimal 
> input string must have an even length");
> +               RETURN_FALSE;
> +       }
> +
>        result = php_hex2bin((unsigned char *)data, datalen, &newlen);
>
>        if (!result) {
> diff --git a/ext/standard/tests/strings/bug61660.phpt 
> b/ext/standard/tests/strings/bug61660.phpt
> new file mode 100644
> index 000..010ea47
> --- /dev/null
> +++ b/ext/standard/tests/strings/bug61660.phpt
> @@ -0,0 +1,11 @@
> +--TEST--
> +Bug #61660: bin2hex(hex2bin($data)) != $data
> +--FILE--
> + +
> +var_dump(hex2bin('123'));
> +
> +?>
> +--EXPECTF--
> +Warning: hex2bin(): Hexadecimal input string must have an even length in %s 
> on line %d
> +bool(false)
>
>
> --
> PHP CVS Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>



-- 
Pierre

@pierrejoye | http://blog.thepimp.net | http://www.libgd.org

--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-CVS] com php-src: Fix bug #61660: bin2hex(hex2bin($data)) != $data: NEWS ext/standard/string.c ext/standard/tests/strings/bug61660.phpt

2012-04-08 Thread Laruence
On Mon, Apr 9, 2012 at 4:36 AM, Nikita Popov  wrote:
> Commit:    7ae93a2c4c8a51cc2aec9977ce3c83c100e382a0
> Author:    Nikita Popov          Sun, 8 Apr 2012 22:36:50 +0200
> Parents:   f7d407678570f8e4063b70bd30f3fc19c10442ea
> Branches:  PHP-5.4 master
>
> Link:       
> http://git.php.net/?p=php-src.git;a=commitdiff;h=7ae93a2c4c8a51cc2aec9977ce3c83c100e382a0
>
> Log:
> Fix bug #61660: bin2hex(hex2bin($data)) != $data
>
> If the input data has an odd length a warning is thrown and false is returned.
>
> Bugs:
> https://bugs.php.net/61660
>
> Changed paths:
>  M  NEWS
>  M  ext/standard/string.c
>  A  ext/standard/tests/strings/bug61660.phpt
>
>
> Diff:
> diff --git a/NEWS b/NEWS
> index 7b80084..42f7cd9 100644
> --- a/NEWS
> +++ b/NEWS
> @@ -9,6 +9,7 @@ PHP                                                           
>              NEWS
>   . "Connection: close" instead of "Connection: closed" (Gustavo)
>
>  - Core:
> +  . Fixed bug #61660 (bin2hex(hex2bin($data)) != $data). (Nikita Popov)
>   . Fixed bug #61650 (ini parser crashes when using ${} ini variables
>     (without apache2)). (Laruence)
>   . Fixed bug #61605 (header_remove() does not remove all headers). (Laruence)
> diff --git a/ext/standard/string.c b/ext/standard/string.c
> index 0aade78..5c33232 100644
> --- a/ext/standard/string.c
> +++ b/ext/standard/string.c
> @@ -266,6 +266,11 @@ PHP_FUNCTION(hex2bin)
>                return;
>        }
>
> +       if (datalen % 2 != 0) {
Hi:
I prefer to use datalen & 1, but up to you  :)

thanks
> +               php_error_docref(NULL TSRMLS_CC, E_WARNING, "Hexadecimal 
> input string must have an even length");
> +               RETURN_FALSE;
> +       }
> +
>        result = php_hex2bin((unsigned char *)data, datalen, &newlen);
>
>        if (!result) {
> diff --git a/ext/standard/tests/strings/bug61660.phpt 
> b/ext/standard/tests/strings/bug61660.phpt
> new file mode 100644
> index 000..010ea47
> --- /dev/null
> +++ b/ext/standard/tests/strings/bug61660.phpt
> @@ -0,0 +1,11 @@
> +--TEST--
> +Bug #61660: bin2hex(hex2bin($data)) != $data
> +--FILE--
> + +
> +var_dump(hex2bin('123'));
> +
> +?>
> +--EXPECTF--
> +Warning: hex2bin(): Hexadecimal input string must have an even length in %s 
> on line %d
> +bool(false)
>
>
> --
> PHP CVS Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>



-- 
Laruence  Xinchen Hui
http://www.laruence.com/

--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-CVS] com php-src: Fixed bug in new stream_get_line() when using NUL as a delimiter.: ext/standard/tests/streams/stream_get_line_NUL_delimiter.phpt main/streams/streams.c

2012-04-08 Thread Stas Malyshev
Hi!

> This fixes a problem caused by a change that's not in any released PHP  
> version.

Which change caused the problem?


-- 
Stanislav Malyshev, Software Architect
SugarCRM: http://www.sugarcrm.com/
(408)454-6900 ext. 227

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php