[PHP-CVS] com php-src: Added XOR support for expressions in INI parser: NEWS and zend_language_scanner.c: NEWS Zend/zend_ini_scanner.c

2013-03-27 Thread Lars Strojny
Commit:25b3c949440471ac39ec7126b9f15fc4cbc675ea
Author:Lars Strojny lstro...@php.net Wed, 27 Mar 2013 21:30:56 
+0100
Parents:   05016b7e960148b0d2d5bde279c22e05bc42d518
Branches:  PHP-5.5

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

Log:
Added XOR support for expressions in INI parser: NEWS and 
zend_language_scanner.c

Changed paths:
  M  NEWS
  M  Zend/zend_ini_scanner.c

diff --git a/NEWS b/NEWS
index 2a57c34..c1cd3e1 100644
--- a/NEWS
+++ b/NEWS
@@ -12,6 +12,7 @@ PHP   
 NEWS
 'zendparse'). (Laruence)
   . Fixed bug #64239 (Debug backtrace changed behavior since 5.4.10 or 5.4.11).
 (Dmitry, Laruence)
+  . Fixed bug #64523, allow XOR in php.ini. (Dejan Marjanovic, Lars)
 
 - Opcache:
   . Fixed bug # 64490 (struct flock undefined on FreeBSD). (Joe Watkins)
diff --git a/Zend/zend_ini_scanner.c b/Zend/zend_ini_scanner.c
index 35d9763..87ba664 100644
--- a/Zend/zend_ini_scanner.c
+++ b/Zend/zend_ini_scanner.c
@@ -381,7 +381,7 @@ yyc_INITIAL:
144, 144, 144, 144, 144, 144, 144, 144, 
144, 144, 144, 144, 144, 144, 144, 144, 
144, 144, 144, 144, 144, 144, 144, 144, 
-   144, 144, 144, 128, 144, 144, 144, 144, 
+   144, 144, 144, 128, 144, 144, 128, 144, 
144, 144, 144, 144, 144, 144, 144, 144, 
144, 144, 144, 144, 144, 144, 144, 144, 
144, 144, 144, 144, 144, 144, 144, 144, 
@@ -419,6 +419,7 @@ yyc_INITIAL:
case '':
case '(':
case ')':
+   case '^':
case '{':
case '|':
case '}':
@@ -437,8 +438,7 @@ yyc_INITIAL:
case '':
case '?':
case '@':
-   case ']':
-   case '^':   goto yy13;
+   case ']':   goto yy13;
case ';':   goto yy14;
case '=':   goto yy16;
case 'F':
@@ -695,35 +695,33 @@ yy31:
if (yybm[0+yych]  64) {
goto yy31;
}
-   if (yych = '') {
-   if (yych = '\r') {
-   if (yych = '\t') {
+   if (yych = '\'') {
+   if (yych = ' ') {
+   if (yych = '\n') {
if (yych = 0x08) goto yy25;
-   goto yy34;
+   if (yych = '\t') goto yy34;
} else {
-   if (yych = '\n') goto yy33;
-   if (yych = '\f') goto yy25;
+   if (yych != '\r') goto yy25;
}
} else {
-   if (yych = '#') {
-   if (yych = ' ') goto yy25;
-   if (yych = '#') goto yy25;
+   if (yych = '$') {
+   if (yych == '#') goto yy25;
} else {
-   if (yych == '%') goto yy25;
+   if (yych != '') goto yy25;
}
}
} else {
-   if (yych = '') {
-   if (yych = ')') {
-   if (yych = '\'') goto yy25;
+   if (yych = 'Z') {
+   if (yych = ';') {
+   if (yych = ')') goto yy33;
+   if (yych = ':') goto yy25;
} else {
-   if (yych != ';') goto yy25;
+   if (yych != '=') goto yy25;
}
} else {
-   if (yych = '[') {
-   if (yych = '=') goto yy33;
-   if (yych = 'Z') goto yy25;
-   goto yy28;
+   if (yych = '^') {
+   if (yych = '[') goto yy28;
+   if (yych = ']') goto yy25;
} else {
if (yych = 'z') goto yy25;
if (yych = 0x7F) goto yy25;
@@ -737,7 +735,7 @@ yy33:
{ /* TRUE value (when used outside option value/offset this 
causes parse error!) */
RETURN_TOKEN(BOOL_TRUE

[PHP-CVS] com php-src: Added XOR support for expressions in INI parser: Zend/zend_ini_parser.y Zend/zend_ini_scanner.l tests/func/011.phpt tests/func/bug64523.phpt

2013-03-27 Thread Lars Strojny
Commit:05016b7e960148b0d2d5bde279c22e05bc42d518
Author:Dejan Marjanovic dejan.marjano...@gmail.com Tue, 26 Mar 
2013 23:54:09 +0100
Committer: Lars Strojny lstro...@php.net  Wed, 27 Mar 2013 21:28:53 +0100
Parents:   6e8aa096964e1d723a9cae3572b2f0affa4e53c0
Branches:  PHP-5.5

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

Log:
Added XOR support for expressions in INI parser

Changed paths:
  M  Zend/zend_ini_parser.y
  M  Zend/zend_ini_scanner.l
  A  tests/func/011.phpt
  A  tests/func/bug64523.phpt


Diff:
diff --git a/Zend/zend_ini_parser.y b/Zend/zend_ini_parser.y
index 2d428c3..901baba 100644
--- a/Zend/zend_ini_parser.y
+++ b/Zend/zend_ini_parser.y
@@ -67,6 +67,9 @@ static void zend_ini_do_op(char type, zval *result, zval 
*op1, zval *op2)
case '':
i_result = i_op1  i_op2;
break;
+   case '^':
+   i_result = i_op1 ^ i_op2;
+   break;
case '~':
i_result = ~i_op1;
break;
@@ -264,7 +267,7 @@ ZEND_API int zend_parse_ini_string(char *str, zend_bool 
unbuffered_errors, int s
 %token BOOL_FALSE
 %token END_OF_LINE
 %token '=' ':' ',' '.' '' '\'' '^' '+' '-' '/' '*' '%' '$' '~' '' '' '?' 
'@' '{' '}'
-%left '|' ''
+%left '|' '' '^'
 %right '~' '!'
 
 %%
@@ -348,6 +351,7 @@ expr:
var_string_list { $$ = $1; }
|   expr '|' expr   { 
zend_ini_do_op('|', $$, $1, $3); }
|   expr '' expr   { 
zend_ini_do_op('', $$, $1, $3); }
+   |   expr '^' expr   { 
zend_ini_do_op('^', $$, $1, $3); }
|   '~' expr{ 
zend_ini_do_op('~', $$, $2, NULL); }
|   '!' expr{ 
zend_ini_do_op('!', $$, $2, NULL); }
|   '(' expr ')'{ $$ = $2; }
diff --git a/Zend/zend_ini_scanner.l b/Zend/zend_ini_scanner.l
index 5fb28d4..92fb08f 100644
--- a/Zend/zend_ini_scanner.l
+++ b/Zend/zend_ini_scanner.l
@@ -340,9 +340,9 @@ NEWLINE (\r|\n|\r\n)
 TABS_AND_SPACES [ \t]
 WHITESPACE [ \t]+
 CONSTANT [a-zA-Z_][a-zA-Z0-9_]*
-LABEL [^=\n\r\t;|$~(){}!\[]+
-TOKENS [:,.\[\]'()|^+-/*=%$!~?@{}]
-OPERATORS [|~()!]
+LABEL [^=\n\r\t;|^$~(){}!\[]+
+TOKENS [:,.\[\]'()|^+-/*=%$!~?@{}]
+OPERATORS [|^~()!]
 DOLLAR_CURLY ${
 
 SECTION_RAW_CHARS [^\]\n\r]
@@ -350,7 +350,7 @@ SINGLE_QUOTED_CHARS [^']
 RAW_VALUE_CHARS [^\n\r;\000]
 
 LITERAL_DOLLAR ($([^{\000]|(\\{ANY_CHAR})))
-VALUE_CHARS ([^$= \t\n\r;|~()!'\000]|{LITERAL_DOLLAR})
+VALUE_CHARS ([^$= \t\n\r;|^~()!'\000]|{LITERAL_DOLLAR})
 SECTION_VALUE_CHARS ([^$\n\r;'\]\\]|(\\{ANY_CHAR})|{LITERAL_DOLLAR})
 
 !* := yyleng = YYCURSOR - SCNG(yy_text);
diff --git a/tests/func/011.phpt b/tests/func/011.phpt
new file mode 100644
index 000..ec93214
--- /dev/null
+++ b/tests/func/011.phpt
@@ -0,0 +1,10 @@
+--TEST--
+Test bitwise AND, OR, XOR, NOT and logical NOT in INI via error_reporting
+--INI--
+error_reporting = E_ALL  E_NOTICE | E_STRICT ^ E_DEPRECATED  ~E_WARNING | 
!E_ERROR
+--FILE--
+?php
+echo ini_get('error_reporting');
+?
+--EXPECT--
+10248
diff --git a/tests/func/bug64523.phpt b/tests/func/bug64523.phpt
new file mode 100644
index 000..e0092ad
--- /dev/null
+++ b/tests/func/bug64523.phpt
@@ -0,0 +1,10 @@
+--TEST--
+Bug #64523: XOR not parsed in INI
+--INI--
+error_reporting = E_ALL ^ E_NOTICE ^ E_STRICT ^ E_DEPRECATED
+--FILE--
+?php
+echo ini_get('error_reporting');
+?
+--EXPECTF--
+22519


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



[PHP-CVS] com php-src: Fix build problem in C++11: Zend/zend_API.h

2013-01-30 Thread Lars Strojny
Commit:31468401b790e439734cb2ac8de928adaad74a85
Author:Jelle Zijlstra jelle.zijls...@gmail.com Wed, 30 Jan 2013 
11:08:32 -0500
Committer: Lars Strojny lstro...@php.net  Wed, 30 Jan 2013 19:07:52 +0100
Parents:   09b6e33b409c249531abb228b7a90e01cb94a0ae
Branches:  PHP-5.4

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

Log:
Fix build problem in C++11

Changed paths:
  M  Zend/zend_API.h


Diff:
diff --git a/Zend/zend_API.h b/Zend/zend_API.h
index ccbdf2c..e20f8d6 100644
--- a/Zend/zend_API.h
+++ b/Zend/zend_API.h
@@ -60,7 +60,7 @@ typedef struct _zend_fcall_info_cache {
zval *object_ptr;
 } zend_fcall_info_cache;
 
-#define ZEND_NS_NAME(ns, name) ns\\name
+#define ZEND_NS_NAME(ns, name) ns \\ name
 
 #define ZEND_FN(name) zif_##name
 #define ZEND_MN(name) zim_##name


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



[PHP-CVS] com php-src: Fix build problem in C++11: Zend/zend_API.h

2013-01-30 Thread Lars Strojny
Commit:86b364380720005f4e460eb99317f4ddfef25c52
Author:Jelle Zijlstra jelle.zijls...@gmail.com Wed, 30 Jan 2013 
11:08:32 -0500
Committer: Lars Strojny lstro...@php.net  Wed, 30 Jan 2013 19:08:24 +0100
Parents:   f0fe3d2dbecab94ebe279d549ed4fa54aea545c6
Branches:  PHP-5.5

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

Log:
Fix build problem in C++11

Changed paths:
  M  Zend/zend_API.h


Diff:
diff --git a/Zend/zend_API.h b/Zend/zend_API.h
index e5d612c..fb642c1 100644
--- a/Zend/zend_API.h
+++ b/Zend/zend_API.h
@@ -60,7 +60,7 @@ typedef struct _zend_fcall_info_cache {
zval *object_ptr;
 } zend_fcall_info_cache;
 
-#define ZEND_NS_NAME(ns, name) ns\\name
+#define ZEND_NS_NAME(ns, name) ns \\ name
 
 #define ZEND_FN(name) zif_##name
 #define ZEND_MN(name) zim_##name


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



[PHP-CVS] com php-src: Fix build problem in C++11: Zend/zend_API.h

2013-01-30 Thread Lars Strojny
Commit:09e73fd80e7cf6e0daa47fd33cfcc7346b540f30
Author:Jelle Zijlstra jelle.zijls...@gmail.com Wed, 30 Jan 2013 
11:08:32 -0500
Committer: Lars Strojny lstro...@php.net  Wed, 30 Jan 2013 19:08:45 +0100
Parents:   57438e5f77eac1e00cc310efc686be85f9f97942
Branches:  master

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

Log:
Fix build problem in C++11

Changed paths:
  M  Zend/zend_API.h


Diff:
diff --git a/Zend/zend_API.h b/Zend/zend_API.h
index e5d612c..fb642c1 100644
--- a/Zend/zend_API.h
+++ b/Zend/zend_API.h
@@ -60,7 +60,7 @@ typedef struct _zend_fcall_info_cache {
zval *object_ptr;
 } zend_fcall_info_cache;
 
-#define ZEND_NS_NAME(ns, name) ns\\name
+#define ZEND_NS_NAME(ns, name) ns \\ name
 
 #define ZEND_FN(name) zif_##name
 #define ZEND_MN(name) zim_##name


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



[PHP-CVS] com php-src: NEWS entry new OpenSSL option [doc]: NEWS ext/openssl/xp_ssl.c

2013-01-30 Thread Lars Strojny
Commit:836a2b1131dd007edad24d921dbdf42a8ac10e32
Author:Lars Strojny lstro...@php.net Thu, 31 Jan 2013 00:32:44 
+0100
Parents:   4a01ddfb5569da1b87dd4cac95c3f709fb607396
Branches:  PHP-5.4

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

Log:
NEWS entry new OpenSSL option [doc]

Changed paths:
  M  NEWS
  M  ext/openssl/xp_ssl.c


Diff:
diff --git a/NEWS b/NEWS
index d3a450e..2fc746e 100644
--- a/NEWS
+++ b/NEWS
@@ -47,6 +47,10 @@ PHP  
  NEWS
   . Fixed bug #63916 (PDO::PARAM_INT casts to 32bit int internally even
 on 64bit builds in pdo_sqlite). (srgoogleguy, Lars)
 
+- OpenSSL:
+  . New SSL stream context option to prevent CRIME attack vector. (Daniel 
Lowrey,
+Lars)
+
 17 Jan 2012, PHP 5.4.11
 
 - Core:
diff --git a/ext/openssl/xp_ssl.c b/ext/openssl/xp_ssl.c
index 8b0fe69..0e15238 100644
--- a/ext/openssl/xp_ssl.c
+++ b/ext/openssl/xp_ssl.c
@@ -398,7 +398,7 @@ static inline int php_openssl_setup_crypto(php_stream 
*stream,
 #if OPENSSL_VERSION_NUMBER = 0x1000L
{
zval **val;
-   
+
if (stream-context  SUCCESS == php_stream_context_get_option(
stream-context, ssl, 
disable_compression, val) 
zval_is_true(*val)) {


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



[PHP-CVS] com php-src: Added ssl context option, disable_compression: ext/openssl/xp_ssl.c

2013-01-30 Thread Lars Strojny
Commit:4a01ddfb5569da1b87dd4cac95c3f709fb607396
Author:Daniel Lowrey rdlow...@gmail.com Wed, 30 Jan 2013 14:45:31 
-0500
Committer: Lars Strojny lstro...@php.net  Thu, 31 Jan 2013 00:31:10 +0100
Parents:   bb4d11b405ae1f37a8b0e4db630e80c5678f0746
Branches:  PHP-5.4

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

Log:
Added ssl context option, disable_compression

The CRIME attack vector exploits TLS compression. This patch adds a stream 
context option
allowing servers to disable TLS compression for versions of OpenSSL = 1.0.0 
(which first
introduced the SSL_OP_NO_COMPRESSION option). A summary rundown of the CRIME 
attack can
be found at 
https://community.qualys.com/blogs/securitylabs/2012/09/14/crime-information-leakage-attack-against-ssltls

Thanks to @DaveRandom for pointing out the relevant section of code.

Changed paths:
  M  ext/openssl/xp_ssl.c


Diff:
diff --git a/ext/openssl/xp_ssl.c b/ext/openssl/xp_ssl.c
index fd452db..8b0fe69 100644
--- a/ext/openssl/xp_ssl.c
+++ b/ext/openssl/xp_ssl.c
@@ -395,6 +395,18 @@ static inline int php_openssl_setup_crypto(php_stream 
*stream,
}
 #endif
 
+#if OPENSSL_VERSION_NUMBER = 0x1000L
+   {
+   zval **val;
+   
+   if (stream-context  SUCCESS == php_stream_context_get_option(
+   stream-context, ssl, 
disable_compression, val) 
+   zval_is_true(*val)) {
+   SSL_CTX_set_options(sslsock-ctx, 
SSL_OP_NO_COMPRESSION);
+   }
+   }
+#endif
+
sslsock-ssl_handle = php_SSL_new_from_context(sslsock-ctx, stream 
TSRMLS_CC);
if (sslsock-ssl_handle == NULL) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, failed to create 
an SSL handle);


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



[PHP-CVS] com php-src: Merge branch 'PHP-5.4' into PHP-5.5: ext/openssl/xp_ssl.c

2013-01-30 Thread Lars Strojny
Commit:6b48a86a179a741da9f468e3a54994f7ee4ea211
Author:Lars Strojny lstro...@php.net Thu, 31 Jan 2013 00:33:46 
+0100
Parents:   8b972efe5f3e9d4e33d6e0193f3d56716a6cc59f 
836a2b1131dd007edad24d921dbdf42a8ac10e32
Branches:  master

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

Log:
Merge branch 'PHP-5.4' into PHP-5.5

Changed paths:
  MM  ext/openssl/xp_ssl.c


Diff:



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



[PHP-CVS] com php-src: Class Name Resolution As Scalar Via class Keyword: NEWS Zend/tests/class_name_as_scalar.phpt Zend/tests/class_name_as_scalar_error_001.phpt Zend/tests/class_name_as_scalar_err

2013-01-18 Thread Lars Strojny
Commit:8991ed016fa257c9f8ba42580c34568b3c2ce3e5
Author:Lars Strojny lstro...@php.net Sat, 19 Jan 2013 01:00:47 
+0100
Parents:   cd2b03d5ae835d333bec98e62592fd149fef544c
Branches:  PHP-5.5

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

Log:
Class Name Resolution As Scalar Via class Keyword

Changed paths:
  M  NEWS
  A  Zend/tests/class_name_as_scalar.phpt
  A  Zend/tests/class_name_as_scalar_error_001.phpt
  A  Zend/tests/class_name_as_scalar_error_002.phpt
  A  Zend/tests/class_name_as_scalar_error_003.phpt
  A  Zend/tests/class_name_as_scalar_error_004.phpt
  A  Zend/tests/class_name_as_scalar_error_005.phpt
  A  Zend/tests/class_name_as_scalar_error_006.phpt
  M  Zend/zend_compile.c
  M  Zend/zend_compile.h
  M  Zend/zend_language_parser.y
  M  Zend/zend_vm_def.h
  M  Zend/zend_vm_execute.h

diff --git a/NEWS b/NEWS
index 6395b34..3bb0373 100644
--- a/NEWS
+++ b/NEWS
@@ -4,6 +4,8 @@ PHP 
   NEWS
 
 - Core:
   . Fixed bug #63980 (object members get trimmed by zero bytes). (Laruence)
+  . Implemented RFC for Class Name Resolution As Scalar Via class Keyword.
+(Ralph Schindler, Nikita Popov, Lars)
 
 - General improvements:
   . Fixed bug #63874 (Segfault if php_strip_whitespace has heredoc). (Pierrick)
diff --git a/Zend/tests/class_name_as_scalar.phpt 
b/Zend/tests/class_name_as_scalar.phpt
new file mode 100644
index 000..38e55b1
--- /dev/null
+++ b/Zend/tests/class_name_as_scalar.phpt
@@ -0,0 +1,77 @@
+--TEST--
+class name as scalar from ::class keyword
+--FILE--
+?php
+
+namespace Foo\Bar {
+class One {
+// compile time constants
+const A = self::class;
+const B = Two::class;
+}
+class Two extends One {
+public static function run() {
+var_dump(self::class); // self compile time lookup
+var_dump(static::class); // runtime lookup
+var_dump(parent::class); // runtime lookup
+var_dump(Baz::class); // default compile time lookup
+}
+}
+class Three extends Two {
+// compile time static lookups
+public static function checkCompileTime(
+$one = self::class,
+$two = Baz::class,
+$three = One::A,
+$four = self::B
+) {
+var_dump($one, $two, $three, $four);
+}
+}
+echo In NS\n;
+var_dump(Moo::CLASS); // resolve in namespace
+}
+
+namespace {
+use Bee\Bop as Moo,
+Foo\Bar\One;
+echo Top\n;
+var_dump(One::class); // resolve from use
+var_dump(Boo::class); // resolve in global namespace
+var_dump(Moo::CLASS); // resolve from use as
+var_dump(\Moo::Class); // resolve fully qualified
+$class = One::class; // assign class as scalar to var
+$x = new $class; // create new class from original scalar assignment
+var_dump($x);
+Foo\Bar\Two::run(); // resolve runtime lookups
+echo Parent\n;
+Foo\Bar\Three::run(); // resolve runtime lookups with inheritance
+echo Compile Check\n;
+Foo\Bar\Three::checkCompileTime();
+}
+
+?
+--EXPECTF--
+In NS
+string(11) Foo\Bar\Moo
+Top
+string(11) Foo\Bar\One
+string(3) Boo
+string(7) Bee\Bop
+string(3) Moo
+object(Foo\Bar\One)#1 (0) {
+}
+string(11) Foo\Bar\Two
+string(11) Foo\Bar\Two
+string(11) Foo\Bar\One
+string(11) Foo\Bar\Baz
+Parent
+string(11) Foo\Bar\Two
+string(13) Foo\Bar\Three
+string(11) Foo\Bar\One
+string(11) Foo\Bar\Baz
+Compile Check
+string(13) Foo\Bar\Three
+string(11) Foo\Bar\Baz
+string(11) Foo\Bar\One
+string(11) Foo\Bar\Two
diff --git a/Zend/tests/class_name_as_scalar_error_001.phpt 
b/Zend/tests/class_name_as_scalar_error_001.phpt
new file mode 100644
index 000..1c7aa7e
--- /dev/null
+++ b/Zend/tests/class_name_as_scalar_error_001.phpt
@@ -0,0 +1,13 @@
+--TEST--
+class name as scalar from ::class keyword error using static in class constant
+--FILE--
+?php
+
+namespace Foo\Bar {
+class One {
+const Baz = static::class;
+}
+}
+?
+--EXPECTF--
+Fatal error: static::class cannot be used for compile-time class name 
resolution in %s on line %d
diff --git a/Zend/tests/class_name_as_scalar_error_002.phpt 
b/Zend/tests/class_name_as_scalar_error_002.phpt
new file mode 100644
index 000..59b7a2e
--- /dev/null
+++ b/Zend/tests/class_name_as_scalar_error_002.phpt
@@ -0,0 +1,13 @@
+--TEST--
+class name as scalar from ::class keyword error using parent in class constant
+--FILE--
+?php
+
+namespace Foo\Bar {
+class One {
+const Baz = parent::class;
+}
+}
+?
+--EXPECTF--
+Fatal error: parent::class cannot be used for compile-time class name 
resolution in %s on line %d
diff --git a/Zend/tests/class_name_as_scalar_error_003.phpt 
b/Zend/tests/class_name_as_scalar_error_003.phpt
new file mode 100644
index 000..9299041
--- /dev/null
+++ b/Zend/tests/class_name_as_scalar_error_003.phpt
@@ -0,0 +1,13 @@
+--TEST--
+class

[PHP-CVS] com php-src: Merge branch 'PHP-5.5': Zend/zend_vm_def.h Zend/zend_vm_execute.h

2013-01-18 Thread Lars Strojny
Commit:b1ddfcbee33b3793c1a0ad12992bbce21df42d45
Author:Lars Strojny lstro...@php.net Sat, 19 Jan 2013 01:01:39 
+0100
Parents:   f02373fc5a89a6819ea3e760756882c928b625e3 
8991ed016fa257c9f8ba42580c34568b3c2ce3e5
Branches:  master

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

Log:
Merge branch 'PHP-5.5'

Changed paths:
  MM  Zend/zend_vm_def.h
  MM  Zend/zend_vm_execute.h


Diff:



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



Re: [PHP-CVS] com php-src: - Fixed ZTS build: Zend/zend_compile.c

2013-01-18 Thread Lars Strojny
Thanks for fixing!

Am 19.01.2013 um 01:15 schrieb Felipe Pena fel...@php.net:

 Commit:e23fca8910b96f1c3bb26c6582c17c92fd6f2f7a
 Author:Felipe Pena felipe...@gmail.com Fri, 18 Jan 2013 
 22:15:08 -0200
 Parents:   087a1887022cbf7c3cc981c9ea8217f93736aa80
 Branches:  PHP-5.5 master
 
 Link:   
 http://git.php.net/?p=php-src.git;a=commitdiff;h=e23fca8910b96f1c3bb26c6582c17c92fd6f2f7a
 
 Log:
 - Fixed ZTS build
 
 Changed paths:
  M  Zend/zend_compile.c
 
 
 Diff:
 diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c
 index b574ad6..10eac2d 100644
 --- a/Zend/zend_compile.c
 +++ b/Zend/zend_compile.c
 @@ -2156,7 +2156,7 @@ void zend_do_resolve_class_name(znode *result, znode 
 *class_name, int is_static
   zend_do_fetch_constant(result, class_name, 
 constant_name, ZEND_RT, 1 TSRMLS_CC);
   break;
   case ZEND_FETCH_CLASS_DEFAULT:
 - zend_resolve_class_name(class_name, 
 ZEND_FETCH_CLASS_GLOBAL, 1);
 + zend_resolve_class_name(class_name, 
 ZEND_FETCH_CLASS_GLOBAL, 1 TSRMLS_CC);
   *result = *class_name;
   break;
   }
 
 
 --
 PHP CVS Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 


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



[PHP-CVS] com php-src: Bug #62489: dba_insert not working as expected: NEWS ext/dba/dba_flatfile.c ext/dba/dba_gdbm.c ext/dba/dba_inifile.c ext/dba/dba_qdbm.c ext/dba/tests/dba_db1.phpt ext/dba/tests/

2013-01-15 Thread Lars Strojny
Commit:eb40f73ca0a2a7563fbc95cc22741412e0beb76e
Author:Lars Strojny lstro...@php.net Tue, 15 Jan 2013 09:30:44 
+0100
Parents:   6dc80f080ea97c09b36d8a05ec7ec5067f394c01
Branches:  PHP-5.5

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

Log:
Bug #62489: dba_insert not working as expected

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

Changed paths:
  M  NEWS
  M  ext/dba/dba_flatfile.c
  M  ext/dba/dba_gdbm.c
  M  ext/dba/dba_inifile.c
  M  ext/dba/dba_qdbm.c
  M  ext/dba/tests/dba_db1.phpt
  M  ext/dba/tests/dba_db2.phpt
  M  ext/dba/tests/dba_db3.phpt
  M  ext/dba/tests/dba_db4_000.phpt
  M  ext/dba/tests/dba_dbm.phpt
  M  ext/dba/tests/dba_flatfile.phpt
  M  ext/dba/tests/dba_gdbm.phpt
  M  ext/dba/tests/dba_handler.inc
  M  ext/dba/tests/dba_inifile.phpt
  M  ext/dba/tests/dba_ndbm.phpt
  M  ext/dba/tests/dba_qdbm.phpt
  M  ext/dba/tests/dba_tcadb.phpt

diff --git a/NEWS b/NEWS
index 9e8cd85..4145dc5 100644
--- a/NEWS
+++ b/NEWS
@@ -27,12 +27,16 @@ PHP 
   NEWS
 
 - DateTime
   . Added DateTimeImmutable - a variant of DateTime that only returns the
-modified state instead of changing itself. (Derick) 
+modified state instead of changing itself. (Derick)
 
 - pgsql:
   . Bug #46408: Locale number format settings can cause pg_query_params to
 break with numerics. (asmecher, Lars)
 
+- dba:
+  . Bug #62489: dba_insert not working as expected.
+(marc-bennewitz at arcor dot de, Lars)
+
 18 Dec 2012, PHP 5.5.0 Alpha 2
 
 - General improvements:
diff --git a/ext/dba/dba_flatfile.c b/ext/dba/dba_flatfile.c
index 082aa5c..34aa635 100644
--- a/ext/dba/dba_flatfile.c
+++ b/ext/dba/dba_flatfile.c
@@ -88,15 +88,16 @@ DBA_UPDATE_FUNC(flatfile)
gval.dsize = vallen;

switch(flatfile_store(dba, gkey, gval, mode==1 ? FLATFILE_INSERT : 
FLATFILE_REPLACE TSRMLS_CC)) {
-   case -1:
-   php_error_docref1(NULL TSRMLS_CC, key, E_WARNING, Operation 
not possible);
-   return FAILURE;
-   default:
-   case 0:
-   return SUCCESS;
-   case 1:
-   php_error_docref1(NULL TSRMLS_CC, key, E_WARNING, Key already 
exists);
-   return FAILURE;
+   case 0:
+   return SUCCESS;
+   case 1:
+   return FAILURE;
+   case -1:
+   php_error_docref1(NULL TSRMLS_CC, key, E_WARNING, 
Operation not possible);
+   return FAILURE;
+   default:
+   php_error_docref2(NULL TSRMLS_CC, key, val, E_WARNING, 
Unknown return value);
+   return FAILURE;
}
 }
 
diff --git a/ext/dba/dba_gdbm.c b/ext/dba/dba_gdbm.c
index 7534568..47dd576 100644
--- a/ext/dba/dba_gdbm.c
+++ b/ext/dba/dba_gdbm.c
@@ -104,11 +104,18 @@ DBA_UPDATE_FUNC(gdbm)
gval.dptr = (char *) val;
gval.dsize = vallen;
 
-   if(gdbm_store(dba-dbf, gkey, gval, 
-   mode == 1 ? GDBM_INSERT : GDBM_REPLACE) == 0)
-   return SUCCESS;
-   php_error_docref2(NULL TSRMLS_CC, key, val, E_WARNING, %s, 
gdbm_strerror(gdbm_errno));
-   return FAILURE;
+   switch (gdbm_store(dba-dbf, gkey, gval, mode == 1 ? GDBM_INSERT : 
GDBM_REPLACE)) {
+   case 0:
+   return SUCCESS;
+   case 1:
+   return FAILURE;
+   case -1:
+   php_error_docref2(NULL TSRMLS_CC, key, val, E_WARNING, 
%s, gdbm_strerror(gdbm_errno));
+   return FAILURE;
+   default:
+   php_error_docref2(NULL TSRMLS_CC, key, val, E_WARNING, 
Unknown return value);
+   return FAILURE;
+   }
 }
 
 DBA_EXISTS_FUNC(gdbm)
diff --git a/ext/dba/dba_inifile.c b/ext/dba/dba_inifile.c
index e1359b6..05ee95c 100644
--- a/ext/dba/dba_inifile.c
+++ b/ext/dba/dba_inifile.c
@@ -101,7 +101,6 @@ DBA_UPDATE_FUNC(inifile)
case 0:
return SUCCESS;
case 1:
-   php_error_docref1(NULL TSRMLS_CC, key, E_WARNING, Key already 
exists);
return FAILURE;
}
 }
diff --git a/ext/dba/dba_qdbm.c b/ext/dba/dba_qdbm.c
index 485b199..eeece57 100644
--- a/ext/dba/dba_qdbm.c
+++ b/ext/dba/dba_qdbm.c
@@ -96,13 +96,15 @@ DBA_FETCH_FUNC(qdbm)
 DBA_UPDATE_FUNC(qdbm)
 {
QDBM_DATA;
-   int result;
 
-   result = dpput(dba-dbf, key, keylen, val, vallen, mode == 1 ? DP_DKEEP 
: DP_DOVER);
-   if (result)
+   if (dpput(dba-dbf, key, keylen, val, vallen, mode == 1 ? DP_DKEEP : 
DP_DOVER)) {
return SUCCESS;
+   }
+
+   if (dpecode != DP_EKEEP) {
+   php_error_docref2(NULL TSRMLS_CC, key, val, E_WARNING, %s, 
dperrmsg(dpecode));
+   }
 
-   php_error_docref2(NULL TSRMLS_CC, key, val, E_WARNING, %s, 
dperrmsg(dpecode

[PHP-CVS] com php-src: Dereferencing process-handles no longer waits on those processes.: NEWS ext/standard/file.c ext/standard/file.h ext/standard/proc_open.c

2013-01-15 Thread Lars Strojny
Commit:dba22c08640b02e68bfea68440246fec1fb7459d
Author:Jille Timmermans ji...@quis.cx Tue, 15 Jan 2013 11:25:55 
+0100
Committer: Lars Strojny lstro...@php.net  Tue, 15 Jan 2013 21:50:35 +0100
Parents:   1bd193ed36d413f0d919856f65feb35a0b1580f3
Branches:  PHP-5.5

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

Log:
Dereferencing process-handles no longer waits on those processes.

Implements FR #46487

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

Changed paths:
  M  NEWS
  M  ext/standard/file.c
  M  ext/standard/file.h
  M  ext/standard/proc_open.c


Diff:
diff --git a/NEWS b/NEWS
index 4145dc5..212029c 100644
--- a/NEWS
+++ b/NEWS
@@ -247,4 +247,7 @@ PHP 
   NEWS
   . Fixed bug #63248 (Load multiple magic files from a directory under 
Windows).
   (Anatoliy)
 
+- General improvements:
+  . Implemented FR #46487 (Dereferencing process-handles no longer waits on 
those processes). (Jille Timmermans)
+
  NOTE: Insert NEWS from last stable release here prior to actual release! 

diff --git a/ext/standard/file.c b/ext/standard/file.c
index 74577ac..cf8b159 100644
--- a/ext/standard/file.c
+++ b/ext/standard/file.c
@@ -159,6 +159,7 @@ static ZEND_RSRC_DTOR_FUNC(file_context_dtor)
 static void file_globals_ctor(php_file_globals *file_globals_p TSRMLS_DC)
 {
FG(pclose_ret) = 0;
+   FG(pclose_wait) = 0;
FG(user_stream_current_filename) = NULL;
FG(def_chunk_size) = PHP_SOCK_CHUNK_SIZE;
FG(wrapper_errors) = NULL;
@@ -960,7 +961,9 @@ PHP_FUNCTION(pclose)
 
PHP_STREAM_TO_ZVAL(stream, arg1);
 
+   FG(pclose_wait) = 1;
zend_list_delete(stream-rsrc_id);
+   FG(pclose_wait) = 0;
RETURN_LONG(FG(pclose_ret));
 }
 /* }}} */
diff --git a/ext/standard/file.h b/ext/standard/file.h
index 0a4512e..2bcdfd6 100644
--- a/ext/standard/file.h
+++ b/ext/standard/file.h
@@ -115,7 +115,7 @@ typedef struct _php_meta_tags_data {
 php_meta_tags_token php_next_meta_token(php_meta_tags_data * TSRMLS_DC);
 
 typedef struct {
-   int pclose_ret;
+   int pclose_ret;
size_t def_chunk_size;
long auto_detect_line_endings;
long default_socket_timeout;
@@ -126,6 +126,7 @@ typedef struct {
HashTable *stream_wrappers; /* per-request copy of 
url_stream_wrappers_hash */
HashTable *stream_filters;  /* per-request copy of 
stream_filters_hash */
HashTable *wrapper_errors;  /* key: wrapper 
address; value: linked list of char* */
+   int pclose_wait;
 } php_file_globals;
 
 #ifdef ZTS
diff --git a/ext/standard/proc_open.c b/ext/standard/proc_open.c
index 1edfe78..4e39a40 100644
--- a/ext/standard/proc_open.c
+++ b/ext/standard/proc_open.c
@@ -208,6 +208,7 @@ static void proc_open_rsrc_dtor(zend_rsrc_list_entry *rsrc 
TSRMLS_DC)
DWORD wstatus;
 #elif HAVE_SYS_WAIT_H
int wstatus;
+   int waitpid_options = 0;
pid_t wait_pid;
 #endif
 
@@ -220,18 +221,27 @@ static void proc_open_rsrc_dtor(zend_rsrc_list_entry 
*rsrc TSRMLS_DC)
}
 
 #ifdef PHP_WIN32
-   WaitForSingleObject(proc-childHandle, INFINITE);
+   if (FG(pclose_wait)) {
+   WaitForSingleObject(proc-childHandle, INFINITE);
+   }
GetExitCodeProcess(proc-childHandle, wstatus);
-   FG(pclose_ret) = wstatus;
+   if (wstatus == STILL_ACTIVE) {
+   FG(pclose_ret) = -1;
+   } else {
+   FG(pclose_ret) = wstatus;
+   }
CloseHandle(proc-childHandle);
 
 #elif HAVE_SYS_WAIT_H
 
+   if (!FG(pclose_wait)) {
+   waitpid_options = WNOHANG;
+   }
do {
-   wait_pid = waitpid(proc-child, wstatus, 0);
+   wait_pid = waitpid(proc-child, wstatus, waitpid_options);
} while (wait_pid == -1  errno == EINTR);
 
-   if (wait_pid == -1) {
+   if (wait_pid = 0) {
FG(pclose_ret) = -1;
} else {
if (WIFEXITED(wstatus))
@@ -300,7 +310,9 @@ PHP_FUNCTION(proc_close)
 
ZEND_FETCH_RESOURCE(proc, struct php_process_handle *, zproc, -1, 
process, le_proc_open);
 
+   FG(pclose_wait) = 1;
zend_list_delete(Z_LVAL_P(zproc));
+   FG(pclose_wait) = 0;
RETURN_LONG(FG(pclose_ret));
 }
 /* }}} */


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



[PHP-CVS] com php-src: Fixed bug #63921: sqlite3::bindvalue and relative PHP functions aren't using sqlite3_*_int64 API: NEWS ext/sqlite3/sqlite3.c ext/sqlite3/tests/bug63921-32bit.phpt ext/sqlite3/te

2013-01-14 Thread Lars Strojny
Commit:99d087e5d437023c55f96dcde4b5b784bd8b0ac8
Author:Lars Strojny lstro...@php.net Mon, 14 Jan 2013 17:35:07 
+0100
Parents:   1a96fe0b3260b4b63627cf69d71a5b350ad3163f
Branches:  PHP-5.4

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

Log:
Fixed bug #63921: sqlite3::bindvalue and relative PHP functions aren't using 
sqlite3_*_int64 API

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

Changed paths:
  M  NEWS
  M  ext/sqlite3/sqlite3.c
  A  ext/sqlite3/tests/bug63921-32bit.phpt
  A  ext/sqlite3/tests/bug63921-64bit.phpt


Diff:
diff --git a/NEWS b/NEWS
index 28040f7..e411ba4 100644
--- a/NEWS
+++ b/NEWS
@@ -12,6 +12,10 @@ PHP  
  NEWS
 - Litespeed:
   . Fixed bug #63228 (-Werror=format-security error in lsapi code). (George)
 
+- ext/sqlite3:
+  . Fixed bug #63921 (sqlite3::bindvalue and relative PHP functions aren't
+using sqlite3_*_int64 API). (srgoogleguy, Lars)
+
 ?? ??? 2012, PHP 5.4.11
 
 - Core:
diff --git a/ext/sqlite3/sqlite3.c b/ext/sqlite3/sqlite3.c
index 881e3c3..df449d7 100644
--- a/ext/sqlite3/sqlite3.c
+++ b/ext/sqlite3/sqlite3.c
@@ -730,7 +730,11 @@ static int sqlite3_do_callback(struct php_sqlite3_fci *fc, 
zval *cb, int argc, s
 
switch (sqlite3_value_type(argv[i])) {
case SQLITE_INTEGER:
+#if LONG_MAX  2147483647
+   ZVAL_LONG(*zargs[i + is_agg], 
sqlite3_value_int64(argv[i]));
+#else
ZVAL_LONG(*zargs[i + is_agg], 
sqlite3_value_int(argv[i]));
+#endif
break;
 
case SQLITE_FLOAT:
@@ -774,7 +778,11 @@ static int sqlite3_do_callback(struct php_sqlite3_fci *fc, 
zval *cb, int argc, s
if (retval) {
switch (Z_TYPE_P(retval)) {
case IS_LONG:
+#if LONG_MAX  2147483647
+   sqlite3_result_int64(context, 
Z_LVAL_P(retval));
+#else
sqlite3_result_int(context, 
Z_LVAL_P(retval));
+#endif
break;
 
case IS_NULL:
@@ -1493,7 +1501,11 @@ PHP_METHOD(sqlite3stmt, execute)
switch (param-type) {
case SQLITE_INTEGER:
convert_to_long(param-parameter);
+#if LONG_MAX  2147483647
+   sqlite3_bind_int64(stmt_obj-stmt, 
param-param_number, Z_LVAL_P(param-parameter));
+#else
sqlite3_bind_int(stmt_obj-stmt, 
param-param_number, Z_LVAL_P(param-parameter));
+#endif
break;
 
case SQLITE_FLOAT:
diff --git a/ext/sqlite3/tests/bug63921-32bit.phpt 
b/ext/sqlite3/tests/bug63921-32bit.phpt
new file mode 100644
index 000..8c1c6b9
--- /dev/null
+++ b/ext/sqlite3/tests/bug63921-32bit.phpt
@@ -0,0 +1,27 @@
+--TEST--
+Bug #63921 sqlite3::bindvalue and relative PHP functions aren't using 
sqlite3_*_int64 API
+--SKIPIF--
+?php
+if (!extension_loaded('sqlite3')) die('skip');
+if (PHP_INT_SIZE  4) die('skip'); // skip for 64bit builds - there is another 
test for that
+?
+--FILE--
+?php
+$num = PHP_INT_MAX; // 32 bits
+$conn = new sqlite3(':memory:');
+$conn-query('CREATE TABLE users (id INTEGER NOT NULL, num INTEGER NOT NULL, 
PRIMARY KEY(id))');
+
+$stmt = $conn-prepare('insert into users (id, num) values (:id, :num)');
+$stmt-bindValue(':id', 1, SQLITE3_INTEGER);
+$stmt-bindValue(':num', $num, SQLITE3_INTEGER);
+$stmt-execute();
+
+$stmt = $conn-query('SELECT num FROM users');
+$result = $stmt-fetchArray();
+
+var_dump($num,$result[0]);
+
+?
+--EXPECT--
+int(2147483647)
+string(10) 2147483647
diff --git a/ext/sqlite3/tests/bug63921-64bit.phpt 
b/ext/sqlite3/tests/bug63921-64bit.phpt
new file mode 100644
index 000..8e821fd
--- /dev/null
+++ b/ext/sqlite3/tests/bug63921-64bit.phpt
@@ -0,0 +1,27 @@
+--TEST--
+Bug #63921 sqlite3::bindvalue and relative PHP functions aren't using 
sqlite3_*_int64 API
+--SKIPIF--
+?php
+if (!extension_loaded('sqlite3')) die('skip');
+if (PHP_INT_SIZE  8) die('skip'); // skip for 32bit builds - there is another 
test for that
+?
+--FILE--
+?php
+$num = 14313234244; // notice this exceeds 32 bits
+$conn = new sqlite3(':memory:');
+$conn-query('CREATE TABLE users (id INTEGER NOT NULL, num INTEGER NOT NULL, 
PRIMARY KEY(id))');
+
+$stmt = $conn-prepare('insert into users (id, num) values (:id, :num)');
+$stmt-bindValue(':id', 1, SQLITE3_INTEGER);
+$stmt-bindValue(':num', $num, SQLITE3_INTEGER);
+$stmt-execute();
+
+$stmt = $conn-query('SELECT num FROM users');
+$result = $stmt-fetchArray();
+
+var_dump($num,$result[0]);
+
+?
+--EXPECT--
+int(14313234244)
+string(15) 14313234244


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

[PHP-CVS] com php-src: Fix bug #63916: PDO::PARAM_INT casts to 32bit int internally even on 64bit builds in pdo_sqlite: NEWS ext/pdo_sqlite/sqlite_statement.c ext/pdo_sqlite/tests/bug_63916-2.phpt ext

2013-01-14 Thread Lars Strojny
Commit:1e9a3ed234af443170d9ea8280a556d85299e301
Author:Lars Strojny lstro...@php.net Mon, 14 Jan 2013 17:59:11 
+0100
Parents:   99d087e5d437023c55f96dcde4b5b784bd8b0ac8
Branches:  PHP-5.4

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

Log:
Fix bug #63916: PDO::PARAM_INT casts to 32bit int internally even on 64bit 
builds in pdo_sqlite

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

Changed paths:
  M  NEWS
  M  ext/pdo_sqlite/sqlite_statement.c
  A  ext/pdo_sqlite/tests/bug_63916-2.phpt
  A  ext/pdo_sqlite/tests/bug_63916.phpt


Diff:
diff --git a/NEWS b/NEWS
index e411ba4..26ce118 100644
--- a/NEWS
+++ b/NEWS
@@ -16,6 +16,10 @@ PHP  
  NEWS
   . Fixed bug #63921 (sqlite3::bindvalue and relative PHP functions aren't
 using sqlite3_*_int64 API). (srgoogleguy, Lars)
 
+- PDO_sqlite:
+  . Fixed bug #63916 (PDO::PARAM_INT casts to 32bit int internally even
+on 64bit builds in pdo_sqlite). (srgoogleguy, Lars)
+
 ?? ??? 2012, PHP 5.4.11
 
 - Core:
diff --git a/ext/pdo_sqlite/sqlite_statement.c 
b/ext/pdo_sqlite/sqlite_statement.c
index d5b4df1..e970ad3 100644
--- a/ext/pdo_sqlite/sqlite_statement.c
+++ b/ext/pdo_sqlite/sqlite_statement.c
@@ -112,9 +112,15 @@ static int pdo_sqlite_stmt_param_hook(pdo_stmt_t *stmt, 
struct pdo_bound_param_d
}
} else {

convert_to_long(param-parameter);
+#if LONG_MAX  2147483647
+   if (SQLITE_OK == 
sqlite3_bind_int64(S-stmt, param-paramno + 1, Z_LVAL_P(param-parameter))) {
+   return 1;
+   }
+#else
if (SQLITE_OK == 
sqlite3_bind_int(S-stmt, param-paramno + 1, Z_LVAL_P(param-parameter))) {
return 1;
}
+#endif
}
pdo_sqlite_error_stmt(stmt);
return 0;
diff --git a/ext/pdo_sqlite/tests/bug_63916-2.phpt 
b/ext/pdo_sqlite/tests/bug_63916-2.phpt
new file mode 100644
index 000..bc9bfc9
--- /dev/null
+++ b/ext/pdo_sqlite/tests/bug_63916-2.phpt
@@ -0,0 +1,27 @@
+--TEST--
+Bug #63916 PDO::PARAM_INT casts to 32bit int internally even on 64bit builds 
in pdo_sqlite
+--SKIPIF--
+?php
+if (!extension_loaded('pdo_sqlite')) die('skip');
+if (PHP_INT_SIZE  4) die('skip');
+?
+--FILE--
+?php
+$num = PHP_INT_MAX; // 32 bits
+$conn = new PDO('sqlite::memory:');
+$conn-query('CREATE TABLE users (id INTEGER NOT NULL, num INTEGER NOT NULL, 
PRIMARY KEY(id))');
+
+$stmt = $conn-prepare('insert into users (id, num) values (:id, :num)');
+$stmt-bindValue(':id', 1, PDO::PARAM_INT);
+$stmt-bindValue(':num', $num, PDO::PARAM_INT);
+$stmt-execute();
+
+$stmt = $conn-query('SELECT num FROM users');
+$result = $stmt-fetchAll(PDO::FETCH_COLUMN);
+
+var_dump($num,$result[0]);
+
+?
+--EXPECT--
+int(2147483647)
+string(10) 2147483647
diff --git a/ext/pdo_sqlite/tests/bug_63916.phpt 
b/ext/pdo_sqlite/tests/bug_63916.phpt
new file mode 100644
index 000..582413d
--- /dev/null
+++ b/ext/pdo_sqlite/tests/bug_63916.phpt
@@ -0,0 +1,27 @@
+--TEST--
+Bug #63916 PDO::PARAM_INT casts to 32bit int internally even on 64bit builds 
in pdo_sqlite
+--SKIPIF--
+?php
+if (!extension_loaded('pdo_sqlite')) die('skip');
+if (PHP_INT_SIZE  8) die('skip');
+?
+--FILE--
+?php
+$num = 14313234244; // exceeds 32 bits
+$conn = new PDO('sqlite::memory:');
+$conn-query('CREATE TABLE users (id INTEGER NOT NULL, num INTEGER NOT NULL, 
PRIMARY KEY(id))');
+
+$stmt = $conn-prepare('insert into users (id, num) values (:id, :num)');
+$stmt-bindValue(':id', 1, PDO::PARAM_INT);
+$stmt-bindValue(':num', $num, PDO::PARAM_INT);
+$stmt-execute();
+
+$stmt = $conn-query('SELECT num FROM users');
+$result = $stmt-fetchAll(PDO::FETCH_COLUMN);
+
+var_dump($num,$result[0]);
+
+?
+--EXPECT--
+int(14313234244)
+string(15) 14313234244


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



[PHP-CVS] com php-src: Support BITMAPV5HEADER in getimagesize(): https://en.wikipedia.org/wiki/BMP_file_format#DIB_header_.28bitmap_information_header.29: NEWS ext/standard/image.c ext/standard/tests/

2013-01-14 Thread Lars Strojny
Commit:bf9ad4e661be4f3eebe3511887e10e521cce7f93
Author:Lars Strojny lstro...@php.net Mon, 14 Jan 2013 18:52:38 
+0100
Parents:   1e9a3ed234af443170d9ea8280a556d85299e301
Branches:  PHP-5.4

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

Log:
Support BITMAPV5HEADER in getimagesize(): 
https://en.wikipedia.org/wiki/BMP_file_format#DIB_header_.28bitmap_information_header.29

Changed paths:
  M  NEWS
  M  ext/standard/image.c
  M  ext/standard/tests/image/getimagesize.phpt
  M  ext/standard/tests/image/image_type_to_mime_type.phpt
  A  ext/standard/tests/image/test1bpix.bmp


Diff:
diff --git a/NEWS b/NEWS
index 26ce118..16c0771 100644
--- a/NEWS
+++ b/NEWS
@@ -3,11 +3,12 @@ PHP   
 NEWS
 ?? ??? 2012, PHP 5.4.12
 
 - Core:
-  . Fixed bug #63982 (isset() inconsistently produces a fatal error on 
+  . Fixed bug #63982 (isset() inconsistently produces a fatal error on
 protected property). (Stas)
   . Fixed bug #63943 (Bad warning text from strpos() on empty needle).
 (Laruence)
   . Fixed bug #63882 (zend_std_compare_objects crash on recursion). (Dmitry)
+  . Support BITMAPV5HEADER in getimagesize(). (AsamK, Lars)
 
 - Litespeed:
   . Fixed bug #63228 (-Werror=format-security error in lsapi code). (George)
@@ -26,7 +27,7 @@ PHP   
 NEWS
   . Fixed bug #63899 (Use after scope error in zend_compile). (Laruence)
   . Fixed bug #63762 (Sigsegv when Exception::$trace is changed by user).
 (Johannes)
-  . Fixed bug #43177 (Errors in eval()'ed code produce status code 500). 
+  . Fixed bug #43177 (Errors in eval()'ed code produce status code 500).
 (Todd Ruth, Stas).
 
 - Filter:
diff --git a/ext/standard/image.c b/ext/standard/image.c
index ebf894a..4984e40 100644
--- a/ext/standard/image.c
+++ b/ext/standard/image.c
@@ -159,7 +159,7 @@ static struct gfxinfo *php_handle_bmp (php_stream * stream 
TSRMLS_DC)
result-width=  (((unsigned int)dim[ 5])  8) + ((unsigned 
int) dim[ 4]);
result-height   =  (((unsigned int)dim[ 7])  8) + ((unsigned 
int) dim[ 6]);
result-bits =  ((unsigned int)dim[11]);
-   } else if (size  12  (size = 64 || size == 108)) {
+   } else if (size  12  (size = 64 || size == 108 || size == 124)) {
result = (struct gfxinfo *) ecalloc (1, sizeof(struct gfxinfo));
result-width=  (((unsigned int)dim[ 7])  24) + 
(((unsigned int)dim[ 6])  16) + (((unsigned int)dim[ 5])  8) + ((unsigned 
int) dim[ 4]);
result-height   =  (((unsigned int)dim[11])  24) + 
(((unsigned int)dim[10])  16) + (((unsigned int)dim[ 9])  8) + ((unsigned 
int) dim[ 8]);
diff --git a/ext/standard/tests/image/getimagesize.phpt 
b/ext/standard/tests/image/getimagesize.phpt
index ab79c9c..6cd8275 100644
--- a/ext/standard/tests/image/getimagesize.phpt
+++ b/ext/standard/tests/image/getimagesize.phpt
@@ -23,7 +23,22 @@ GetImageSize()
var_dump($result);
 ?
 --EXPECT--
-array(11) {
+array(12) {
+  [test1bpix.bmp]=
+  array(6) {
+[0]=
+int(500)
+[1]=
+int(345)
+[2]=
+int(6)
+[3]=
+string(24) width=500 height=345
+[bits]=
+int(32)
+[mime]=
+string(14) image/x-ms-bmp
+  }
   [test1pix.bmp]=
   array(6) {
 [0]=
diff --git a/ext/standard/tests/image/image_type_to_mime_type.phpt 
b/ext/standard/tests/image/image_type_to_mime_type.phpt
index 5d94a6f..d83ab8d 100644
--- a/ext/standard/tests/image/image_type_to_mime_type.phpt
+++ b/ext/standard/tests/image/image_type_to_mime_type.phpt
@@ -1,8 +1,8 @@
 --TEST--
 image_type_to_mime_type()
 --SKIPIF--
-?php 
-   if (!function_exists('image_type_to_mime_type')) die('skip 
image_type_to_mime_type() not available'); 
+?php
+   if (!function_exists('image_type_to_mime_type')) die('skip 
image_type_to_mime_type() not available');
require_once('skipif_imagetype.inc');
 ?
 --FILE--
@@ -25,7 +25,9 @@ image_type_to_mime_type()
var_dump($result);
 ?
 --EXPECT--
-array(11) {
+array(12) {
+  [test1bpix.bmp]=
+  string(14) image/x-ms-bmp
   [test1pix.bmp]=
   string(14) image/x-ms-bmp
   [test1pix.jp2]=
@@ -48,4 +50,4 @@ array(11) {
   string(29) application/x-shockwave-flash
   [test4pix.tif]=
   string(10) image/tiff
-}
\ No newline at end of file
+}
diff --git a/ext/standard/tests/image/test1bpix.bmp 
b/ext/standard/tests/image/test1bpix.bmp
new file mode 100644
index 000..5522e50
Binary files /dev/null and b/ext/standard/tests/image/test1bpix.bmp differ


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



[PHP-CVS] com php-src: Bug #46408: Fix double formatting for PostgreSQL bound parameters: NEWS Zend/zend_operators.c Zend/zend_operators.h ext/pgsql/pgsql.c ext/pgsql/tests/bug46408.phpt

2013-01-14 Thread Lars Strojny
Commit:92965b033afa098945d18080203de1595084d1ac
Author:Lars Strojny lstro...@php.net Mon, 14 Jan 2013 21:23:52 
+0100
Parents:   785e66adb536d40a26e4813e6b4ad96b2fdbef43
Branches:  PHP-5.5

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

Log:
Bug #46408: Fix double formatting for PostgreSQL bound parameters

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

Changed paths:
  M  NEWS
  M  Zend/zend_operators.c
  M  Zend/zend_operators.h
  M  ext/pgsql/pgsql.c
  A  ext/pgsql/tests/bug46408.phpt


Diff:
diff --git a/NEWS b/NEWS
index c31365e..74c1134 100644
--- a/NEWS
+++ b/NEWS
@@ -19,12 +19,16 @@ PHP 
   NEWS
 
 - cURL:
   . Added new functions curl_escape, curl_multi_setopt, curl_multi_strerror
-curl_pause, curl_reset, curl_share_close, curl_share_init, 
+curl_pause, curl_reset, curl_share_close, curl_share_init,
curl_share_setopt curl_strerror and curl_unescape. (Pierrick)
   . Addes new curl options CURLOPT_TELNETOPTIONS, CURLOPT_GSSAPI_DELEGATION,
 CURLOPT_ACCEPTTIMEOUT_MS, CURLOPT_SSL_OPTIONS, CURLOPT_TCP_KEEPALIVE,
CURLOPT_TCP_KEEPIDLE and CURLOPT_TCP_KEEPINTVL. (Pierrick)
 
+- pgsql:
+  . Bug #46408: Locale number format settings can cause pg_query_params to
+break with numerics. (asmecher, Lars)
+
 18 Dec 2012, PHP 5.5.0 Alpha 2
 
 - General improvements:
diff --git a/Zend/zend_operators.c b/Zend/zend_operators.c
index bd9..274893c 100644
--- a/Zend/zend_operators.c
+++ b/Zend/zend_operators.c
@@ -572,6 +572,24 @@ ZEND_API void convert_to_boolean(zval *op) /* {{{ */
 }
 /* }}} */
 
+ZEND_API void _convert_to_cstring(zval *op ZEND_FILE_LINE_DC) /* {{{ */
+{
+   double dval;
+   switch (Z_TYPE_P(op)) {
+   case IS_DOUBLE: {
+   TSRMLS_FETCH();
+   dval = Z_DVAL_P(op);
+   Z_STRLEN_P(op) = zend_spprintf(Z_STRVAL_P(op), 0, 
%.*H, (int) EG(precision), dval);
+   /* %H already handles removing trailing zeros from the 
fractional part, yay */
+   break;
+   }
+   default:
+   return _convert_to_string(op);
+   }
+   Z_TYPE_P(op) = IS_STRING;
+}
+/* }}} */
+
 ZEND_API void _convert_to_string(zval *op ZEND_FILE_LINE_DC) /* {{{ */
 {
long lval;
diff --git a/Zend/zend_operators.h b/Zend/zend_operators.h
index d3f5e5a..20a5277 100644
--- a/Zend/zend_operators.h
+++ b/Zend/zend_operators.h
@@ -301,6 +301,7 @@ ZEND_API int increment_function(zval *op1);
 ZEND_API int decrement_function(zval *op2);
 
 ZEND_API void convert_scalar_to_number(zval *op TSRMLS_DC);
+ZEND_API void _convert_to_cstring(zval *op ZEND_FILE_LINE_DC);
 ZEND_API void _convert_to_string(zval *op ZEND_FILE_LINE_DC);
 ZEND_API void convert_to_long(zval *op);
 ZEND_API void convert_to_double(zval *op);
@@ -314,6 +315,7 @@ ZEND_API void multi_convert_to_double_ex(int argc, ...);
 ZEND_API void multi_convert_to_string_ex(int argc, ...);
 ZEND_API int add_char_to_string(zval *result, const zval *op1, const zval 
*op2);
 ZEND_API int add_string_to_string(zval *result, const zval *op1, const zval 
*op2);
+#define convert_to_cstring(op) if ((op)-type != IS_STRING) { 
_convert_to_cstring((op) ZEND_FILE_LINE_CC); }
 #define convert_to_string(op) if ((op)-type != IS_STRING) { 
_convert_to_string((op) ZEND_FILE_LINE_CC); }
 
 ZEND_API double zend_string_to_double(const char *number, zend_uint length);
diff --git a/ext/pgsql/pgsql.c b/ext/pgsql/pgsql.c
index d01dda6..7ee838a 100644
--- a/ext/pgsql/pgsql.c
+++ b/ext/pgsql/pgsql.c
@@ -1736,7 +1736,7 @@ PHP_FUNCTION(pg_query_params)
} else {
zval tmp_val = **tmp;
zval_copy_ctor(tmp_val);
-   convert_to_string(tmp_val);
+   convert_to_cstring(tmp_val);
if (Z_TYPE(tmp_val) != IS_STRING) {
php_error_docref(NULL TSRMLS_CC, 
E_WARNING,Error converting parameter);
zval_dtor(tmp_val);
diff --git a/ext/pgsql/tests/bug46408.phpt b/ext/pgsql/tests/bug46408.phpt
new file mode 100644
index 000..8c72ba5
--- /dev/null
+++ b/ext/pgsql/tests/bug46408.phpt
@@ -0,0 +1,23 @@
+--TEST--
+Bug #46408 (Locale number format settings can cause pg_query_params to break 
with numerics)
+--SKIPIF--
+?php
+require_once('skipif.inc');
+?
+--FILE--
+?php
+
+require_once('config.inc');
+
+$dbh = pg_connect($conn_str);
+setlocale(LC_ALL, 'hr_HR.utf-8', 'hr_HR');
+echo 3.5.PHP_EOL;
+pg_query_params(SELECT $1::numeric, array(3.5));
+pg_close($dbh);
+
+echo Done.PHP_EOL;
+
+?
+--EXPECTF--
+3,5
+Done


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



[PHP-CVS] com php-src: Bug #52958: Segfault in PDO_OCI on cleanup after running a long testsuite.: NEWS ext/pdo_oci/oci_driver.c

2013-01-14 Thread Lars Strojny
Commit:6a065876b9212404daaf8fee1708834da83dac56
Author:Lars Strojny lstro...@php.net Mon, 14 Jan 2013 21:35:48 
+0100
Parents:   bf9ad4e661be4f3eebe3511887e10e521cce7f93
Branches:  PHP-5.4

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

Log:
Bug #52958: Segfault in PDO_OCI on cleanup after running a long testsuite.

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

Changed paths:
  M  NEWS
  M  ext/pdo_oci/oci_driver.c


Diff:
diff --git a/NEWS b/NEWS
index 16c0771..58a50bb 100644
--- a/NEWS
+++ b/NEWS
@@ -20,6 +20,8 @@ PHP   
 NEWS
 - PDO_sqlite:
   . Fixed bug #63916 (PDO::PARAM_INT casts to 32bit int internally even
 on 64bit builds in pdo_sqlite). (srgoogleguy, Lars)
+  . Fixed bug #52958 (Segfault in PDO_OCI on cleanup after running a long
+testsuite) (hswong3i, Lars)
 
 ?? ??? 2012, PHP 5.4.11
 
diff --git a/ext/pdo_oci/oci_driver.c b/ext/pdo_oci/oci_driver.c
index a0377dd..5497beb 100644
--- a/ext/pdo_oci/oci_driver.c
+++ b/ext/pdo_oci/oci_driver.c
@@ -227,8 +227,10 @@ static int oci_handle_closer(pdo_dbh_t *dbh TSRMLS_DC) /* 
{{{ */
H-server = NULL;
}
 
-   OCIHandleFree(H-err, OCI_HTYPE_ERROR);
-   H-err = NULL;
+   if (H-err) {
+   OCIHandleFree(H-err, OCI_HTYPE_ERROR);
+   H-err = NULL;
+   }
 
if (H-charset  H-env) {
OCIHandleFree(H-env, OCI_HTYPE_ENV);


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



[PHP-CVS] com php-src: Coding style, ANSI C compatibility: ext/date/php_date.c

2013-01-06 Thread Lars Strojny
Commit:d7da1aa694a9a29ca7ec772e5d51d96b6dc8dda0
Author:Lars Strojny lstro...@php.net Sun, 6 Jan 2013 14:08:23 
+0100
Parents:   a426e0b05074621643c44b67ed2d0d8674721bf5
Branches:  master

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

Log:
Coding style, ANSI C compatibility

Changed paths:
  M  ext/date/php_date.c


Diff:
diff --git a/ext/date/php_date.c b/ext/date/php_date.c
index 1837f94..765b0bf 100644
--- a/ext/date/php_date.c
+++ b/ext/date/php_date.c
@@ -847,7 +847,7 @@ timelib_tzinfo *php_date_parse_tzfile_wrapper(char 
*formal_tzname, const timelib
 }
 /* }}} */
 
-// created this callback method to check the date.timezone only when changed, 
to increase performance and error on an ini_set line
+/* Callback to check the date.timezone only when changed increases performance 
*/
 /* {{{ static PHP_INI_MH(OnUpdate_date_timezone) */
 static PHP_INI_MH(OnUpdate_date_timezone)
 {
@@ -872,7 +872,7 @@ static PHP_INI_MH(OnUpdate_date_timezone)
 static char* guess_timezone(const timelib_tzdb *tzdb TSRMLS_DC)
 {
/* Checking configure timezone */
-   if (DATEG(timezone)  strlen(DATEG(timezone))  0) {
+   if (DATEG(timezone)  (strlen(DATEG(timezone)))  0) {
return DATEG(timezone);
}
/* Check config setting for default timezone */
@@ -880,11 +880,12 @@ static char* guess_timezone(const timelib_tzdb *tzdb 
TSRMLS_DC)
/* Special case: ext/date wasn't initialized yet */
zval ztz;
 
-   if (SUCCESS == 
zend_get_configuration_directive(date.timezone, sizeof(date.timezone), 
ztz)  Z_TYPE(ztz) == IS_STRING  Z_STRLEN(ztz)  0  
timelib_timezone_id_is_valid(Z_STRVAL(ztz), tzdb)) {
+   if (SUCCESS == 
zend_get_configuration_directive(date.timezone, sizeof(date.timezone), ztz)
+Z_TYPE(ztz) == IS_STRING  Z_STRLEN(ztz)  0  
timelib_timezone_id_is_valid(Z_STRVAL(ztz), tzdb)) {
return Z_STRVAL(ztz);
}
} else if (*DATEG(default_timezone)) {
-   if (DATEG(timezone_valid) == 1) { // timezone already checked 
and validated
+   if (DATEG(timezone_valid) == 1) {
return DATEG(default_timezone);
}


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



[PHP-CVS] com php-src: Adding test for bug #63462: tests/classes/bug63462.phpt

2013-01-06 Thread Lars Strojny
Commit:bdc1e2302ce57f6763c50d03bf987261f34f1d2b
Author:Lars Strojny lstro...@php.net Sun, 6 Jan 2013 14:46:49 
+0100
Parents:   d7da1aa694a9a29ca7ec772e5d51d96b6dc8dda0
Branches:  PHP-5.4

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

Log:
Adding test for bug #63462

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

Changed paths:
  A  tests/classes/bug63462.phpt


Diff:
diff --git a/tests/classes/bug63462.phpt b/tests/classes/bug63462.phpt
new file mode 100644
index 000..dc5edbd
--- /dev/null
+++ b/tests/classes/bug63462.phpt
@@ -0,0 +1,71 @@
+--TEST--
+Test script to verify that magic methods should be called only once when 
accessing an unset property.
+--CREDITS--
+Marco Pivetta ocram...@gmail.com
+--XFAIL--
+Bug 63462 is not yet fixed
+--FILE--
+?php
+class Test {
+   public$publicProperty;
+   protected $protectedProperty;
+   private   $privateProperty;
+
+   public function __construct() {
+   unset(
+   $this-publicProperty,
+   $this-protectedProperty,
+   $this-privateProperty
+   );
+   }
+
+   function __get($name) {
+   echo '__get ' . $name . \n;
+   return $this-$name;
+   }
+
+   function __set($name, $value) {
+   echo '__set ' . $name . \n;
+   $this-$name = $value;
+   }
+
+   function __isset($name) {
+   echo '__isset ' . $name . \n;
+   return isset($this-$name);
+   }
+}
+
+$test = new Test();
+
+$test-nonExisting;
+$test-publicProperty;
+$test-protectedProperty;
+$test-privateProperty;
+isset($test-nonExisting);
+isset($test-publicProperty);
+isset($test-protectedProperty);
+isset($test-privateProperty);
+$test-nonExisting   = 'value';
+$test-publicProperty   = 'value';
+$test-protectedProperty = 'value';
+$test-privateProperty   = 'value';
+
+?
+
+--EXPECTF--
+__get nonExisting
+Notice: Undefined index: nonExisting in %__set__get_006.php on line %d
+__get publicProperty
+Notice: Undefined index: publicProperty in %__set__get_006.php on line %d
+__get protectedProperty
+Notice: Undefined index: protectedProperty in %__set__get_006.php on line %d
+__get privateProperty
+Notice: Undefined index: privateProperty in %__set__get_006.php on line %d
+__isset nonExisting
+__isset publicProperty
+__isset protectedProperty
+__isset privateProperty
+__set nonExisting
+__set publicProperty
+__set protectedProperty
+__set privateProperty


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



[PHP-CVS] com php-src: Add unit test for mail.log ini setting.: ext/standard/tests/mail/mail_log.phpt

2013-01-06 Thread Lars Strojny
Commit:371372714dcac655f53a53ef4d45ad02916b4f4a
Author:Martin Jansen mar...@divbyzero.net Sun, 6 Jan 2013 
08:59:10 +0100
Committer: Lars Strojny lstro...@php.net  Sun, 6 Jan 2013 15:04:27 +0100
Parents:   4a3bf25e3ffa71d8d65df686c27903d7c9fafee6
Branches:  PHP-5.5

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

Log:
Add unit test for mail.log ini setting.

Changed paths:
  A  ext/standard/tests/mail/mail_log.phpt


Diff:
diff --git a/ext/standard/tests/mail/mail_log.phpt 
b/ext/standard/tests/mail/mail_log.phpt
new file mode 100644
index 000..86346ec
--- /dev/null
+++ b/ext/standard/tests/mail/mail_log.phpt
@@ -0,0 +1,48 @@
+--TEST--
+Test mail() function : mail.log ini setting
+--INI--
+sendmail_path=tee /tmp/mail.out /dev/null
+mail.log = /tmp/mail.log
+--SKIPIF--
+?php
+if(substr(PHP_OS, 0, 3) == WIN)
+  die(skip Won't run on Windows);
+?
+--FILE--
+?php
+date_default_timezone_set(UTC);
+
+$logfile = ini_get(mail.log);
+if (file_exists($logfile)) {
+   unlink($logfile);
+}
+touch($logfile);
+clearstatcache();
+
+$to = t...@example.com;
+$subject = mail.log test;
+$message = Testing mail.log;
+$headers = X-Test: 1;
+
+var_dump(filesize($logfile) == 0);
+clearstatcache();
+
+var_dump(mail($to, $subject, $message, $headers));
+
+var_dump(filesize($logfile)  0);
+clearstatcache();
+
+echo file_get_contents($logfile);
+?
+Done
+--CLEAN--
+?php
+unlink(/tmp/mail.log);
+unlink(/tmp/mail.out);
+?
+--EXPECTF--
+bool(true)
+bool(true)
+bool(true)
+[%d-%s-%d %d:%d:%d UTC] mail() on [%smail_log.php:%d]: To: t...@example.com -- 
Headers: X-Test: 1
+Done


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



[PHP-CVS] com php-src: News entry for bug #52126: NEWS

2013-01-06 Thread Lars Strojny
Commit:a951693cfb17b8d84de4882f47ba6f7d6a776556
Author:Lars Strojny lstro...@php.net Sun, 6 Jan 2013 15:13:32 
+0100
Parents:   371372714dcac655f53a53ef4d45ad02916b4f4a
Branches:  PHP-5.5

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

Log:
News entry for bug #52126

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

Changed paths:
  M  NEWS


Diff:
diff --git a/NEWS b/NEWS
index 1ad954a..cfd2aa3 100644
--- a/NEWS
+++ b/NEWS
@@ -8,6 +8,7 @@ PHP 
   NEWS
 (Nikita Popov)
   . Add Generator::throw() method. (Nikita Popov)
   . Bug #23955: allow specifying Max-Age attribute in setcookie() (narfbg, 
Lars)
+  . Bug #52126: timestamp for mail.log (Martin Jansen, Lars)
 
 - cURL:
   . Added new functions curl_escape, curl_multi_setopt, curl_multi_strerror


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



[PHP-CVS] com php-src: Add a timestamp to the mail log.: ext/standard/mail.c

2013-01-06 Thread Lars Strojny
Commit:4a3bf25e3ffa71d8d65df686c27903d7c9fafee6
Author:Martin Jansen mar...@divbyzero.net Mon, 24 Dec 2012 
11:11:28 +0100
Committer: Lars Strojny lstro...@php.net  Sun, 6 Jan 2013 15:04:19 +0100
Parents:   853ef3c9cba5458e403f627103d12351f88ec52f
Branches:  PHP-5.5

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

Log:
Add a timestamp to the mail log.

This patch is loosely based on the one in bug #52126 but instead of
using a UNIX timestamp it uses the date format also being used by
error_log et al.

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

Changed paths:
  M  ext/standard/mail.c


Diff:
diff --git a/ext/standard/mail.c b/ext/standard/mail.c
index 2576681..c8fd55e 100644
--- a/ext/standard/mail.c
+++ b/ext/standard/mail.c
@@ -21,10 +21,12 @@
 #include stdlib.h
 #include ctype.h
 #include stdio.h
+#include time.h
 #include php.h
 #include ext/standard/info.h
 #include ext/standard/php_string.h
 #include ext/standard/basic_functions.h
+#include ext/date/php_date.h
 
 #if HAVE_SYSEXITS_H
 #include sysexits.h
@@ -246,8 +248,15 @@ PHPAPI int php_mail(char *to, char *subject, char 
*message, char *headers, char
return val; \
 
if (mail_log  *mail_log) {
-   char *tmp;
-   int l = spprintf(tmp, 0, mail() on [%s:%d]: To: %s -- 
Headers: %s\n, zend_get_executed_filename(TSRMLS_C), 
zend_get_executed_lineno(TSRMLS_C), to, hdr ? hdr : );
+   char *tmp, *date_str;
+   time_t curtime;
+
+   time(curtime);
+   date_str = php_format_date(d-M-Y H:i:s e, 13, curtime, 1 
TSRMLS_CC);
+
+   int l = spprintf(tmp, 0, [%s] mail() on [%s:%d]: To: %s -- 
Headers: %s\n, date_str, zend_get_executed_filename(TSRMLS_C), 
zend_get_executed_lineno(TSRMLS_C), to, hdr ? hdr : );
+
+   efree(date_str);
 
if (hdr) {
php_mail_log_crlf_to_spaces(tmp);


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



Re: [PHP-CVS] com php-src: fix windows build: ext/standard/mail.c

2013-01-06 Thread Lars Strojny
Thanks for fixing. Could you merge to 5.5 as well? If not, I could do as well.

-- 
Sent from my iPhone

Am 06.01.2013 um 18:37 schrieb Anatoliy Belsky a...@php.net:

 Commit:8a481c711a1c899971494d88086701ca783c6795
 Author:Anatoliy Belsky a...@php.net Sun, 6 Jan 2013 18:37:26 
 +0100
 Parents:   98331c89a178add153f9f30484f59300499fc742
 Branches:  master
 
 Link:   
 http://git.php.net/?p=php-src.git;a=commitdiff;h=8a481c711a1c899971494d88086701ca783c6795
 
 Log:
 fix windows build
 
 Changed paths:
  M  ext/standard/mail.c
 
 
 Diff:
 diff --git a/ext/standard/mail.c b/ext/standard/mail.c
 index c8fd55e..4c243f7 100644
 --- a/ext/standard/mail.c
 +++ b/ext/standard/mail.c
 @@ -250,11 +250,12 @@ PHPAPI int php_mail(char *to, char *subject, char 
 *message, char *headers, char
if (mail_log  *mail_log) {
char *tmp, *date_str;
time_t curtime;
 +int l;
 
time(curtime);
date_str = php_format_date(d-M-Y H:i:s e, 13, curtime, 1 TSRMLS_CC);
 
 -int l = spprintf(tmp, 0, [%s] mail() on [%s:%d]: To: %s -- 
 Headers: %s\n, date_str, zend_get_executed_filename(TSRMLS_C), 
 zend_get_executed_lineno(TSRMLS_C), to, hdr ? hdr : );
 +l = spprintf(tmp, 0, [%s] mail() on [%s:%d]: To: %s -- Headers: 
 %s\n, date_str, zend_get_executed_filename(TSRMLS_C), 
 zend_get_executed_lineno(TSRMLS_C), to, hdr ? hdr : );
 
efree(date_str);
 
 
 -- 
 PHP CVS Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 

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



[PHP-CVS] com php-src: Bug #63699: performance improvements for varios ext/date functions: NEWS ext/date/php_date.c ext/date/php_date.h

2013-01-05 Thread Lars Strojny
Commit:67557fcfcea2c22e9b8d9f0ba86f461c02002cb7
Author:Lars Strojny lstro...@php.net Sun, 6 Jan 2013 03:06:09 
+0100
Parents:   2feea39a3320d100bae8a1193aba9022726a24ea
Branches:  PHP-5.4

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

Log:
Bug #63699: performance improvements for varios ext/date functions

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

Changed paths:
  M  NEWS
  M  ext/date/php_date.c
  M  ext/date/php_date.h


Diff:
diff --git a/NEWS b/NEWS
index 91b7b46..75c9816 100644
--- a/NEWS
+++ b/NEWS
@@ -34,6 +34,10 @@ PHP  
  NEWS
   . Fixed bug #55438 (Curlwapper is not sending http header randomly).
 (php...@lostreality.org, Pierrick)
 
+- Date:
+  . Fixed bug #63699 (Performance improvements for various ext/date functions).
+(Lars, original patch by njaguar at gmail dot com)
+
 20 Dec 2012, PHP 5.4.10
 
 - Core:
diff --git a/ext/date/php_date.c b/ext/date/php_date.c
index ac119a3..1837f94 100644
--- a/ext/date/php_date.c
+++ b/ext/date/php_date.c
@@ -495,9 +495,11 @@ int php_date_global_timezone_db_enabled;
 /* on 90'35; common sunrise declaration (sun body disappeared) */
 #define DATE_SUNRISE_ZENITH 90.58
 
+static PHP_INI_MH(OnUpdate_date_timezone);
+
 /* {{{ INI Settings */
 PHP_INI_BEGIN()
-   STD_PHP_INI_ENTRY(date.timezone, , PHP_INI_ALL, OnUpdateString, 
default_timezone, zend_date_globals, date_globals)
+   STD_PHP_INI_ENTRY(date.timezone, , PHP_INI_ALL, 
OnUpdate_date_timezone, default_timezone, zend_date_globals, date_globals)
PHP_INI_ENTRY(date.default_latitude,   DATE_DEFAULT_LATITUDE, 
   PHP_INI_ALL, NULL)
PHP_INI_ENTRY(date.default_longitude,  
DATE_DEFAULT_LONGITUDE,   PHP_INI_ALL, NULL)
PHP_INI_ENTRY(date.sunset_zenith,  DATE_SUNSET_ZENITH,
   PHP_INI_ALL, NULL)
@@ -599,6 +601,7 @@ static PHP_GINIT_FUNCTION(date)
date_globals-default_timezone = NULL;
date_globals-timezone = NULL;
date_globals-tzcache = NULL;
+   date_globals-timezone_valid = 0;
 }
 /* }}} */
 
@@ -844,25 +847,53 @@ timelib_tzinfo *php_date_parse_tzfile_wrapper(char 
*formal_tzname, const timelib
 }
 /* }}} */
 
+// created this callback method to check the date.timezone only when changed, 
to increase performance and error on an ini_set line
+/* {{{ static PHP_INI_MH(OnUpdate_date_timezone) */
+static PHP_INI_MH(OnUpdate_date_timezone)
+{
+   if (OnUpdateString(entry, new_value, new_value_length, mh_arg1, 
mh_arg2, mh_arg3, stage TSRMLS_CC) == FAILURE) {
+   return FAILURE;
+   }
+
+   DATEG(timezone_valid) = 0;
+   if (stage == PHP_INI_STAGE_RUNTIME) {
+   if (!timelib_timezone_id_is_valid(DATEG(default_timezone), 
DATE_TIMEZONEDB)) {
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, 
DATE_TZ_ERRMSG);
+   } else {
+   DATEG(timezone_valid) = 1;
+   }
+   }
+
+   return SUCCESS;
+}
+/* }}} */
+
 /* {{{ Helper functions */
 static char* guess_timezone(const timelib_tzdb *tzdb TSRMLS_DC)
 {
/* Checking configure timezone */
-   if (DATEG(timezone)  (strlen(DATEG(timezone))  0)) {
+   if (DATEG(timezone)  strlen(DATEG(timezone))  0) {
return DATEG(timezone);
}
/* Check config setting for default timezone */
if (!DATEG(default_timezone)) {
/* Special case: ext/date wasn't initialized yet */
zval ztz;
-   
-   if (SUCCESS == 
zend_get_configuration_directive(date.timezone, sizeof(date.timezone), 
ztz) 
-   Z_TYPE(ztz) == IS_STRING 
-   Z_STRLEN(ztz)  0 
-   timelib_timezone_id_is_valid(Z_STRVAL(ztz), tzdb)) {
+
+   if (SUCCESS == 
zend_get_configuration_directive(date.timezone, sizeof(date.timezone), 
ztz)  Z_TYPE(ztz) == IS_STRING  Z_STRLEN(ztz)  0  
timelib_timezone_id_is_valid(Z_STRVAL(ztz), tzdb)) {
return Z_STRVAL(ztz);
}
-   } else if (*DATEG(default_timezone)  
timelib_timezone_id_is_valid(DATEG(default_timezone), tzdb)) {
+   } else if (*DATEG(default_timezone)) {
+   if (DATEG(timezone_valid) == 1) { // timezone already checked 
and validated
+   return DATEG(default_timezone);
+   }
+
+   if (!timelib_timezone_id_is_valid(DATEG(default_timezone), 
tzdb)) {
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, Invalid 
date.timezone value '%s', we selected the timezone 'UTC' for now., 
DATEG(default_timezone));
+   return UTC;
+   }
+
+   DATEG(timezone_valid) = 1;
return DATEG(default_timezone);
}
/* Fallback to UTC */
diff --git a/ext/date/php_date.h b/ext/date/php_date.h
index c9c1650..f0b662b

[PHP-CVS] com php-src: Bug #63699 performance improvements for ext/date by only validating timezone when timezone is set: ext/date/php_date.c ext/date/php_date.h

2013-01-05 Thread Lars Strojny
Commit:f3824ad16644c53645e7428d2e838278f5a0e1c4
Author:Lars Strojny lstro...@php.net Sun, 6 Jan 2013 02:10:16 
+0100
Parents:   f85e5950ab4552799c119cd1d23617535ed19e61
Branches:  PHP-5.5

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

Log:
Bug #63699 performance improvements for ext/date by only validating timezone 
when timezone is set

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

Changed paths:
  M  ext/date/php_date.c
  M  ext/date/php_date.h


Diff:
diff --git a/ext/date/php_date.c b/ext/date/php_date.c
index c564710..b4819ab 100644
--- a/ext/date/php_date.c
+++ b/ext/date/php_date.c
@@ -495,9 +495,11 @@ int php_date_global_timezone_db_enabled;
 /* on 90'35; common sunrise declaration (sun body disappeared) */
 #define DATE_SUNRISE_ZENITH 90.58
 
+static PHP_INI_MH(OnUpdate_date_timezone);
+
 /* {{{ INI Settings */
 PHP_INI_BEGIN()
-   STD_PHP_INI_ENTRY(date.timezone, , PHP_INI_ALL, OnUpdateString, 
default_timezone, zend_date_globals, date_globals)
+   STD_PHP_INI_ENTRY(date.timezone, , PHP_INI_ALL, 
OnUpdate_date_timezone, default_timezone, zend_date_globals, date_globals)
PHP_INI_ENTRY(date.default_latitude,   DATE_DEFAULT_LATITUDE, 
   PHP_INI_ALL, NULL)
PHP_INI_ENTRY(date.default_longitude,  
DATE_DEFAULT_LONGITUDE,   PHP_INI_ALL, NULL)
PHP_INI_ENTRY(date.sunset_zenith,  DATE_SUNSET_ZENITH,
   PHP_INI_ALL, NULL)
@@ -599,6 +601,7 @@ static PHP_GINIT_FUNCTION(date)
date_globals-default_timezone = NULL;
date_globals-timezone = NULL;
date_globals-tzcache = NULL;
+   date_globals-timezone_valid = 0;
 }
 /* }}} */
 
@@ -843,35 +846,57 @@ timelib_tzinfo *php_date_parse_tzfile_wrapper(char 
*formal_tzname, const timelib
 }
 /* }}} */
 
+// created this callback method to check the date.timezone only when changed, 
to increase performance and error on an ini_set line
+/* {{{ static PHP_INI_MH(OnUpdate_date_timezone) */
+static PHP_INI_MH(OnUpdate_date_timezone)
+{
+   if (OnUpdateString(entry, new_value, new_value_length, mh_arg1, 
mh_arg2, mh_arg3, stage TSRMLS_CC) == FAILURE) {
+   return FAILURE;
+   }
+
+   DATEG(timezone_valid) = 0;
+   if (stage == PHP_INI_STAGE_RUNTIME) {
+   if (!timelib_timezone_id_is_valid(DATEG(default_timezone), 
DATE_TIMEZONEDB)) {
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, 
DATE_TZ_ERRMSG);
+   } else {
+   DATEG(timezone_valid) = 1;
+   }
+   }
+
+   return SUCCESS;
+}
+/* }}} */
+
 /* {{{ Helper functions */
 static char* guess_timezone(const timelib_tzdb *tzdb TSRMLS_DC)
 {
/* Checking configure timezone */
-   if (DATEG(timezone)  (strlen(DATEG(timezone))  0)) {
+   if (DATEG(timezone)  strlen(DATEG(timezone))  0) {
return DATEG(timezone);
}
/* Check config setting for default timezone */
if (!DATEG(default_timezone)) {
/* Special case: ext/date wasn't initialized yet */
zval ztz;
-   
-   if (SUCCESS == 
zend_get_configuration_directive(date.timezone, sizeof(date.timezone), 
ztz) 
-   Z_TYPE(ztz) == IS_STRING 
-   Z_STRLEN(ztz)  0 
-   timelib_timezone_id_is_valid(Z_STRVAL(ztz), tzdb)) {
+
+   if (SUCCESS == 
zend_get_configuration_directive(date.timezone, sizeof(date.timezone), 
ztz)  Z_TYPE(ztz) == IS_STRING  Z_STRLEN(ztz)  0  
timelib_timezone_id_is_valid(Z_STRVAL(ztz), tzdb)) {
return Z_STRVAL(ztz);
}
} else if (*DATEG(default_timezone)) {
-   if (timelib_timezone_id_is_valid(DATEG(default_timezone), 
tzdb)) {
+   if (DATEG(timezone_valid) == 1) { // timezone already checked 
and validated
return DATEG(default_timezone);
}
-   /* Invalid date.timezone value */
-   php_error_docref(NULL TSRMLS_CC, E_WARNING, Invalid 
date.timezone value '%s', we selected the timezone 'UTC' for now., 
DATEG(default_timezone));
-   } else {
-   /* No date.timezone value */
-   php_error_docref(NULL TSRMLS_CC, E_WARNING, DATE_TZ_ERRMSG We 
selected the timezone 'UTC' for now, but please set date.timezone to select 
your timezone.);
+
+   if (!timelib_timezone_id_is_valid(DATEG(default_timezone), 
tzdb)) {
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, Invalid 
date.timezone value '%s', we selected the timezone 'UTC' for now., 
DATEG(default_timezone));
+   return UTC;
+   }
+
+   DATEG(timezone_valid) = 1;
+   return DATEG(default_timezone);
}
/* Fallback to UTC */
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, DATE_TZ_ERRMSG We selected 
the timezone 'UTC' for now

[PHP-CVS] com php-src: Adding test from 5.5: ext/date/tests/date_default_timezone_get-4.phpt

2013-01-05 Thread Lars Strojny
Commit:8e5460ad86d304e9046bee6d41c1d5c260f39f2d
Author:Lars Strojny lstro...@php.net Sun, 6 Jan 2013 03:15:08 
+0100
Parents:   67557fcfcea2c22e9b8d9f0ba86f461c02002cb7
Branches:  PHP-5.4

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

Log:
Adding test from 5.5

Changed paths:
  A  ext/date/tests/date_default_timezone_get-4.phpt


Diff:
diff --git a/ext/date/tests/date_default_timezone_get-4.phpt 
b/ext/date/tests/date_default_timezone_get-4.phpt
new file mode 100644
index 000..6d1982b
--- /dev/null
+++ b/ext/date/tests/date_default_timezone_get-4.phpt
@@ -0,0 +1,11 @@
+--TEST--
+date_default_timezone_get() function [4]
+--INI--
+date.timezone=Incorrect/Zone
+--FILE--
+?php
+   echo date_default_timezone_get(), \n;
+?
+--EXPECTF--
+Warning: date_default_timezone_get(): Invalid date.timezone value 
'Incorrect/Zone', we selected the timezone 'UTC' for now. in 
%sdate_default_timezone_get-4.php on line %d
+UTC


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



[PHP-CVS] com php-src: Bug #23955: allow specifiy max age for setcookie(): NEWS ext/session/session.c ext/standard/head.c ext/standard/tests/network/setcookie.phpt

2013-01-05 Thread Lars Strojny
Commit:ec2fff80e768dfb04aa393c06a2b1a42a9e871ff
Author:Lars Strojny lstro...@php.net Sun, 6 Jan 2013 03:22:44 
+0100
Parents:   f3824ad16644c53645e7428d2e838278f5a0e1c4
Branches:  PHP-5.5

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

Log:
Bug #23955: allow specifiy max age for setcookie()

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

Changed paths:
  M  NEWS
  M  ext/session/session.c
  M  ext/standard/head.c
  A  ext/standard/tests/network/setcookie.phpt


Diff:
diff --git a/NEWS b/NEWS
index 2d0b4c3..1ad954a 100644
--- a/NEWS
+++ b/NEWS
@@ -7,6 +7,7 @@ PHP 
   NEWS
   . Fixed bug #63822 (Crash when using closures with ArrayAccess).
 (Nikita Popov)
   . Add Generator::throw() method. (Nikita Popov)
+  . Bug #23955: allow specifying Max-Age attribute in setcookie() (narfbg, 
Lars)
 
 - cURL:
   . Added new functions curl_escape, curl_multi_setopt, curl_multi_strerror
diff --git a/ext/session/session.c b/ext/session/session.c
index a3be9a7..54bc643 100644
--- a/ext/session/session.c
+++ b/ext/session/session.c
@@ -1154,6 +1154,7 @@ static int php_session_cache_limiter(TSRMLS_D) /* {{{ */
 
 #define COOKIE_SET_COOKIE Set-Cookie: 
 #define COOKIE_EXPIRES ; expires=
+#define COOKIE_MAX_AGE ; Max-Age=
 #define COOKIE_PATH; path=
 #define COOKIE_DOMAIN  ; domain=
 #define COOKIE_SECURE  ; secure
@@ -1201,6 +1202,9 @@ static void php_session_send_cookie(TSRMLS_D) /* {{{ */
smart_str_appends(ncookie, COOKIE_EXPIRES);
smart_str_appends(ncookie, date_fmt);
efree(date_fmt);
+
+   smart_str_appends(ncookie, COOKIE_MAX_AGE);
+   smart_str_append_long(ncookie, PS(cookie_lifetime));
}
}
 
diff --git a/ext/standard/head.c b/ext/standard/head.c
index 97f61f2..fa57817 100644
--- a/ext/standard/head.c
+++ b/ext/standard/head.c
@@ -40,11 +40,11 @@ PHP_FUNCTION(header)
 {
zend_bool rep = 1;
sapi_header_line ctr = {0};
-   
+
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, s|bl, ctr.line,
ctr.line_len, rep, ctr.response_code) == 
FAILURE)
return;
-   
+
sapi_header_op(rep ? SAPI_HEADER_REPLACE:SAPI_HEADER_ADD, ctr 
TSRMLS_CC);
 }
 /* }}} */
@@ -80,7 +80,7 @@ PHPAPI int php_setcookie(char *name, int name_len, char 
*value, int value_len, t
char *dt;
sapi_header_line ctr = {0};
int result;
-   
+
if (name  strpbrk(name, =,; \t\r\n\013\014) != NULL) {   /* man 
isspace for \013 and \014 */
zend_error( E_WARNING, Cookie names cannot contain any of the 
following '=,; \\t\\r\\n\\013\\014' );
return FAILURE;
@@ -111,18 +111,19 @@ PHPAPI int php_setcookie(char *name, int name_len, char 
*value, int value_len, t
cookie = emalloc(len + 100);
 
if (value  value_len == 0) {
-   /* 
+   /*
 * MSIE doesn't delete a cookie when you set it to a null value
 * so in order to force cookies to be deleted, even on MSIE, we
 * pick an expiry date in the past
 */
dt = php_format_date(D, d-M-Y H:i:s T, sizeof(D, d-M-Y H:i:s 
T)-1, 1, 0 TSRMLS_CC);
-   snprintf(cookie, len + 100, Set-Cookie: %s=deleted; 
expires=%s, name, dt);
+   snprintf(cookie, len + 100, Set-Cookie: %s=deleted; 
expires=%s; Max-Age=0, name, dt);
efree(dt);
} else {
snprintf(cookie, len + 100, Set-Cookie: %s=%s, name, value ? 
encoded_value : );
if (expires  0) {
const char *p;
+   char tsdelta[13];
strlcat(cookie, ; expires=, len + 100);
dt = php_format_date(D, d-M-Y H:i:s T, sizeof(D, 
d-M-Y H:i:s T)-1, expires, 0 TSRMLS_CC);
/* check to make sure that the year does not exceed 4 
digits in length */
@@ -136,6 +137,10 @@ PHPAPI int php_setcookie(char *name, int name_len, char 
*value, int value_len, t
}
strlcat(cookie, dt, len + 100);
efree(dt);
+
+   snprintf(tsdelta, sizeof(tsdelta), %li, (long) 
difftime(expires, time(NULL)));
+   strlcat(cookie, ; Max-Age=, len + 100);
+   strlcat(cookie, tsdelta, len + 100);
}
}
 
@@ -237,11 +242,11 @@ PHP_FUNCTION(headers_sent)
ZVAL_LONG(arg2, line);
case 1:
zval_dtor(arg1);
-   if (file) { 
+   if (file) {
ZVAL_STRING(arg1, file, 1);
} else {
ZVAL_STRING(arg1, , 1

[PHP-CVS] com php-src: Add more tests for the new +0/-0 behaviour.: ext/filter/tests/filter_data.phpt

2012-12-28 Thread Lars Strojny
Commit:dcd99c4b19a29f37859769216e56d9a3cf0d232d
Author:Martin Jansen mar...@divbyzero.net Wed, 26 Dec 2012 
11:51:55 +0100
Committer: Lars Strojny lstro...@php.net  Sat, 29 Dec 2012 03:31:22 +0100
Parents:   3990641e62b5648965883604e286b64e098b351e
Branches:  PHP-5.4

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

Log:
Add more tests for the new +0/-0 behaviour.

Changed paths:
  M  ext/filter/tests/filter_data.phpt


Diff:
diff --git a/ext/filter/tests/filter_data.phpt 
b/ext/filter/tests/filter_data.phpt
index 5e3b82a..f83d986 100644
--- a/ext/filter/tests/filter_data.phpt
+++ b/ext/filter/tests/filter_data.phpt
@@ -15,6 +15,8 @@ $data = +0; var_dump(filter_var($data, 
FILTER_VALIDATE_INT));
 $data = 123;var_dump(filter_var($data, FILTER_VALIDATE_INT));
 $data = -123; var_dump(filter_var($data, FILTER_VALIDATE_INT));
 $data = 0;var_dump(filter_var($data, FILTER_VALIDATE_INT));
+$data = -0;var_dump(filter_var($data, FILTER_VALIDATE_INT));
+$data = +0;var_dump(filter_var($data, FILTER_VALIDATE_INT));
 $data = 123;  var_dump(filter_var($data, FILTER_VALIDATE_INT));
 $data = ;   var_dump(filter_var($data, FILTER_VALIDATE_INT));
 echo \n;
@@ -53,6 +55,8 @@ int(0)
 int(123)
 int(-123)
 int(0)
+int(0)
+int(0)
 int(123)
 bool(false)


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



[PHP-CVS] com php-src: News entry for +0/-0 filter fix: NEWS

2012-12-28 Thread Lars Strojny
Commit:ee258fe87dd3dd61d0a806e22055d7a4bb574a0c
Author:Lars Strojny lstro...@php.net Sat, 29 Dec 2012 03:34:23 
+0100
Parents:   dcd99c4b19a29f37859769216e56d9a3cf0d232d
Branches:  PHP-5.4

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

Log:
News entry for +0/-0 filter fix

Changed paths:
  M  NEWS


Diff:
diff --git a/NEWS b/NEWS
index 164daeb..6165ff9 100644
--- a/NEWS
+++ b/NEWS
@@ -4,6 +4,8 @@ PHP 
   NEWS
 
 - Filter:
   . Fixed bug #63757 (getenv() produces memory leak with CGI SAPI). (Dmitry)
+  . Fixed bug #54096 (FILTER_VALIDATE_INT does not accept +0 and -0).
+(martin at divbyzero dot net, Lars)
 
 - JSON:
   . Fixed bug #63737 (json_decode does not properly decode with options


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



[PHP-CVS] com php-src: Treat +0 and -0 as valid integers just like var_dump() does.: ext/filter/logical_filters.c ext/filter/tests/filter_data.phpt

2012-12-28 Thread Lars Strojny
Commit:3990641e62b5648965883604e286b64e098b351e
Author:Martin Jansen mar...@divbyzero.net Mon, 24 Dec 2012 
14:58:01 +0100
Committer: Lars Strojny lstro...@php.net  Sat, 29 Dec 2012 03:31:13 +0100
Parents:   ac3d227e28056bf5294a8a64e2f41ce2beebaa05
Branches:  PHP-5.4

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

Log:
Treat +0 and -0 as valid integers just like var_dump() does.

This fixes bug #54096.

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

Changed paths:
  M  ext/filter/logical_filters.c
  M  ext/filter/tests/filter_data.phpt


Diff:
diff --git a/ext/filter/logical_filters.c b/ext/filter/logical_filters.c
index 4de6b83..c03c698 100644
--- a/ext/filter/logical_filters.c
+++ b/ext/filter/logical_filters.c
@@ -80,6 +80,11 @@ static int php_filter_parse_int(const char *str, unsigned 
int str_len, long *ret
break;
}
 
+   if (*str == '0'  str + 1 == end) {
+   /* Special cases: +0 and -0 */
+   return 1;
+   }
+
/* must start with 1..9*/
if (str  end  *str = '1'  *str = '9') {
ctx_value = ((sign)?-1:1) * ((*(str++)) - '0');
diff --git a/ext/filter/tests/filter_data.phpt 
b/ext/filter/tests/filter_data.phpt
index 1071b3e..5e3b82a 100644
--- a/ext/filter/tests/filter_data.phpt
+++ b/ext/filter/tests/filter_data.phpt
@@ -10,6 +10,8 @@ precision=14
 /* Integer */
 $data = -123;   var_dump(filter_var($data, FILTER_VALIDATE_INT));
 $data = 0;  var_dump(filter_var($data, FILTER_VALIDATE_INT));
+$data = -0; var_dump(filter_var($data, FILTER_VALIDATE_INT));
+$data = +0; var_dump(filter_var($data, FILTER_VALIDATE_INT));
 $data = 123;var_dump(filter_var($data, FILTER_VALIDATE_INT));
 $data = -123; var_dump(filter_var($data, FILTER_VALIDATE_INT));
 $data = 0;var_dump(filter_var($data, FILTER_VALIDATE_INT));
@@ -46,6 +48,8 @@ $data = ;   var_dump(filter_var($data, 
FILTER_VALIDATE_BOOLEAN));
 --EXPECT--
 int(-123)
 int(0)
+int(0)
+int(0)
 int(123)
 int(-123)
 int(0)


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



Re: [PHP-CVS] com php-src: News entry for updated mime types: NEWS

2012-12-15 Thread Lars Strojny
Sure.

Am 15.12.2012 um 04:49 schrieb Christopher Jones christopher.jo...@oracle.com:

 On 12/14/2012 05:54 AM, Lars Strojny wrote:
  +- CLI server
  +  . Update list of common mime types (Lars, pascalc at gmail dot com)
 
 Could you list the new types in the NEWS entry?  This would help users
 (and doc writers) so they don't have to dig thru the code  commits to
 find out what was added.
 
 Thanks,
 
 Chris
 
 -- 
 christopher.jo...@oracle.com  http://twitter.com/ghrd
 
 -- 
 PHP CVS Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 


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



[PHP-CVS] com php-src: Updating news entry to list new filetypes: NEWS

2012-12-15 Thread Lars Strojny
Commit:36a5eca89ca6bdf0f6351f40bbcb893251887116
Author:Lars Strojny lstro...@php.net Sat, 15 Dec 2012 12:00:42 
+0100
Parents:   c3b480323f78cfd756ef59d6ec0c98252fd9b5b3
Branches:  PHP-5.4

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

Log:
Updating news entry to list new filetypes

Changed paths:
  M  NEWS


Diff:
diff --git a/NEWS b/NEWS
index c967619..2a8660e 100644
--- a/NEWS
+++ b/NEWS
@@ -10,7 +10,8 @@ PHP   
 NEWS
 parameter). (Adam)
 
 - CLI server
-  . Update list of common mime types (Lars, pascalc at gmail dot com)
+  . Update list of common mime types. Added webm, ogv, ogg. (Lars,
+pascalc at gmail dot com)
 
 ?? ??? 2012, PHP 5.4.10


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



[PHP-CVS] com php-src: update test for supported Mime Types checking: sapi/cli/tests/bug61977.phpt

2012-12-14 Thread Lars Strojny
Commit:d813af06187c42d89b68d49ba1acf0c207026e8f
Author:pascalc pascal.chev...@free.fr Tue, 11 Dec 2012 16:05:12 
+0100
Committer: Lars Strojny lstro...@php.net  Fri, 14 Dec 2012 13:59:06 +0100
Parents:   e5b1ebc082416330cd6f6b8f457d825aab2674eb
Branches:  PHP-5.4

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

Log:
update test for supported Mime Types checking

Changed paths:
  M  sapi/cli/tests/bug61977.phpt


Diff:
diff --git a/sapi/cli/tests/bug61977.phpt b/sapi/cli/tests/bug61977.phpt
index 2f19806..09a6ba6 100644
--- a/sapi/cli/tests/bug61977.phpt
+++ b/sapi/cli/tests/bug61977.phpt
@@ -1,5 +1,5 @@
 --TEST--
-Bug #61977 (Need CLI web-server support for files with .htm  svg extensions)
+Bug #61977 test CLI web-server support for Mime Type File extensions mapping
 --SKIPIF--
 ?php
 include skipif.inc; 
@@ -8,145 +8,40 @@ include skipif.inc;
 ?php
 include php_cli_server.inc;
 php_cli_server_start('?php ?', true);
-$doc_root = __DIR__;
 
-list($host, $port) = explode(':', PHP_CLI_SERVER_ADDRESS);
-$port = intval($port)?:80;
-
-$fp = fsockopen($host, $port, $errno, $errstr, 0.5);
-if (!$fp) {
-  die(connect failed);
-}
-
-file_put_contents($doc_root . '/foo.html', '');
-if(fwrite($fp, HEADER
-GET /foo.html HTTP/1.1
-Host: {$host}
-
-
-HEADER
-)) {
-   while (!feof($fp)) {
-   $text = fgets($fp);
-if (strncasecmp(Content-type:, $text, 13) == 0) {
-   echo foo.html = , $text;
-}
-   }
-}
-@unlink($doc_root . '/foo.html');
-fclose($fp);
-
-
-$fp = fsockopen($host, $port, $errno, $errstr, 0.5);
-if (!$fp) {
-  die(connect failed);
-}
-file_put_contents($doc_root . '/foo.htm', '');
-if(fwrite($fp, HEADER
-GET /foo.htm HTTP/1.1
-Host: {$host}
-
-
-HEADER
-)) {
-   while (!feof($fp)) {
-   $text = fgets($fp);
-if (strncasecmp(Content-type:, $text, 13) == 0) {
-   echo foo.htm = , $text;
-}
-   }
-}
-@unlink($doc_root . '/foo.htm');
-fclose($fp);
-
-
-$fp = fsockopen($host, $port, $errno, $errstr, 0.5);
-if (!$fp) {
-  die(connect failed);
-}
-file_put_contents($doc_root . '/foo.svg', '');
-if(fwrite($fp, HEADER
-GET /foo.svg HTTP/1.1
+/*
+ * If a Mime Type is added in php_cli_server.c, add it to this array and update
+ * the EXPECTF section accordingly
+ */
+$mimetypes = ['html', 'htm', 'svg', 'css', 'js', 'png', 'webm', 'ogv', 'ogg'];
+
+function test_mimetypes($mimetypes) {
+foreach ($mimetypes as $mimetype) {
+list($host, $port) = explode(':', PHP_CLI_SERVER_ADDRESS);
+$port = intval($port) ? : 80;
+$fp   = fsockopen($host, $port, $errno, $errstr, 0.5);
+if (!$fp) die('Connect failed');
+file_put_contents(__DIR__ . /foo.{$mimetype}, '');
+$header = HEADER
+GET /foo.{$mimetype} HTTP/1.1
 Host: {$host}
 
 
-HEADER
-)) {
-   while (!feof($fp)) {
-   $text = fgets($fp);
-if (strncasecmp(Content-type:, $text, 13) == 0) {
-   echo foo.svg = , $text;
+HEADER;
+if (fwrite($fp, $header)) {
+while (!feof($fp)) {
+$text = fgets($fp);
+if (strncasecmp(Content-type:, $text, 13) == 0) {
+echo foo.{$mimetype} = , $text;
+}
+}
+@unlink(__DIR__ . /foo.{$mimetype});
+fclose($fp);
 }
-   }
+}
 }
-@unlink($doc_root . '/foo.svg');
-fclose($fp);
 
-$fp = fsockopen($host, $port, $errno, $errstr, 0.5);
-if (!$fp) {
-  die(connect failed);
-}
-file_put_contents($doc_root . '/foo.css', '');
-if(fwrite($fp, HEADER
-GET /foo.css HTTP/1.1
-Host: {$host}
-
-
-HEADER
-)) {
-   while (!feof($fp)) {
-   $text = fgets($fp);
-if (strncasecmp(Content-type:, $text, 13) == 0) {
-   echo foo.css = , $text;
-}
-   }
-}
-@unlink($doc_root . '/foo.css');
-fclose($fp);
-
-$fp = fsockopen($host, $port, $errno, $errstr, 0.5);
-if (!$fp) {
-  die(connect failed);
-}
-file_put_contents($doc_root . '/foo.js', '');
-if(fwrite($fp, HEADER
-GET /foo.js HTTP/1.1
-Host: {$host}
-
-
-HEADER
-)) {
-   while (!feof($fp)) {
-   $text = fgets($fp);
-if (strncasecmp(Content-type:, $text, 13) == 0) {
-   echo foo.js = , $text;
-}
-   }
-}
-@unlink($doc_root . '/foo.js');
-fclose($fp);
-
-$fp = fsockopen($host, $port, $errno, $errstr, 0.5);
-if (!$fp) {
-  die(connect failed);
-}
-file_put_contents($doc_root . '/foo.png', '');
-if(fwrite($fp, HEADER
-GET /foo.png HTTP/1.1
-Host: {$host}
-
-
-HEADER
-)) {
-   while (!feof($fp)) {
-   $text = fgets($fp);
-if (strncasecmp(Content-type:, $text, 13) == 0) {
-   echo foo.png = , $text;
-}
-   }
-}
-@unlink($doc_root . '/foo.png');
-fclose($fp);
+test_mimetypes($mimetypes);
 ?
 --EXPECTF--
 foo.html = Content-Type: text/html; charset=UTF-8
@@ -155,3 +50,6 @@ foo.svg = Content-Type: image/svg+xml
 foo.css = Content

[PHP-CVS] com php-src: News entry for updated mime types: NEWS

2012-12-14 Thread Lars Strojny
Commit:c3b480323f78cfd756ef59d6ec0c98252fd9b5b3
Author:Lars Strojny lstro...@php.net Fri, 14 Dec 2012 14:54:38 
+0100
Parents:   d813af06187c42d89b68d49ba1acf0c207026e8f
Branches:  PHP-5.4

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

Log:
News entry for updated mime types

Changed paths:
  M  NEWS


Diff:
diff --git a/NEWS b/NEWS
index dfbcbf0..c967619 100644
--- a/NEWS
+++ b/NEWS
@@ -9,6 +9,9 @@ PHP 
   NEWS
   . Fixed bug #63737 (json_decode does not properly decode with options
 parameter). (Adam)
 
+- CLI server
+  . Update list of common mime types (Lars, pascalc at gmail dot com)
+
 ?? ??? 2012, PHP 5.4.10
 
 - Core:


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



[PHP-CVS] com php-src: update list of common Mime Types in PHP development server to support Web audio/video formats (Webm ,and Ogg containers) + have jpeg mime types listed together: sapi/cli/php_cli

2012-12-14 Thread Lars Strojny
Commit:e5b1ebc082416330cd6f6b8f457d825aab2674eb
Author:pascalc pascal.chev...@free.fr Tue, 11 Dec 2012 12:45:00 
+0100
Committer: Lars Strojny lstro...@php.net  Fri, 14 Dec 2012 13:59:01 +0100
Parents:   77c4b84ac893a6e4824a58d17475149f6a1c2322
Branches:  PHP-5.4

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

Log:
update list of common Mime Types in PHP development server to support Web 
audio/video formats (Webm ,and Ogg containers) + have jpeg mime types listed 
together

Changed paths:
  M  sapi/cli/php_cli_server.c


Diff:
diff --git a/sapi/cli/php_cli_server.c b/sapi/cli/php_cli_server.c
index 5f263cb..8cff439 100644
--- a/sapi/cli/php_cli_server.c
+++ b/sapi/cli/php_cli_server.c
@@ -259,10 +259,13 @@ static php_cli_server_ext_mime_type_pair mime_type_map[] 
= {
{ gif, image/gif },
{ jpg, image/jpeg },
{ jpeg, image/jpeg },
-   { png, image/png },
{ jpe, image/jpeg },
+   { png, image/png },
{ svg, image/svg+xml },
{ txt, text/plain },
+   { webm, video/webm },
+   { ogv, video/ogg },
+   { ogg, audio/ogg },
{ NULL, NULL }
 };


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



[PHP-CVS] com php-src: Merge branch 'PHP-5.4' into PHP-5.5: sapi/cli/php_cli_server.c

2012-12-14 Thread Lars Strojny
Commit:aaa5e42177c2b8eac77ff25b7b4335a1c2b9f214
Author:Lars Strojny lstro...@php.net Fri, 14 Dec 2012 14:56:25 
+0100
Parents:   a73a6be76417571e7e4a467e8d9c7f82e8a45a9c 
c3b480323f78cfd756ef59d6ec0c98252fd9b5b3
Branches:  PHP-5.5

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

Log:
Merge branch 'PHP-5.4' into PHP-5.5

Changed paths:
  MM  sapi/cli/php_cli_server.c


Diff:



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



[PHP-CVS] com php-src: Bug #49341: Add SO_REUSEPORT support for socket_set_option(): ext/sockets/sockets.c ext/sockets/tests/bug49341.phpt

2012-12-02 Thread Lars Strojny
Commit:ec2a132f9c345e6b40d04f7230d25b2fe5659672
Author:Igor Wiedler i...@wiedler.ch Sun, 2 Sep 2012 23:18:45 +0200
Parents:   7552a7eb191b477349fa278e50fa8b3858382535
Branches:  PHP-5.4

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

Log:
Bug #49341: Add SO_REUSEPORT support for socket_set_option()

This is a BSD-only feature, and it will only be available on BSD.
On other platforms the constant will simply not be set.

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

Changed paths:
  M  ext/sockets/sockets.c
  A  ext/sockets/tests/bug49341.phpt


Diff:
diff --git a/ext/sockets/sockets.c b/ext/sockets/sockets.c
index 0d17142..d6ee418 100644
--- a/ext/sockets/sockets.c
+++ b/ext/sockets/sockets.c
@@ -788,6 +788,9 @@ PHP_MINIT_FUNCTION(sockets)
 #endif
REGISTER_LONG_CONSTANT(SO_DEBUG,  SO_DEBUG,   
CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT(SO_REUSEADDR,  SO_REUSEADDR,   CONST_CS | 
CONST_PERSISTENT);
+#ifdef SO_REUSEPORT
+   REGISTER_LONG_CONSTANT(SO_REUSEPORT,  SO_REUSEPORT,   CONST_CS | 
CONST_PERSISTENT);
+#endif
REGISTER_LONG_CONSTANT(SO_KEEPALIVE,  SO_KEEPALIVE,   CONST_CS | 
CONST_PERSISTENT);
REGISTER_LONG_CONSTANT(SO_DONTROUTE,  SO_DONTROUTE,   CONST_CS | 
CONST_PERSISTENT);
REGISTER_LONG_CONSTANT(SO_LINGER, SO_LINGER,  
CONST_CS | CONST_PERSISTENT);
diff --git a/ext/sockets/tests/bug49341.phpt b/ext/sockets/tests/bug49341.phpt
new file mode 100644
index 000..c165ac7
--- /dev/null
+++ b/ext/sockets/tests/bug49341.phpt
@@ -0,0 +1,15 @@
+--TEST--
+Bug #49341: add SO_REUSEPORT support for socket_set_option()
+--SKIPIF--
+?php
+if (!extension_loaded('sockets')) {
+die('skip sockets extension not available.');
+}
+if (PHP_OS !== 'Darwin'  false === strpos(PHP_OS, 'BSD')) {
+die('is not *BSD.');
+}
+--FILE--
+?php
+var_dump(defined('SO_REUSEPORT'));
+--EXPECTF--
+bool(true)


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



[PHP-CVS] com php-src: News entry for bug #49341: NEWS

2012-12-02 Thread Lars Strojny
Commit:12de2e91d0f10f93e177378f84d1dcc1c03e1141
Author:Lars Strojny lstro...@php.net Sun, 2 Dec 2012 19:41:19 
+0100
Parents:   ec2a132f9c345e6b40d04f7230d25b2fe5659672
Branches:  PHP-5.4

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

Log:
News entry for bug #49341

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

Changed paths:
  M  NEWS


Diff:
diff --git a/NEWS b/NEWS
index c2d4a13..1296b02 100644
--- a/NEWS
+++ b/NEWS
@@ -49,6 +49,10 @@ PHP  
  NEWS
   . Fixed bug #63271 (SOAP wsdl cache is not enabled after initial requests).
 (John Jawed, Dmitry)
 
+- Sockets
+  . Fixed bug #49341 (Add SO_REUSEPORT support for socket_set_option()).
+(Igor Wiedler, Lars)
+
 22 Nov 2012, PHP 5.4.9
 
 - Core:


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



[PHP-CVS] com php-src: Merge branch 'PHP-5.4': ext/sockets/sockets.c

2012-12-02 Thread Lars Strojny
Commit:d1b8c6df76bf5d029e389184c8d0202c9d812fd8
Author:Lars Strojny lstro...@php.net Sun, 2 Dec 2012 19:41:55 
+0100
Parents:   d77dab19eba8dc422fea1d28798b79d511c26afe 
12de2e91d0f10f93e177378f84d1dcc1c03e1141
Branches:  master

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

Log:
Merge branch 'PHP-5.4'

Changed paths:
  MM  ext/sockets/sockets.c


Diff:



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



[PHP-CVS] com php-src: Merge branch 'PHP-5.4' into PHP-5.5: ext/sockets/sockets.c

2012-12-02 Thread Lars Strojny
Commit:575b9837032104cc397ed76256f6536e13636fff
Author:Lars Strojny lstro...@php.net Sun, 2 Dec 2012 19:42:25 
+0100
Parents:   50fec2bae2996ec7c77cab68b34fe06a02db4816 
12de2e91d0f10f93e177378f84d1dcc1c03e1141
Branches:  PHP-5.5

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

Log:
Merge branch 'PHP-5.4' into PHP-5.5

Changed paths:
  MM  ext/sockets/sockets.c


Diff:



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



[PHP-CVS] com php-src: Fixing test according to @jpauli's suggestions: tests/classes/unset_public_properties.phpt

2012-12-02 Thread Lars Strojny
Commit:12f451c7710f1812418b8fdbabead2dc52796e29
Author:Marco Pivetta ocram...@gmail.com Wed, 7 Nov 2012 18:56:32 
+0100
Committer: Lars Strojny lstro...@php.net  Sun, 2 Dec 2012 19:47:13 +0100
Parents:   1377942b6963f53c77226b8a68832183b9916426
Branches:  PHP-5.4

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

Log:
Fixing test according to @jpauli's suggestions

Changed paths:
  M  tests/classes/unset_public_properties.phpt


Diff:
diff --git a/tests/classes/unset_public_properties.phpt 
b/tests/classes/unset_public_properties.phpt
index 8c0096e..ead9336 100644
--- a/tests/classes/unset_public_properties.phpt
+++ b/tests/classes/unset_public_properties.phpt
@@ -60,7 +60,6 @@ echo \n;
 echo $o-testProperty;
 
 ?
-DONE
 --EXPECTF--
 property set


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



[PHP-CVS] com php-src: Adding tests for private and protected properties: tests/classes/unset_properties.phpt tests/classes/unset_public_properties.phpt

2012-12-02 Thread Lars Strojny
Commit:627eb9e3d99c75a4d0309c1321e91a3a7ec4571c
Author:Marco Pivetta ocram...@gmail.com Thu, 8 Nov 2012 05:51:01 
+0100
Committer: Lars Strojny lstro...@php.net  Sun, 2 Dec 2012 19:47:18 +0100
Parents:   12f451c7710f1812418b8fdbabead2dc52796e29
Branches:  PHP-5.4

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

Log:
Adding tests for private and protected properties

Changed paths:
  A  tests/classes/unset_properties.phpt
  D  tests/classes/unset_public_properties.phpt


Diff:
diff --git a/tests/classes/unset_properties.phpt 
b/tests/classes/unset_properties.phpt
new file mode 100644
index 000..7f9b569
--- /dev/null
+++ b/tests/classes/unset_properties.phpt
@@ -0,0 +1,154 @@
+--TEST--
+Un-setting instance properties causes magic methods to be called when trying 
to access them from outside the magic
+methods themselves.
+--FILE--
+?php
+
+class Test
+{
+   public$publicProperty= 'publicProperty set';
+
+   protected $protectedProperty = 'protectedProperty set';
+
+   private   $privateProperty   = 'privateProperty set';
+   
+   public function __get($name)
+   {
+   return '__get ' . $name . '';
+   }
+   
+   public function __set($name, $value)
+   {
+   $this-$name = $value;
+   echo '__set ' . $name . ' to ' . $value . '';
+   }
+   
+   public function __isset($name)
+   {
+   echo '__isset ' . $name . '';
+   return isset($this-$name);
+   }
+   
+   public function getPublicProperty()
+   {
+   return $this-publicProperty;
+   }
+   
+   public function setPublicProperty($publicProperty)
+   {
+   $this-publicProperty = $publicProperty;
+   }
+
+   public function unsetProtectedProperty()
+   {
+   unset($this-protectedProperty);
+   }
+
+   public function getProtectedProperty()
+   {
+   return $this-protectedProperty;
+   }
+
+   public function setProtectedProperty($protectedProperty)
+   {
+   $this-protectedProperty = $protectedProperty;
+   }
+
+   public function unsetPrivateProperty()
+   {
+   unset($this-privateProperty);
+   }
+
+   public function getPrivateProperty()
+   {
+   return $this-privateProperty;
+   }
+
+   public function setPrivateProperty($privateProperty)
+   {
+   $this-privateProperty = $privateProperty;
+   }
+}
+
+// verifying public property
+$o = new Test;
+echo $o-publicProperty;
+echo \n;
+var_export(isset($o-publicProperty));
+echo \n;
+unset($o-publicProperty);
+isset($o-publicProperty);
+echo \n;
+echo $o-publicProperty;
+echo \n;
+echo $o-getPublicProperty();
+echo \n;
+echo $o-setPublicProperty('new publicProperty value via setter');
+echo \n;
+echo $o-publicProperty;
+echo \n;
+unset($o-publicProperty);
+$o-publicProperty = 'new publicProperty value via public access';
+echo \n;
+var_export(isset($o-publicProperty));
+echo \n;
+echo $o-publicProperty;
+echo \n\n;
+
+// verifying protected property
+echo $o-getProtectedProperty();
+echo \n;
+$o-unsetProtectedProperty();
+var_export(isset($o-protectedProperty));
+echo \n;
+echo $o-getProtectedProperty();
+echo \n;
+echo $o-setProtectedProperty('new protectedProperty value via setter');
+echo \n;
+var_export(isset($o-protectedProperty));
+echo \n;
+echo $o-getProtectedProperty();
+echo \n\n;
+
+// verifying private property
+echo $o-getPrivateProperty();
+echo \n;
+$o-unsetPrivateProperty();
+var_export(isset($o-privateProperty));
+echo \n;
+echo $o-getPrivateProperty();
+echo \n;
+echo $o-setPrivateProperty('new privateProperty value via setter');
+echo \n;
+var_export(isset($o-privateProperty));
+echo \n;
+echo $o-getPrivateProperty();
+echo \n\n;
+
+?
+
+--EXPECTF--
+publicProperty set
+true
+__isset publicProperty
+__get publicProperty
+__get publicProperty
+__set publicProperty to new publicProperty value via setter
+new publicProperty value via setter
+__set publicProperty to new publicProperty value via public access
+true
+new publicProperty value via public access
+
+protectedProperty set
+__isset protectedProperty__isset protectedPropertyfalse
+__get protectedProperty
+__set protectedProperty to new protectedProperty value via setter
+__isset protectedPropertytrue
+new protectedProperty value via setter
+
+privateProperty set
+__isset privateProperty__isset privatePropertyfalse
+__get privateProperty
+__set privateProperty to new privateProperty value via setter
+__isset privatePropertytrue
+new privateProperty value via setter
\ No newline at end of file
diff --git a/tests/classes/unset_public_properties.phpt 
b/tests/classes/unset_public_properties.phpt
deleted file mode 100644
index ead9336..000
--- a/tests/classes/unset_public_properties.phpt
+++ /dev/null
@@ -1,73 +0,0

[PHP-CVS] com php-src: Adding regression test for behavior of magic methods with unset public properties: tests/classes/unset_public_properties.phpt

2012-12-02 Thread Lars Strojny
Commit:1377942b6963f53c77226b8a68832183b9916426
Author:Marco Pivetta ocram...@gmail.com Fri, 26 Oct 2012 03:54:05 
+0200
Committer: Lars Strojny lstro...@php.net  Sun, 2 Dec 2012 19:47:09 +0100
Parents:   12de2e91d0f10f93e177378f84d1dcc1c03e1141
Branches:  PHP-5.4

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

Log:
Adding regression test for behavior of magic methods with unset public 
properties

Verifies that after having unset a public property, any access to it, be it 
read or write, causes calls to public magic methods

Signed-off-by: Marco Pivetta ocram...@gmail.com

Changed paths:
  A  tests/classes/unset_public_properties.phpt


Diff:
diff --git a/tests/classes/unset_public_properties.phpt 
b/tests/classes/unset_public_properties.phpt
new file mode 100644
index 000..8c0096e
--- /dev/null
+++ b/tests/classes/unset_public_properties.phpt
@@ -0,0 +1,74 @@
+--TEST--
+Un-setting public instance properties causes magic methods to be called when 
trying to access them from outside class scope
+--FILE--
+?php
+
+class Test
+{
+   public $testProperty = 'property set';
+   
+   public function __get($name)
+   {
+   return '__get ' . $name;
+   }
+   
+   public function __set($name, $value)
+   {
+   $this-$name = $value;
+   echo '__set ' . $name . ' to ' . $value;
+   }
+   
+   public function __isset($name)
+   {
+   echo '__isset ' . $name;
+   return isset($this-$name);
+   }
+   
+   public function getTestProperty()
+   {
+   return $this-testProperty;
+   }
+   
+   public function setTestProperty($testProperty)
+   {
+   $this-testProperty = $testProperty;
+   }
+}
+
+$o = new Test;
+
+echo $o-testProperty;
+echo \n;
+isset($o-testProperty);
+echo \n;
+unset($o-testProperty);
+isset($o-testProperty);
+echo \n;
+echo $o-testProperty;
+echo \n;
+echo $o-getTestProperty();
+echo \n;
+echo $o-setTestProperty('new value via setter');
+echo \n;
+echo $o-testProperty;
+echo \n;
+unset($o-testProperty);
+$o-testProperty = 'new value via public access';
+echo \n;
+isset($o-testProperty);
+echo \n;
+echo $o-testProperty;
+
+?
+DONE
+--EXPECTF--
+property set
+
+__isset testProperty
+__get testProperty
+__get testProperty
+__set testProperty to new value via setter
+new value via setter
+__set testProperty to new value via public access
+
+new value via public access


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



[PHP-CVS] com php-src: make failed tests fail the test target: Makefile.global

2012-11-11 Thread Lars Strojny
Commit:180767373d03238431103c02a93de19df49c14dc
Author:Bernhard K. Weisshuhn b...@codingforce.com Sun, 11 Nov 
2012 20:11:06 +0100
Parents:   4029475e82552a3ceddbdd343bdb5641eb269c50
Branches:  master

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

Log:
make failed tests fail the test target

I don't see any reason to ignore failed tests. This makes it
unnecessarily difficult to use ci, also for module builds.

Changed paths:
  M  Makefile.global


Diff:
diff --git a/Makefile.global b/Makefile.global
index b30c318..eaf651e 100644
--- a/Makefile.global
+++ b/Makefile.global
@@ -86,7 +86,7 @@ PHP_TEST_SHARED_EXTENSIONS =  ` \
 PHP_DEPRECATED_DIRECTIVES_REGEX = 
'^(magic_quotes_(gpc|runtime|sybase)?|(zend_)?extension(_debug)?(_ts)?)[\t\ ]*='
 
 test: all
-   -@if test ! -z $(PHP_EXECUTABLE)  test -x $(PHP_EXECUTABLE); then 
\
+   @if test ! -z $(PHP_EXECUTABLE)  test -x $(PHP_EXECUTABLE); then \
INI_FILE=`$(PHP_EXECUTABLE) -d 'display_errors=stderr' -r 'echo 
php_ini_loaded_file();' 2 /dev/null`; \
if test $$INI_FILE; then \
$(EGREP) -h -v $(PHP_DEPRECATED_DIRECTIVES_REGEX) 
$$INI_FILE  $(top_builddir)/tmp-php.ini; \


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



[PHP-CVS] com php-src: Fixing NEWS file: NEWS

2012-09-21 Thread Lars Strojny
Commit:734bda7a2ddea53293eb8abdb9842a0079d54a53
Author:Lars Strojny lstro...@php.net Fri, 21 Sep 2012 13:22:53 
+0200
Parents:   b69068705ecfdad954cc072e00b8b630f39b7f15
Branches:  PHP-5.4

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

Log:
Fixing NEWS file

Changed paths:
  M  NEWS


Diff:
diff --git a/NEWS b/NEWS
index f5e413e..0082ae9 100644
--- a/NEWS
+++ b/NEWS
@@ -48,6 +48,10 @@ PHP  
  NEWS
   . Bug #49510: Boolean validation fails with FILTER_NULL_ON_FAILURE with empty
 string or false. (Lars)
 
+- Sockets
+  . Fixed bug #63000 (MCAST_JOIN_GROUP on OSX is broken, merge of PR 185 by
+Igor Wiedler). (Lars)
+
 ?? ??? 2012, PHP 5.4.7
 
 - Core:
@@ -251,8 +255,6 @@ PHP 
   NEWS
 
 - Sockets:
   . Fixed bug #62025 (__ss_family was changed on AIX 5.3). (Felipe)
-  . Fixed bug #63000 (MCAST_JOIN_GROUP on OSX is broken, merge of PR 185 by
-Igor Wiedler). (Lars)
 
 - SPL:
   . Fixed bug #62433 (Inconsistent behavior of RecursiveDirectoryIterator to


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



[PHP-CVS] com php-src: Bug #63000: MCAST_JOIN_GROUP on OSX is broken: NEWS ext/sockets/multicast.h ext/sockets/tests/bug63000.phpt

2012-09-19 Thread Lars Strojny
Commit:188c124a57a27e3d6baf786608a45d713d4595f6
Author:Lars Strojny lstro...@php.net Wed, 19 Sep 2012 22:17:35 
+0200
Parents:   ee172ce3cc65b5cb8ec49020c9579d108aca9ea1
Branches:  PHP-5.4

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

Log:
Bug #63000: MCAST_JOIN_GROUP on OSX is broken

The multicast support in PHP 5.4 makes use of MCAST_JOIN_GROUP if it is present.
The problem is that OSX 10.7 added the constant, but did not correctly implement
the feature. This causes the setsockopt call to fail.

The solution to the problem is to not use MCAST_JOIN_GROUP on OSX.

For reference, this was also done in VLC:

* http://trac.videolan.org/vlc/ticket/6104#comment:19

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

Changed paths:
  M  NEWS
  M  ext/sockets/multicast.h
  A  ext/sockets/tests/bug63000.phpt


Diff:
diff --git a/NEWS b/NEWS
index e769b35..8fb3810 100644
--- a/NEWS
+++ b/NEWS
@@ -247,7 +247,9 @@ PHP 
   NEWS
 
 - Sockets:
   . Fixed bug #62025 (__ss_family was changed on AIX 5.3). (Felipe)
-
+  . Fixed bug #63000 (MCAST_JOIN_GROUP on OSX is broken, merge of PR 185 by
+Igor Wiedler). (Lars)
+
 - SPL:
   . Fixed bug #62433 (Inconsistent behavior of RecursiveDirectoryIterator to
 dot files). (Laruence)
diff --git a/ext/sockets/multicast.h b/ext/sockets/multicast.h
index ccd9b1d..5619c9c 100644
--- a/ext/sockets/multicast.h
+++ b/ext/sockets/multicast.h
@@ -19,11 +19,12 @@
 /* $Id$ */
 
 #if defined(MCAST_JOIN_GROUP)  \
-   (!defined(PHP_WIN32) || (_WIN32_WINNT = 0x600  
SOCKETS_ENABLE_VISTA_API))
+   (!defined(PHP_WIN32) || (_WIN32_WINNT = 0x600  
SOCKETS_ENABLE_VISTA_API))  \
+   !defined(__APPLE__)
 #define RFC3678_API 1
 /* has block/unblock and source membership, in this case for both IPv4 and 
IPv6 */
 #define HAS_MCAST_EXT 1
-#elif defined(IP_ADD_SOURCE_MEMBERSHIP)
+#elif defined(IP_ADD_SOURCE_MEMBERSHIP)  !defined(__APPLE__)
 /* has block/unblock and source membership, but only for IPv4 */
 #define HAS_MCAST_EXT 1
 #endif
diff --git a/ext/sockets/tests/bug63000.phpt b/ext/sockets/tests/bug63000.phpt
new file mode 100644
index 000..c806ba4
--- /dev/null
+++ b/ext/sockets/tests/bug63000.phpt
@@ -0,0 +1,22 @@
+--TEST--
+Bug #63000: Multicast on OSX
+--SKIPIF--
+?php
+if (!extension_loaded('sockets')) {
+die('skip sockets extension not available.');
+}
+if (PHP_OS !== 'Darwin') {
+die('is not OSX.');
+}
+--FILE--
+?php
+$socket = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP);
+socket_bind($socket, '0.0.0.0', 31057);
+
+$so = socket_set_option($socket, IPPROTO_IP, MCAST_JOIN_GROUP, array(
+group = '224.0.0.251',
+interface = 0,
+));
+var_dump($so);
+--EXPECTF--
+bool(true)


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



[PHP-CVS] com php-src: Merging PR #116: ext/spl/tests/RecursiveDirectoryIterator_getSubPath_basic.phpt ext/spl/tests/RecursiveDirectoryIterator_getSubPathname_basic.phpt ext/standard/tests/strings/htt

2012-09-18 Thread Lars Strojny
Commit:ee172ce3cc65b5cb8ec49020c9579d108aca9ea1
Author:Lars Strojny lstro...@php.net Tue, 18 Sep 2012 23:15:03 
+0200
Parents:   aa133ea2821787c0cf4ac8750ddd22341752f135
Branches:  PHP-5.4

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

Log:
Merging PR #116

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

Changed paths:
  A  ext/spl/tests/RecursiveDirectoryIterator_getSubPath_basic.phpt
  A  ext/spl/tests/RecursiveDirectoryIterator_getSubPathname_basic.phpt
  A  ext/standard/tests/strings/http_build_query_error.phpt


Diff:
diff --git a/ext/spl/tests/RecursiveDirectoryIterator_getSubPath_basic.phpt 
b/ext/spl/tests/RecursiveDirectoryIterator_getSubPath_basic.phpt
new file mode 100644
index 000..5107cd3
--- /dev/null
+++ b/ext/spl/tests/RecursiveDirectoryIterator_getSubPath_basic.phpt
@@ -0,0 +1,52 @@
+--TEST--
+RecursiveDirectoryIterator::getBasePath() - basic test
+--CREDITS--
+Pawel Krynicki pawel [dot] krynicki [at] xsolve [dot] pl
+#testfest AmsterdamPHP 2012-06-23
+--FILE--
+?php
+$depth0 = md5('recursiveDirectoryIterator::getSubPath');
+$depth1 = md5('depth1');
+$depth2 = md5('depth2');
+$targetDir = __DIR__ . DIRECTORY_SEPARATOR . $depth0 . DIRECTORY_SEPARATOR . 
$depth1 . DIRECTORY_SEPARATOR . $depth2;
+mkdir($targetDir, 0777, true);
+touch($targetDir . DIRECTORY_SEPARATOR . 'getSubPath_test.tmp');
+$iterator = new RecursiveDirectoryIterator(__DIR__ . DIRECTORY_SEPARATOR . 
$depth0);
+$it = new RecursiveIteratorIterator($iterator);
+
+$list = [];
+while($it-valid()) {
+  $list[] = $it-getSubPath();
+  $it-next();
+}
+asort($list);
+foreach ($list as $item) {
+   echo $item . \n;
+}
+?
+==DONE==
+--CLEAN--
+?php
+function rrmdir($dir) {
+   foreach(glob($dir . '/*') as $file) {
+  if(is_dir($file)) {
+rrmdir($file);
+  } else {
+unlink($file);
+  }
+   }
+
+   rmdir($dir);
+   }
+
+   $targetDir = 
__DIR__.DIRECTORY_SEPARATOR.md5('recursiveDirectoryIterator::getSubPath');
+   rrmdir($targetDir);
+?
+
+--EXPECT--
+a0c967a6c2c34786e4802f59af9356f5
+a0c967a6c2c34786e4802f59af9356f5
+a0c967a6c2c34786e4802f59af9356f5/9925aabb545352472e4d77942627b507
+a0c967a6c2c34786e4802f59af9356f5/9925aabb545352472e4d77942627b507
+a0c967a6c2c34786e4802f59af9356f5/9925aabb545352472e4d77942627b507
+==DONE==
diff --git a/ext/spl/tests/RecursiveDirectoryIterator_getSubPathname_basic.phpt 
b/ext/spl/tests/RecursiveDirectoryIterator_getSubPathname_basic.phpt
new file mode 100644
index 000..4e17ea9
--- /dev/null
+++ b/ext/spl/tests/RecursiveDirectoryIterator_getSubPathname_basic.phpt
@@ -0,0 +1,58 @@
+--TEST--
+RecursiveDirectoryIterator::getBasePathname() - basic test
+--CREDITS--
+Pawel Krynicki pawel [dot] krynicki [at] xsolve [dot] pl
+#testfest AmsterdamPHP 2012-06-23
+--FILE--
+?php
+$depth0 = md5('recursiveDirectoryIterator::getSubPathname');
+$depth1 = md5('depth1');
+$depth2 = md5('depth2');
+$targetDir = __DIR__ . DIRECTORY_SEPARATOR . $depth0 . DIRECTORY_SEPARATOR . 
$depth1 . DIRECTORY_SEPARATOR . $depth2;
+mkdir($targetDir, 0777, true);
+touch($targetDir . DIRECTORY_SEPARATOR . 'getSubPathname_test_2.tmp');
+touch(__DIR__ . DIRECTORY_SEPARATOR . $depth0 . DIRECTORY_SEPARATOR . $depth1 
. DIRECTORY_SEPARATOR . 'getSubPathname_test_3.tmp');
+touch(__DIR__ . DIRECTORY_SEPARATOR . $depth0 . DIRECTORY_SEPARATOR . 
'getSubPathname_test_1.tmp');
+$iterator = new RecursiveDirectoryIterator(__DIR__ . DIRECTORY_SEPARATOR . 
$depth0);
+$it = new RecursiveIteratorIterator($iterator);
+
+$list = [];
+while($it-valid()) {
+  $list[] = $it-getSubPathname();
+  $it-next();
+}
+asort($list);
+foreach ($list as $item) {
+   echo $item . \n;
+}
+?
+==DONE==
+--CLEAN--
+?php
+function rrmdir($dir) {
+   foreach(glob($dir . '/*') as $file) {
+ if(is_dir($file)) {
+   rrmdir($file);
+ } else {
+   unlink($file);
+ }
+   }
+
+   rmdir($dir);
+}
+
+$targetDir = __DIR__ . DIRECTORY_SEPARATOR . 
md5('recursiveDirectoryIterator::getSubPathname');
+rrmdir($targetDir);
+?
+--EXPECT--
+.
+.
+..
+a0c967a6c2c34786e4802f59af9356f5/.
+a0c967a6c2c34786e4802f59af9356f5/..
+a0c967a6c2c34786e4802f59af9356f5/9925aabb545352472e4d77942627b507/.
+a0c967a6c2c34786e4802f59af9356f5/9925aabb545352472e4d77942627b507/..
+a0c967a6c2c34786e4802f59af9356f5/9925aabb545352472e4d77942627b507/getSubPathname_test_2.tmp
+a0c967a6c2c34786e4802f59af9356f5/getSubPathname_test_3.tmp
+getSubPathname_test_1.tmp
+==DONE==
diff --git a/ext/standard/tests/strings/http_build_query_error.phpt 
b/ext/standard/tests/strings/http_build_query_error.phpt
new file mode 100644
index 000..30155e6
--- /dev/null
+++ b/ext/standard/tests/strings/http_build_query_error.phpt
@@ -0,0 +1,13 @@
+--TEST--
+Testing error on null parameter 1 of http_build_query()
+--CREDITS--
+Pawel Krynicki pawel.krynicki [at] xsolve [dot] pl
+#testfest AmsterdamPHP 2012-06-23
+--FILE--
+?php

[PHP-CVS] com php-src: Initializing optional argument description in assert(): ext/standard/assert.c

2012-09-02 Thread Lars Strojny
Commit:89948c7fbe487e5d75f7b02fe0c29238f556f341
Author:Lars Strojny lstro...@php.net Sun, 2 Sep 2012 08:01:18 
+0200
Parents:   f7d51df5c65e47a5ef8a6d81f2e13044dd926492
Branches:  PHP-5.4

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

Log:
Initializing optional argument description in assert()

Changed paths:
  M  ext/standard/assert.c


Diff:
diff --git a/ext/standard/assert.c b/ext/standard/assert.c
index 0ff3f9b..15fbefd 100644
--- a/ext/standard/assert.c
+++ b/ext/standard/assert.c
@@ -143,7 +143,7 @@ PHP_FUNCTION(assert)
zval **assertion;
int val, description_len = 0;
char *myeval = NULL;
-   char *compiled_string_description, *description;
+   char *compiled_string_description, *description = NULL;
 
if (! ASSERTG(active)) {
RETURN_TRUE;


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



[PHP-CVS] com php-src: Initializing optional argument description in assert(): ext/standard/assert.c

2012-09-02 Thread Lars Strojny
Commit:e212de4a4492cd9dce8e45133604aa87083a0a92
Author:Lars Strojny lstro...@php.net Sun, 2 Sep 2012 08:01:18 
+0200
Parents:   4e84f725544153d5b6fff99adc274d11f79b9079
Branches:  master

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

Log:
Initializing optional argument description in assert()

Changed paths:
  M  ext/standard/assert.c


Diff:
diff --git a/ext/standard/assert.c b/ext/standard/assert.c
index 0ff3f9b..15fbefd 100644
--- a/ext/standard/assert.c
+++ b/ext/standard/assert.c
@@ -143,7 +143,7 @@ PHP_FUNCTION(assert)
zval **assertion;
int val, description_len = 0;
char *myeval = NULL;
-   char *compiled_string_description, *description;
+   char *compiled_string_description, *description = NULL;
 
if (! ASSERTG(active)) {
RETURN_TRUE;


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



[PHP-CVS] com php-src: Allow null as a default value for length in mb_substr() and mb_strcut(): NEWS ext/mbstring/mbstring.c ext/mbstring/tests/mb_str_functions_opt-parameter.phpt

2012-09-02 Thread Lars Strojny
Commit:133f610bb18831a6d64061cd6e4e7f7779bf1581
Author:Lars Strojny lstro...@php.net Sun, 2 Sep 2012 14:52:05 
+0200
Parents:   89948c7fbe487e5d75f7b02fe0c29238f556f341
Branches:  PHP-5.4

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

Log:
Allow null as a default value for length in mb_substr() and mb_strcut()

Changed paths:
  M  NEWS
  M  ext/mbstring/mbstring.c
  M  ext/mbstring/tests/mb_str_functions_opt-parameter.phpt


Diff:
diff --git a/NEWS b/NEWS
index 60bb235..836cf97 100644
--- a/NEWS
+++ b/NEWS
@@ -14,6 +14,10 @@ PHP  
  NEWS
   . Bug #62987 (Assigning to ArrayObject[null][something] overrides all 
 undefined variables). (Laruence)
 
+- mbstring:
+  . Allow passing null as a default value to mb_substr() and mb_strcut(). Patch
+by Alexander Moskaliov via GitHub PR #133. (Lars)
+
 ?? ??? 2012, PHP 5.4.7
 
 - Core:
diff --git a/ext/mbstring/mbstring.c b/ext/mbstring/mbstring.c
index 0d2b53a..76654ed 100644
--- a/ext/mbstring/mbstring.c
+++ b/ext/mbstring/mbstring.c
@@ -2715,9 +2715,10 @@ PHP_FUNCTION(mb_substr)
char *str, *encoding;
long from, len;
int mblen, str_len, encoding_len;
+   zval **z_len = NULL;
mbfl_string string, result, *ret;
 
-   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, sl|ls, str, 
str_len, from, len, encoding, encoding_len) == FAILURE) {
+   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, sl|Zs, str, 
str_len, from, z_len, encoding, encoding_len) == FAILURE) {
return;
}
 
@@ -2736,8 +2737,11 @@ PHP_FUNCTION(mb_substr)
string.val = (unsigned char *)str;
string.len = str_len;
 
-   if (argc  3) {
+   if (argc  3 || Z_TYPE_PP(z_len) == IS_NULL) {
len = str_len;
+   } else {
+   convert_to_long_ex(z_len);
+   len = Z_LVAL_PP(z_len);
}
 
/* measures length */
@@ -2788,13 +2792,14 @@ PHP_FUNCTION(mb_strcut)
char *encoding;
long from, len;
int encoding_len;
+   zval **z_len = NULL;
mbfl_string string, result, *ret;
 
mbfl_string_init(string);
string.no_language = MBSTRG(language);
string.no_encoding = MBSTRG(current_internal_encoding)-no_encoding;
 
-   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, sl|ls, (char 
**)string.val, (int **)string.len, from, len, encoding, encoding_len) == 
FAILURE) {
+   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, sl|Zs, (char 
**)string.val, (int **)string.len, from, z_len, encoding, encoding_len) 
== FAILURE) {
return;
}
 
@@ -2806,8 +2811,11 @@ PHP_FUNCTION(mb_strcut)
}
}
 
-   if (argc  3) {
+   if (argc  3 || Z_TYPE_PP(z_len) == IS_NULL) {
len = string.len;
+   } else {
+   convert_to_long_ex(z_len);
+   len = Z_LVAL_PP(z_len);
}
 
/* if from position is negative, count start position from the end
diff --git a/ext/mbstring/tests/mb_str_functions_opt-parameter.phpt 
b/ext/mbstring/tests/mb_str_functions_opt-parameter.phpt
index e4a235d..5fb642f 100644
--- a/ext/mbstring/tests/mb_str_functions_opt-parameter.phpt
+++ b/ext/mbstring/tests/mb_str_functions_opt-parameter.phpt
@@ -28,5 +28,3 @@ baz
 baz
 foo
 ==DONE==
---XFAIL--
-mb functions fail to allow null instead of actual value


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



[PHP-CVS] com php-src: Allow null as a default value for length in mb_substr() and mb_strcut(): ext/mbstring/mbstring.c ext/mbstring/tests/mb_str_functions_opt-parameter.phpt

2012-09-02 Thread Lars Strojny
Commit:352a1956b60059f9792cac840d57b184c7305667
Author:Lars Strojny lstro...@php.net Sun, 2 Sep 2012 14:52:05 
+0200
Parents:   32a97dfae6ad7cec85cf88feb45c3547e7a47176
Branches:  master

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

Log:
Allow null as a default value for length in mb_substr() and mb_strcut()

Changed paths:
  M  ext/mbstring/mbstring.c
  A  ext/mbstring/tests/mb_str_functions_opt-parameter.phpt


Diff:
diff --git a/ext/mbstring/mbstring.c b/ext/mbstring/mbstring.c
index 47f5fa4..0861fa6 100644
--- a/ext/mbstring/mbstring.c
+++ b/ext/mbstring/mbstring.c
@@ -2715,9 +2715,10 @@ PHP_FUNCTION(mb_substr)
char *str, *encoding;
long from, len;
int mblen, str_len, encoding_len;
+   zval **z_len = NULL;
mbfl_string string, result, *ret;
 
-   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, sl|ls, str, 
str_len, from, len, encoding, encoding_len) == FAILURE) {
+   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, sl|Zs, str, 
str_len, from, z_len, encoding, encoding_len) == FAILURE) {
return;
}
 
@@ -2736,8 +2737,11 @@ PHP_FUNCTION(mb_substr)
string.val = (unsigned char *)str;
string.len = str_len;
 
-   if (argc  3) {
+   if (argc  3 || Z_TYPE_PP(z_len) == IS_NULL) {
len = str_len;
+   } else {
+   convert_to_long_ex(z_len);
+   len = Z_LVAL_PP(z_len);
}
 
/* measures length */
@@ -2788,13 +2792,14 @@ PHP_FUNCTION(mb_strcut)
char *encoding;
long from, len;
int encoding_len;
+   zval **z_len = NULL;
mbfl_string string, result, *ret;
 
mbfl_string_init(string);
string.no_language = MBSTRG(language);
string.no_encoding = MBSTRG(current_internal_encoding)-no_encoding;
 
-   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, sl|ls, (char 
**)string.val, (int **)string.len, from, len, encoding, encoding_len) == 
FAILURE) {
+   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, sl|Zs, (char 
**)string.val, (int **)string.len, from, z_len, encoding, encoding_len) 
== FAILURE) {
return;
}
 
@@ -2806,8 +2811,11 @@ PHP_FUNCTION(mb_strcut)
}
}
 
-   if (argc  3) {
+   if (argc  3 || Z_TYPE_PP(z_len) == IS_NULL) {
len = string.len;
+   } else {
+   convert_to_long_ex(z_len);
+   len = Z_LVAL_PP(z_len);
}
 
/* if from position is negative, count start position from the end
diff --git a/ext/mbstring/tests/mb_str_functions_opt-parameter.phpt 
b/ext/mbstring/tests/mb_str_functions_opt-parameter.phpt
new file mode 100644
index 000..5fb642f
--- /dev/null
+++ b/ext/mbstring/tests/mb_str_functions_opt-parameter.phpt
@@ -0,0 +1,30 @@
+--TEST--
+Optional long parameter might be null
+--FILE--
+?php
+echo mb_strpos('abb', 'b', null, 'UTF-8') . \n;
+echo mb_strrpos('abb', 'b', null, 'UTF-8') . \n;
+echo mb_stripos('abb', 'B', null, 'UTF-8') . \n;
+echo mb_strripos('abb', 'B', null, 'UTF-8') . \n;
+echo mb_strstr('foobarbaz', 'ba', null, 'UTF-8') . \n;
+echo mb_strrchr('foobarbaz', 'ba', null, 'UTF-8') . \n;
+echo mb_stristr('foobarbaz', 'BA', null, 'UTF-8') . \n;
+echo mb_strrichr('foobarbaz', 'BA', null, 'UTF-8') . \n;
+echo mb_substr('foobarbaz', 6, null, 'UTF-8') . \n;
+echo mb_strcut('foobarbaz', 6, null, 'UTF-8') . \n;
+echo mb_strimwidth('foobar', 0, 3, null, 'UTF-8') . \n;
+?
+==DONE==
+--EXPECT--
+1
+2
+1
+2
+barbaz
+baz
+barbaz
+baz
+baz
+baz
+foo
+==DONE==


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



[PHP-CVS] com php-src: Bug #49510: Boolean validation fails with FILTER_NULL_ON_FAILURE with empty string or false: NEWS ext/filter/filter_private.h ext/filter/logical_filters.c ext/filter/tests/bug49

2012-09-02 Thread Lars Strojny
Commit:a26390ef0c22be3637795d9b5ab1c445e1d3f847
Author:Lars Strojny lstro...@php.net Sun, 2 Sep 2012 22:10:23 
+0200
Parents:   d371a306a24d15646e37c74ee8a9ab81a91f5e25
Branches:  PHP-5.4

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

Log:
Bug #49510: Boolean validation fails with FILTER_NULL_ON_FAILURE with empty 
string or false

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

Changed paths:
  M  NEWS
  M  ext/filter/filter_private.h
  M  ext/filter/logical_filters.c
  A  ext/filter/tests/bug49510.phpt


Diff:
diff --git a/NEWS b/NEWS
index 836cf97..1dd3e0d 100644
--- a/NEWS
+++ b/NEWS
@@ -18,6 +18,10 @@ PHP  
  NEWS
   . Allow passing null as a default value to mb_substr() and mb_strcut(). Patch
 by Alexander Moskaliov via GitHub PR #133. (Lars)
 
+- Filter extension:
+  . Bug #49510: Boolean validation fails with FILTER_NULL_ON_FAILURE with empty
+string or false. (Lars)
+
 ?? ??? 2012, PHP 5.4.7
 
 - Core:
diff --git a/ext/filter/filter_private.h b/ext/filter/filter_private.h
index daa688b..2ec2f62 100644
--- a/ext/filter/filter_private.h
+++ b/ext/filter/filter_private.h
@@ -99,12 +99,14 @@
}   \
return; \
 
-#define PHP_FILTER_TRIM_DEFAULT(p, len) { \
+#define PHP_FILTER_TRIM_DEFAULT(p, len) PHP_FILTER_TRIM_DEFAULT_EX(p, len, 1);
+
+#define PHP_FILTER_TRIM_DEFAULT_EX(p, len, return_if_empty) { \
while ((len  0)   (*p == ' ' || *p == '\t' || *p == '\r' || *p == 
'\v' || *p == '\n')) { \
p++; \
len--; \
} \
-   if (len  1) { \
+   if (len  1  return_if_empty) { \
RETURN_VALIDATION_FAILED \
} \
while (p[len-1] == ' ' || p[len-1] == '\t' || p[len-1] == '\r' || 
p[len-1] == '\v' || p[len-1] == '\n') { \
diff --git a/ext/filter/logical_filters.c b/ext/filter/logical_filters.c
index 5c3811a..4de6b83 100644
--- a/ext/filter/logical_filters.c
+++ b/ext/filter/logical_filters.c
@@ -235,12 +235,15 @@ void php_filter_boolean(PHP_INPUT_FILTER_PARAM_DECL) /* 
{{{ */
int len = Z_STRLEN_P(value);
int ret;
 
-   PHP_FILTER_TRIM_DEFAULT(str, len);
+   PHP_FILTER_TRIM_DEFAULT_EX(str, len, 0);
 
/* returns true for 1, true, on and yes
 * returns false for 0, false, off, no, and 
 * null otherwise. */
switch (len) {
+   case 0:
+   ret = 0;
+   break;
case 1:
if (*str == '1') {
ret = 1;
@@ -286,7 +289,7 @@ void php_filter_boolean(PHP_INPUT_FILTER_PARAM_DECL) /* {{{ 
*/
ret = -1;
}
 
-   if (ret == -1) {
+   if (ret == -1) {
RETURN_VALIDATION_FAILED
} else {
zval_dtor(value);
diff --git a/ext/filter/tests/bug49510.phpt b/ext/filter/tests/bug49510.phpt
new file mode 100644
index 000..3f365cc
--- /dev/null
+++ b/ext/filter/tests/bug49510.phpt
@@ -0,0 +1,36 @@
+--TEST--
+#49510 boolean validation fails with FILTER_NULL_ON_FAILURE
+--FILE--
+?php
+var_dump(filter_var(false, FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE));
+var_dump(filter_var(0, FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE));
+var_dump(filter_var(0, FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE));
+var_dump(filter_var(off, FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE));
+var_dump(filter_var(, FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE));
+var_dump(filter_var(false, FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE));
+var_dump(filter_var(no, FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE));
+
+var_dump(filter_var(true, FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE));
+var_dump(filter_var(1, FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE));
+var_dump(filter_var(1, FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE));
+var_dump(filter_var(on, FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE));
+var_dump(filter_var(yes, FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE));
+
+var_dump(filter_var(invalid, FILTER_VALIDATE_BOOLEAN, 
FILTER_NULL_ON_FAILURE));
+?
+==DONE==
+--EXPECT--
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+NULL
+==DONE==


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



[PHP-CVS] com php-src: assert() user message: NEWS ext/standard/assert.c ext/standard/tests/assert/assert04.phpt ext/standard/tests/assert/assert_error1.phpt

2012-08-31 Thread Lars Strojny
Commit:167108d73cf7f37efb75bc32cef38ea4602ea229
Author:Lars Strojny lstro...@php.net Fri, 31 Aug 2012 18:55:43 
+0200
Parents:   b5d2c3174fcd3785d827ee310669189e827ca7ec
Branches:  master

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

Log:
assert() user message

Added 2nd, optional, param to assert. When passed in it will be added
to the printed warnings and passed as a 4th param to a callback. PR 150
by Lonny Kapelushnik

Changed paths:
  M  NEWS
  M  ext/standard/assert.c
  M  ext/standard/tests/assert/assert04.phpt
  M  ext/standard/tests/assert/assert_error1.phpt


Diff:
diff --git a/NEWS b/NEWS
index 28b89ba..1ee9779 100644
--- a/NEWS
+++ b/NEWS
@@ -24,6 +24,8 @@ PHP   
 NEWS
 (srgoogleguy, Gustavo)
   . Implemented FR #60738 (Allow 'set_error_handler' to handle NULL).
 (Laruence, Nikita Popov)
+  . Added optional second argument for assert() to specify custom message. 
Patch
+by Lonny Kapelushnik (lo...@lonnylot.com). (Lars)
 
 - cURL:
   . Added support for CURLOPT_FTP_RESPONSE_TIMEOUT, CURLOPT_APPEND, 
diff --git a/ext/standard/assert.c b/ext/standard/assert.c
index a2c50d5..0ff3f9b 100644
--- a/ext/standard/assert.c
+++ b/ext/standard/assert.c
@@ -136,20 +136,20 @@ PHP_MINFO_FUNCTION(assert) /* {{{ */
 }
 /* }}} */
 
-/* {{{ proto int assert(string|bool assertion)
+/* {{{ proto int assert(string|bool assertion[, string description])
Checks if assertion is false */
 PHP_FUNCTION(assert)
 {
zval **assertion;
-   int val;
+   int val, description_len = 0;
char *myeval = NULL;
-   char *compiled_string_description;
+   char *compiled_string_description, *description;
 
if (! ASSERTG(active)) {
RETURN_TRUE;
}
 
-   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, Z, assertion) 
== FAILURE) {
+   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, Z|s, assertion, 
description, description_len) == FAILURE) {
return;
}
 
@@ -167,7 +167,11 @@ PHP_FUNCTION(assert)
compiled_string_description = 
zend_make_compiled_string_description(assert code TSRMLS_CC);
if (zend_eval_stringl(myeval, Z_STRLEN_PP(assertion), retval, 
compiled_string_description TSRMLS_CC) == FAILURE) {
efree(compiled_string_description);
-   php_error_docref(NULL TSRMLS_CC, E_RECOVERABLE_ERROR, 
Failure evaluating code: %s%s, PHP_EOL, myeval);
+   if (description_len == 0) {
+   php_error_docref(NULL TSRMLS_CC, 
E_RECOVERABLE_ERROR, Failure evaluating code: %s%s, PHP_EOL, myeval);
+   } else {
+   php_error_docref(NULL TSRMLS_CC, 
E_RECOVERABLE_ERROR, Failure evaluating code: %s%s:\%s\, PHP_EOL, 
description, myeval);
+   }
if (ASSERTG(bail)) {
zend_bailout();
}
@@ -196,7 +200,7 @@ PHP_FUNCTION(assert)
}
 
if (ASSERTG(callback)) {
-   zval *args[3];
+   zval **args = safe_emalloc(description_len == 0 ? 3 : 4, 
sizeof(zval **), 0);
zval *retval;
int i;
uint lineno = zend_get_executed_lineno(TSRMLS_C);
@@ -214,19 +218,38 @@ PHP_FUNCTION(assert)
ZVAL_FALSE(retval);
 
/* XXX do we want to check for error here? */
-   call_user_function(CG(function_table), NULL, ASSERTG(callback), 
retval, 3, args TSRMLS_CC);
+   if (description_len == 0) {
+   call_user_function(CG(function_table), NULL, 
ASSERTG(callback), retval, 3, args TSRMLS_CC);
+   for (i = 0; i = 2; i++) {
+   zval_ptr_dtor((args[i]));
+   }
+   } else {
+   MAKE_STD_ZVAL(args[3]);
+   ZVAL_STRINGL(args[3], SAFE_STRING(description), 
description_len, 1);
 
-   for (i = 0; i = 2; i++) {
-   zval_ptr_dtor((args[i]));
+   call_user_function(CG(function_table), NULL, 
ASSERTG(callback), retval, 4, args TSRMLS_CC);
+   for (i = 0; i = 3; i++) {
+   zval_ptr_dtor((args[i]));
+   }
}
+
+   efree(args);
zval_ptr_dtor(retval);
}
 
if (ASSERTG(warning)) {
-   if (myeval) {
-   php_error_docref(NULL TSRMLS_CC, E_WARNING, Assertion 
\%s\ failed, myeval);
+   if (description_len == 0) {
+   if (myeval) {
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, 
Assertion \%s\ failed, myeval);
+   } else

[PHP-CVS] com php-src: Tests for the previous assert() with user message: ext/standard/tests/assert/assert_basic6.phpt ext/standard/tests/assert/assert_error2.phpt ext/standard/tests/assert/assert_err

2012-08-31 Thread Lars Strojny
Commit:64c168efc5fad8e9761b23dd02a99f5e5a1b46c2
Author:Lars Strojny lstro...@php.net Fri, 31 Aug 2012 19:01:57 
+0200
Parents:   167108d73cf7f37efb75bc32cef38ea4602ea229
Branches:  master

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

Log:
Tests for the previous assert() with user message

Changed paths:
  A  ext/standard/tests/assert/assert_basic6.phpt
  A  ext/standard/tests/assert/assert_error2.phpt
  A  ext/standard/tests/assert/assert_error3.phpt
  A  ext/standard/tests/assert/assert_error4.phpt


Diff:
diff --git a/ext/standard/tests/assert/assert_basic6.phpt 
b/ext/standard/tests/assert/assert_basic6.phpt
new file mode 100644
index 000..2a73713
--- /dev/null
+++ b/ext/standard/tests/assert/assert_basic6.phpt
@@ -0,0 +1,26 @@
+--TEST--
+assert() - basic - Test that bailout works
+--INI--
+assert.active = 1
+assert.warning = 1
+assert.callback = f1
+assert.quiet_eval = 1
+assert.bail = 0
+--FILE--
+?php
+function f1($message) 
+{
+   echo f1 called\n;
+}
+
+//bail out on error
+var_dump($rao = assert_options(ASSERT_BAIL, 1));
+$sa = 0 != 0;
+var_dump($r2 = assert($sa, 0 is 0));
+echo If this is printed BAIL hasn't worked;
+--EXPECTF--
+int(0)
+f1 called
+
+Warning: assert(): 0 is 0: 0 != 0 failed in %s on line 10
+
diff --git a/ext/standard/tests/assert/assert_error2.phpt 
b/ext/standard/tests/assert/assert_error2.phpt
new file mode 100644
index 000..da7c3d9
--- /dev/null
+++ b/ext/standard/tests/assert/assert_error2.phpt
@@ -0,0 +1,30 @@
+--TEST--
+assert() - basic - Test that bailout works
+--INI--
+assert.active = 1
+assert.warning = 1
+assert.callback = f1
+assert.quiet_eval = 1
+assert.bail = 0
+error_reporting = -1
+display_errors = 1
+--FILE--
+?php
+function f1($script, $line, $message, $user_message) 
+{
+   echo f1 called\n;
+}
+
+//bail out on error
+var_dump($rao = assert_options(ASSERT_BAIL, 1));
+$sa = 0 != 0;
+var_dump($r2 = assert($sa));
+echo If this is printed BAIL hasn't worked;
+--EXPECTF--
+int(0)
+
+Warning: Missing argument 4 for f1() in %s on line 2
+f1 called
+
+Warning: assert(): Assertion 0 != 0 failed in %s on line 10
+
diff --git a/ext/standard/tests/assert/assert_error3.phpt 
b/ext/standard/tests/assert/assert_error3.phpt
new file mode 100644
index 000..54b91ed
--- /dev/null
+++ b/ext/standard/tests/assert/assert_error3.phpt
@@ -0,0 +1,21 @@
+--TEST--
+assert() - basic - Test recoverable error
+--INI--
+assert.active = 1
+assert.warning = 1
+assert.callback = f1
+assert.quiet_eval = 0
+assert.bail = 0
+error_reporting = -1
+display_errors = 1
+--FILE--
+?php
+$sa = 0 $ 0;
+var_dump($r2 = assert($sa));
+--EXPECTF--
+
+Parse error: syntax error, unexpected '$' in %s(3) : assert code on line 1
+
+Catchable fatal error: assert(): Failure evaluating code: 
+0 $ 0 in %s on line 3
+
diff --git a/ext/standard/tests/assert/assert_error4.phpt 
b/ext/standard/tests/assert/assert_error4.phpt
new file mode 100644
index 000..264cc8f
--- /dev/null
+++ b/ext/standard/tests/assert/assert_error4.phpt
@@ -0,0 +1,21 @@
+--TEST--
+assert() - basic - Test recoverable error
+--INI--
+assert.active = 1
+assert.warning = 1
+assert.callback = f1
+assert.quiet_eval = 0
+assert.bail = 0
+error_reporting = -1
+display_errors = 1
+--FILE--
+?php
+$sa = 0 $ 0;
+var_dump($r2 = assert($sa, Describing what was asserted));
+--EXPECTF--
+
+Parse error: syntax error, unexpected '$' in %s(3) : assert code on line 1
+
+Catchable fatal error: assert(): Failure evaluating code: 
+Describing what was asserted:0 $ 0 in %s on line 3
+


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



[PHP-CVS] com php-src: assert() user message: NEWS ext/standard/assert.c ext/standard/tests/assert/assert04.phpt ext/standard/tests/assert/assert_basic6.phpt ext/standard/tests/assert/assert_error1.ph

2012-08-31 Thread Lars Strojny
Commit:e658a91b3d826ea4104b17f3a6123c1e9f3aee86
Author:Lars Strojny lstro...@php.net Fri, 31 Aug 2012 19:04:53 
+0200
Parents:   66fad45724214c21491daa21031ac6e5a59d5e3a
Branches:  PHP-5.4

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

Log:
assert() user message

Added 2nd, optional, param to assert. When passed in it will be added
to the printed warnings and passed as a 4th param to a callback. PR 150
by Lonny Kapelushnik

Changed paths:
  M  NEWS
  M  ext/standard/assert.c
  M  ext/standard/tests/assert/assert04.phpt
  A  ext/standard/tests/assert/assert_basic6.phpt
  M  ext/standard/tests/assert/assert_error1.phpt
  A  ext/standard/tests/assert/assert_error2.phpt
  A  ext/standard/tests/assert/assert_error3.phpt
  A  ext/standard/tests/assert/assert_error4.phpt

diff --git a/NEWS b/NEWS
index 97cb3d0..d88aa18 100644
--- a/NEWS
+++ b/NEWS
@@ -25,6 +25,8 @@ PHP   
 NEWS
 handler). (Lonny Kapelushnik)
   . Fixed bug #40459 (Stat and Dir stream wrapper methods do not call 
 constructor). (Stas)
+  . Added optional second argument for assert() to specify custom message. 
Patch
+by Lonny Kapelushnik (lo...@lonnylot.com). (Lars)
 
 - CURL:
   . Fixed bug #62912 (CURLINFO_PRIMARY_* AND CURLINFO_LOCAL_* not exposed).
diff --git a/ext/standard/assert.c b/ext/standard/assert.c
index a2c50d5..0ff3f9b 100644
--- a/ext/standard/assert.c
+++ b/ext/standard/assert.c
@@ -136,20 +136,20 @@ PHP_MINFO_FUNCTION(assert) /* {{{ */
 }
 /* }}} */
 
-/* {{{ proto int assert(string|bool assertion)
+/* {{{ proto int assert(string|bool assertion[, string description])
Checks if assertion is false */
 PHP_FUNCTION(assert)
 {
zval **assertion;
-   int val;
+   int val, description_len = 0;
char *myeval = NULL;
-   char *compiled_string_description;
+   char *compiled_string_description, *description;
 
if (! ASSERTG(active)) {
RETURN_TRUE;
}
 
-   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, Z, assertion) 
== FAILURE) {
+   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, Z|s, assertion, 
description, description_len) == FAILURE) {
return;
}
 
@@ -167,7 +167,11 @@ PHP_FUNCTION(assert)
compiled_string_description = 
zend_make_compiled_string_description(assert code TSRMLS_CC);
if (zend_eval_stringl(myeval, Z_STRLEN_PP(assertion), retval, 
compiled_string_description TSRMLS_CC) == FAILURE) {
efree(compiled_string_description);
-   php_error_docref(NULL TSRMLS_CC, E_RECOVERABLE_ERROR, 
Failure evaluating code: %s%s, PHP_EOL, myeval);
+   if (description_len == 0) {
+   php_error_docref(NULL TSRMLS_CC, 
E_RECOVERABLE_ERROR, Failure evaluating code: %s%s, PHP_EOL, myeval);
+   } else {
+   php_error_docref(NULL TSRMLS_CC, 
E_RECOVERABLE_ERROR, Failure evaluating code: %s%s:\%s\, PHP_EOL, 
description, myeval);
+   }
if (ASSERTG(bail)) {
zend_bailout();
}
@@ -196,7 +200,7 @@ PHP_FUNCTION(assert)
}
 
if (ASSERTG(callback)) {
-   zval *args[3];
+   zval **args = safe_emalloc(description_len == 0 ? 3 : 4, 
sizeof(zval **), 0);
zval *retval;
int i;
uint lineno = zend_get_executed_lineno(TSRMLS_C);
@@ -214,19 +218,38 @@ PHP_FUNCTION(assert)
ZVAL_FALSE(retval);
 
/* XXX do we want to check for error here? */
-   call_user_function(CG(function_table), NULL, ASSERTG(callback), 
retval, 3, args TSRMLS_CC);
+   if (description_len == 0) {
+   call_user_function(CG(function_table), NULL, 
ASSERTG(callback), retval, 3, args TSRMLS_CC);
+   for (i = 0; i = 2; i++) {
+   zval_ptr_dtor((args[i]));
+   }
+   } else {
+   MAKE_STD_ZVAL(args[3]);
+   ZVAL_STRINGL(args[3], SAFE_STRING(description), 
description_len, 1);
 
-   for (i = 0; i = 2; i++) {
-   zval_ptr_dtor((args[i]));
+   call_user_function(CG(function_table), NULL, 
ASSERTG(callback), retval, 4, args TSRMLS_CC);
+   for (i = 0; i = 3; i++) {
+   zval_ptr_dtor((args[i]));
+   }
}
+
+   efree(args);
zval_ptr_dtor(retval);
}
 
if (ASSERTG(warning)) {
-   if (myeval) {
-   php_error_docref(NULL TSRMLS_CC, E_WARNING, Assertion 
\%s\ failed, myeval);
+   if (description_len

[PHP-CVS] com php-src: Bug #62956: fixing private method signature validation: Zend/tests/bug61761.phpt Zend/tests/bug62956.phpt Zend/zend_compile.c

2012-08-28 Thread Lars Strojny
Commit:6b1073a3a7030d70a684638f098dbf22affb5c63
Author:Lars Strojny lstro...@php.net Tue, 28 Aug 2012 14:06:18 
+0200
Parents:   dd9478e6c871418a7e130e5f6cacc7eaa8d92cf4
Branches:  master

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

Log:
Bug #62956: fixing private method signature validation

In inheritance, if both methods are private, don not enforce the same
signature.

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

Changed paths:
  M  Zend/tests/bug61761.phpt
  A  Zend/tests/bug62956.phpt
  M  Zend/zend_compile.c


Diff:
diff --git a/Zend/tests/bug61761.phpt b/Zend/tests/bug61761.phpt
index 631f566..24c69ae 100755
--- a/Zend/tests/bug61761.phpt
+++ b/Zend/tests/bug61761.phpt
@@ -14,5 +14,6 @@ class B extends A
 }
 
 ?
+==DONE==
 --EXPECTF--
-Strict Standards: Declaration of B::test() should be compatible with 
A::test($a) in %sbug61761.php on line %d
+==DONE==
diff --git a/Zend/tests/bug62956.phpt b/Zend/tests/bug62956.phpt
new file mode 100644
index 000..c8694d5
--- /dev/null
+++ b/Zend/tests/bug62956.phpt
@@ -0,0 +1,20 @@
+--TEST--
+Bug #62956: incompatible signatures for private methods should not cause 
E_STRICT
+--FILE--
+?php
+class Base
+{
+   private function test()
+   {}
+}
+
+class Extension extends Base
+{
+   private function test($arg)
+   {}
+}
+
+?
+==DONE==
+--EXPECT--
+==DONE==
diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c
index 704db10..f7b638f 100644
--- a/Zend/zend_compile.c
+++ b/Zend/zend_compile.c
@@ -2969,6 +2969,11 @@ static zend_bool 
zend_do_perform_implementation_check(const zend_function *fe, c
return 1;
}
 
+   /* If both methods are private do not enforce a signature */
+if ((fe-common.fn_flags  ZEND_ACC_PRIVATE)  (proto-common.fn_flags  
ZEND_ACC_PRIVATE)) {
+   return 1;
+   }
+
/* check number of arguments */
if (proto-common.required_num_args  fe-common.required_num_args
|| proto-common.num_args  fe-common.num_args) {


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



[PHP-CVS] com php-src: Bug #62956: fixing private method signature validation: Zend/tests/bug61761.phpt Zend/tests/bug62956.phpt Zend/zend_compile.c

2012-08-28 Thread Lars Strojny
Commit:f82dd2c77463e01cbcc9912be08f5e45cb1a384c
Author:Lars Strojny lstro...@php.net Tue, 28 Aug 2012 14:06:18 
+0200
Parents:   c11106734d0fbd81ac8332e5a4132d0c6a06
Branches:  PHP-5.4

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

Log:
Bug #62956: fixing private method signature validation

In inheritance, if both methods are private, don not enforce the same
signature.

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

Changed paths:
  M  Zend/tests/bug61761.phpt
  A  Zend/tests/bug62956.phpt
  M  Zend/zend_compile.c


Diff:
diff --git a/Zend/tests/bug61761.phpt b/Zend/tests/bug61761.phpt
index 631f566..24c69ae 100755
--- a/Zend/tests/bug61761.phpt
+++ b/Zend/tests/bug61761.phpt
@@ -14,5 +14,6 @@ class B extends A
 }
 
 ?
+==DONE==
 --EXPECTF--
-Strict Standards: Declaration of B::test() should be compatible with 
A::test($a) in %sbug61761.php on line %d
+==DONE==
diff --git a/Zend/tests/bug62956.phpt b/Zend/tests/bug62956.phpt
new file mode 100644
index 000..c8694d5
--- /dev/null
+++ b/Zend/tests/bug62956.phpt
@@ -0,0 +1,20 @@
+--TEST--
+Bug #62956: incompatible signatures for private methods should not cause 
E_STRICT
+--FILE--
+?php
+class Base
+{
+   private function test()
+   {}
+}
+
+class Extension extends Base
+{
+   private function test($arg)
+   {}
+}
+
+?
+==DONE==
+--EXPECT--
+==DONE==
diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c
index 09383c1..bf458e1 100644
--- a/Zend/zend_compile.c
+++ b/Zend/zend_compile.c
@@ -2935,6 +2935,11 @@ static zend_bool 
zend_do_perform_implementation_check(const zend_function *fe, c
return 1;
}
 
+   /* If both methods are private do not enforce a signature */
+if ((fe-common.fn_flags  ZEND_ACC_PRIVATE)  (proto-common.fn_flags  
ZEND_ACC_PRIVATE)) {
+   return 1;
+   }
+
/* check number of arguments */
if (proto-common.required_num_args  fe-common.required_num_args
|| proto-common.num_args  fe-common.num_args) {


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



[PHP-CVS] com php-src: Merging PR 121 to add support for slow request counting on the PHP-FPM status page: sapi/fpm/fpm/fpm_php_trace.c sapi/fpm/fpm/fpm_process_ctl.c sapi/fpm/fpm/fpm_request.c sapi/f

2012-08-26 Thread Lars Strojny
Commit:e7a714b35ecaf5760b1af7bd97eb2f0c613aa9f3
Author:Lars Strojny lstro...@php.net Sun, 26 Aug 2012 17:02:39 
+0200
Parents:   101fd2d3fde0d963f9658b2fc11ac0e7e27258d9
Branches:  master

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

Log:
Merging PR 121 to add support for slow request counting on the PHP-FPM status 
page

Changed paths:
  M  sapi/fpm/fpm/fpm_php_trace.c
  M  sapi/fpm/fpm/fpm_process_ctl.c
  M  sapi/fpm/fpm/fpm_request.c
  M  sapi/fpm/fpm/fpm_scoreboard.c
  M  sapi/fpm/fpm/fpm_scoreboard.h
  M  sapi/fpm/fpm/fpm_sockets.c
  M  sapi/fpm/fpm/fpm_status.c

diff --git a/sapi/fpm/fpm/fpm_php_trace.c b/sapi/fpm/fpm/fpm_php_trace.c
index cd97aeb..d95d66a 100644
--- a/sapi/fpm/fpm/fpm_php_trace.c
+++ b/sapi/fpm/fpm/fpm_php_trace.c
@@ -26,6 +26,7 @@
 #include fpm_children.h
 #include fpm_worker_pool.h
 #include fpm_process_ctl.h
+#include fpm_scoreboard.h
 
 #include zlog.h
 
@@ -137,6 +138,7 @@ static int fpm_php_trace_dump(struct fpm_child_s *child, 
FILE *slowlog TSRMLS_DC
 void fpm_php_trace(struct fpm_child_s *child) /* {{{ */
 {
TSRMLS_FETCH();
+   fpm_scoreboard_update(0, 0, 0, 0, 0, 0, 1, FPM_SCOREBOARD_ACTION_SET, 
child-wp-scoreboard);
FILE *slowlog;
 
zlog(ZLOG_NOTICE, about to trace %d, (int) child-pid);
diff --git a/sapi/fpm/fpm/fpm_process_ctl.c b/sapi/fpm/fpm/fpm_process_ctl.c
index 7840d17..76ea4d3 100644
--- a/sapi/fpm/fpm/fpm_process_ctl.c
+++ b/sapi/fpm/fpm/fpm_process_ctl.c
@@ -353,7 +353,7 @@ static void fpm_pctl_perform_idle_server_maintenance(struct 
timeval *now) /* {{{
 #endif
}
}
-   fpm_scoreboard_update(idle, active, cur_lq, -1, -1, -1, 
FPM_SCOREBOARD_ACTION_SET, wp-scoreboard);
+   fpm_scoreboard_update(idle, active, cur_lq, -1, -1, -1, 0, 
FPM_SCOREBOARD_ACTION_SET, wp-scoreboard);
 
/* this is specific to PM_STYLE_ONDEMAND */
if (wp-config-pm == PM_STYLE_ONDEMAND) {
@@ -388,7 +388,7 @@ static void fpm_pctl_perform_idle_server_maintenance(struct 
timeval *now) /* {{{
if (idle  wp-config-pm_min_spare_servers) {
if (wp-running_children = 
wp-config-pm_max_children) {
if (!wp-warn_max_children) {
-   fpm_scoreboard_update(0, 0, 0, 0, 0, 1, 
FPM_SCOREBOARD_ACTION_INC, wp-scoreboard);
+   fpm_scoreboard_update(0, 0, 0, 0, 0, 1, 
0, FPM_SCOREBOARD_ACTION_INC, wp-scoreboard);
zlog(ZLOG_WARNING, [pool %s] server 
reached pm.max_children setting (%d), consider raising it, wp-config-name, 
wp-config-pm_max_children);
wp-warn_max_children = 1;
}
@@ -407,7 +407,7 @@ static void fpm_pctl_perform_idle_server_maintenance(struct 
timeval *now) /* {{{
children_to_fork = MIN(children_to_fork, 
wp-config-pm_max_children - wp-running_children);
if (children_to_fork = 0) {
if (!wp-warn_max_children) {
-   fpm_scoreboard_update(0, 0, 0, 0, 0, 1, 
FPM_SCOREBOARD_ACTION_INC, wp-scoreboard);
+   fpm_scoreboard_update(0, 0, 0, 0, 0, 1, 
0, FPM_SCOREBOARD_ACTION_INC, wp-scoreboard);
zlog(ZLOG_WARNING, [pool %s] server 
reached pm.max_children setting (%d), consider raising it, wp-config-name, 
wp-config-pm_max_children);
wp-warn_max_children = 1;
}
@@ -511,7 +511,7 @@ void fpm_pctl_on_socket_accept(struct fpm_event_s *ev, 
short which, void *arg) /
 
if (wp-running_children = wp-config-pm_max_children) {
if (!wp-warn_max_children) {
-   fpm_scoreboard_update(0, 0, 0, 0, 0, 1, 
FPM_SCOREBOARD_ACTION_INC, wp-scoreboard);
+   fpm_scoreboard_update(0, 0, 0, 0, 0, 1, 0, 
FPM_SCOREBOARD_ACTION_INC, wp-scoreboard);
zlog(ZLOG_WARNING, [pool %s] server reached 
max_children setting (%d), consider raising it, wp-config-name, 
wp-config-pm_max_children);
wp-warn_max_children = 1;
}
diff --git a/sapi/fpm/fpm/fpm_request.c b/sapi/fpm/fpm/fpm_request.c
index 28332d0..bf431a0 100644
--- a/sapi/fpm/fpm/fpm_request.c
+++ b/sapi/fpm/fpm/fpm_request.c
@@ -54,7 +54,7 @@ void fpm_request_accepting() /* {{{ */
fpm_scoreboard_proc_release(proc);
 
/* idle++, active-- */
-   fpm_scoreboard_update(1, -1, 0, 0, 0, 0, FPM_SCOREBOARD_ACTION_INC, 
NULL);
+   fpm_scoreboard_update(1, -1, 0, 0, 0, 0, 0, FPM_SCOREBOARD_ACTION_INC, 
NULL);
 }
 /* }}} */
 
@@ -98,7 +98,7 @@ void fpm_request_reading_headers() /* {{{ */
fpm_scoreboard_proc_release(proc

[PHP-CVS] com php-src: Merging PR 121 to add support for slow request counting on the PHP-FPM status page: NEWS sapi/fpm/fpm/fpm_php_trace.c sapi/fpm/fpm/fpm_process_ctl.c sapi/fpm/fpm/fpm_request.c s

2012-08-26 Thread Lars Strojny
Commit:8e7081f3ac10f5b215358f7e245c9da21ea47278
Author:Lars Strojny lstro...@php.net Sun, 26 Aug 2012 17:02:39 
+0200
Parents:   e24194d15755fc574a39df1bc3a572394627f847
Branches:  PHP-5.4

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

Log:
Merging PR 121 to add support for slow request counting on the PHP-FPM status 
page

Changed paths:
  M  NEWS
  M  sapi/fpm/fpm/fpm_php_trace.c
  M  sapi/fpm/fpm/fpm_process_ctl.c
  M  sapi/fpm/fpm/fpm_request.c
  M  sapi/fpm/fpm/fpm_scoreboard.c
  M  sapi/fpm/fpm/fpm_scoreboard.h
  M  sapi/fpm/fpm/fpm_sockets.c
  M  sapi/fpm/fpm/fpm_status.c

diff --git a/NEWS b/NEWS
index b7753d6..f5b5fe0 100644
--- a/NEWS
+++ b/NEWS
@@ -57,6 +57,9 @@ PHP   
 NEWS
   . Fixed bug #62836 (Seg fault or broken object references on unserialize()).
 (Laruence)
 
+- FPM:
+  . Merged PR 121 by minitux to add support for slow request counting on PHP
+FPM status page. (Lars)
 
 16 Aug 2012, PHP 5.4.6
 
diff --git a/sapi/fpm/fpm/fpm_php_trace.c b/sapi/fpm/fpm/fpm_php_trace.c
index cd97aeb..d95d66a 100644
--- a/sapi/fpm/fpm/fpm_php_trace.c
+++ b/sapi/fpm/fpm/fpm_php_trace.c
@@ -26,6 +26,7 @@
 #include fpm_children.h
 #include fpm_worker_pool.h
 #include fpm_process_ctl.h
+#include fpm_scoreboard.h
 
 #include zlog.h
 
@@ -137,6 +138,7 @@ static int fpm_php_trace_dump(struct fpm_child_s *child, 
FILE *slowlog TSRMLS_DC
 void fpm_php_trace(struct fpm_child_s *child) /* {{{ */
 {
TSRMLS_FETCH();
+   fpm_scoreboard_update(0, 0, 0, 0, 0, 0, 1, FPM_SCOREBOARD_ACTION_SET, 
child-wp-scoreboard);
FILE *slowlog;
 
zlog(ZLOG_NOTICE, about to trace %d, (int) child-pid);
diff --git a/sapi/fpm/fpm/fpm_process_ctl.c b/sapi/fpm/fpm/fpm_process_ctl.c
index 7840d17..76ea4d3 100644
--- a/sapi/fpm/fpm/fpm_process_ctl.c
+++ b/sapi/fpm/fpm/fpm_process_ctl.c
@@ -353,7 +353,7 @@ static void fpm_pctl_perform_idle_server_maintenance(struct 
timeval *now) /* {{{
 #endif
}
}
-   fpm_scoreboard_update(idle, active, cur_lq, -1, -1, -1, 
FPM_SCOREBOARD_ACTION_SET, wp-scoreboard);
+   fpm_scoreboard_update(idle, active, cur_lq, -1, -1, -1, 0, 
FPM_SCOREBOARD_ACTION_SET, wp-scoreboard);
 
/* this is specific to PM_STYLE_ONDEMAND */
if (wp-config-pm == PM_STYLE_ONDEMAND) {
@@ -388,7 +388,7 @@ static void fpm_pctl_perform_idle_server_maintenance(struct 
timeval *now) /* {{{
if (idle  wp-config-pm_min_spare_servers) {
if (wp-running_children = 
wp-config-pm_max_children) {
if (!wp-warn_max_children) {
-   fpm_scoreboard_update(0, 0, 0, 0, 0, 1, 
FPM_SCOREBOARD_ACTION_INC, wp-scoreboard);
+   fpm_scoreboard_update(0, 0, 0, 0, 0, 1, 
0, FPM_SCOREBOARD_ACTION_INC, wp-scoreboard);
zlog(ZLOG_WARNING, [pool %s] server 
reached pm.max_children setting (%d), consider raising it, wp-config-name, 
wp-config-pm_max_children);
wp-warn_max_children = 1;
}
@@ -407,7 +407,7 @@ static void fpm_pctl_perform_idle_server_maintenance(struct 
timeval *now) /* {{{
children_to_fork = MIN(children_to_fork, 
wp-config-pm_max_children - wp-running_children);
if (children_to_fork = 0) {
if (!wp-warn_max_children) {
-   fpm_scoreboard_update(0, 0, 0, 0, 0, 1, 
FPM_SCOREBOARD_ACTION_INC, wp-scoreboard);
+   fpm_scoreboard_update(0, 0, 0, 0, 0, 1, 
0, FPM_SCOREBOARD_ACTION_INC, wp-scoreboard);
zlog(ZLOG_WARNING, [pool %s] server 
reached pm.max_children setting (%d), consider raising it, wp-config-name, 
wp-config-pm_max_children);
wp-warn_max_children = 1;
}
@@ -511,7 +511,7 @@ void fpm_pctl_on_socket_accept(struct fpm_event_s *ev, 
short which, void *arg) /
 
if (wp-running_children = wp-config-pm_max_children) {
if (!wp-warn_max_children) {
-   fpm_scoreboard_update(0, 0, 0, 0, 0, 1, 
FPM_SCOREBOARD_ACTION_INC, wp-scoreboard);
+   fpm_scoreboard_update(0, 0, 0, 0, 0, 1, 0, 
FPM_SCOREBOARD_ACTION_INC, wp-scoreboard);
zlog(ZLOG_WARNING, [pool %s] server reached 
max_children setting (%d), consider raising it, wp-config-name, 
wp-config-pm_max_children);
wp-warn_max_children = 1;
}
diff --git a/sapi/fpm/fpm/fpm_request.c b/sapi/fpm/fpm/fpm_request.c
index 28332d0..bf431a0 100644
--- a/sapi/fpm/fpm/fpm_request.c
+++ b/sapi/fpm/fpm/fpm_request.c
@@ -54,7

[PHP-CVS] com php-src: Strong types for the result codes SUCCESS FAILURE. These are common symbol names and using #defines can cause conflicts.: Zend/zend.h

2012-08-26 Thread Lars Strojny
Commit:e3ef84c59bf669a7dfc717af26ed1872bab397c9
Author:Stuart Langley slang...@google.com Tue, 7 Aug 2012 
13:06:13 +1000
Committer: Lars Strojny lstro...@php.net  Sun, 26 Aug 2012 17:15:27 +0200
Parents:   e7a714b35ecaf5760b1af7bd97eb2f0c613aa9f3
Branches:  master

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

Log:
Strong types for the result codes SUCCESS  FAILURE. These are common
symbol names and using #defines can cause conflicts.

Changed paths:
  M  Zend/zend.h


Diff:
diff --git a/Zend/zend.h b/Zend/zend.h
index de2a2e5..2c86f05 100644
--- a/Zend/zend.h
+++ b/Zend/zend.h
@@ -276,10 +276,10 @@ static const char long_min_digits[] = 
9223372036854775808;
 
 #define MAX_LENGTH_OF_DOUBLE 32
 
-#undef SUCCESS
-#undef FAILURE
-#define SUCCESS 0
-#define FAILURE -1 /* this MUST stay a negative 
number, or it may affect functions! */
+typedef enum {
+  SUCCESS =  0,
+  FAILURE = -1,/* this MUST stay a negative number, or it may 
affect functions! */
+} RESULT_CODE;
 
 #include zend_hash.h
 #include zend_ts_hash.h


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



Re: [PHP-CVS] com php-src: Strong types for the result codes SUCCESS FAILURE. These are common symbol names and using #defines can cause conflicts.: Zend/zend.h

2012-08-26 Thread Lars Strojny
Good idea!

Am 26.08.2012 um 19:47 schrieb Stas Malyshev smalys...@sugarcrm.com:

 Hi!
 
 +typedef enum {
 +  SUCCESS =  0,
 +  FAILURE = -1, /* this MUST stay a negative number, or it may 
 affect functions! */
 +} RESULT_CODE;
 
 If you use a type here, I'd suggest using zend_ prefix since otherwise
 you just stomp on another (frequently used) global symbol.
 
 
 -- 
 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



[PHP-CVS] com php-src: Prefix RESULT_CODE enum with ZEND_: Zend/zend.h

2012-08-26 Thread Lars Strojny
Commit:8788cddfb36480cd4f0cb5c3aeec69134764ecfc
Author:Lars Strojny lstro...@php.net Sun, 26 Aug 2012 20:06:47 
+0200
Parents:   3d0857938d86b279e932de0558c3f4877e49bcec
Branches:  master

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

Log:
Prefix RESULT_CODE enum with ZEND_

Changed paths:
  M  Zend/zend.h


Diff:
diff --git a/Zend/zend.h b/Zend/zend.h
index 2c86f05..d2a4ef6 100644
--- a/Zend/zend.h
+++ b/Zend/zend.h
@@ -279,7 +279,7 @@ static const char long_min_digits[] = 9223372036854775808;
 typedef enum {
   SUCCESS =  0,
   FAILURE = -1,/* this MUST stay a negative number, or it may 
affect functions! */
-} RESULT_CODE;
+} ZEND_RESULT_CODE;
 
 #include zend_hash.h
 #include zend_ts_hash.h


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



Re: [PHP-CVS] com php-src: Bug 62462: Prevent multibyte characters from being split between the lines: ext/standard/quot_print.c ext/standard/tests/strings/bug62462.phpt

2012-08-21 Thread Lars Strojny
 
 =D1=8E=D0=BD=D0=B8=D0=BA=D0=BE=D0=B4=D0=B5=D1=81=D1=82=D1=80=D0=BE=
 064- =D0=BA=D0=B0 =D0=B2 
 =D1=8E=D0=BD=D0=B8=D0=BA=D0=BE=D0=B4=D0=B5=D1=81=D1=82=
 065- =D1=80=D0=BE=D0=BA=D0=B0 =D0=B2 
 =D1=8E=D0=BD=D0=B8=D0=BA=D0=BE=D0=B4=D0=B5=
 066- =D1=81=D1=82=D1=80=D0=BE=D0=BA=D0=B0 =D0=B2 
 =D1=8E=D0=BD=D0=B8=D0=BA=D0=BE=
 067- =D0=B4=D0=B5=D1=81=D1=82=D1=80=D0=BE=D0=BA=D0=B0 =D0=B2 
 =D1=8E=D0=BD=D0=B8=
 068- =D0=BA=D0=BE=D0=B4=D0=B5
 069- string(1500) строка в юникодестрока в юникодестрока в
 юникодестрока в юникодестрока в юникодестрока в юникодестрока в
 юникодестрока в юникодестрока в юниодестрока в юникодестрока в
 юникодестрока в юникодестрока в юникодестрока в юникодестрока в
 юникодестрока в юникодестрока в юникодестрока в юникодестрока в
 юникодестрока в юникодестрока в юникодестрока в юникодестрока в
 юникоестрока в юникодестрока в юникодестрока в юникодестрока в
 юникодестрока в юикодестрока в юникодестрока в юникодестрока в
 юникодестрока в юникодестрок в юникодестрока в юникодестрока в
 юникодестрока в юникодестрока в юникодесрока в юникодестрока в
 юникодестрока в юникодестрока в юникодестрока в юникдестрока в
 юникодестрока в юникодестрока в юникодестрока в юникодестрока в
 никодестрока в юникодестрока в юникодестрока в юникоде
 070- string(13) this is a foo
 071- Done
 
 thanks
 
 On Tue, Aug 21, 2012 at 5:47 AM, Lars Strojny lstro...@php.net wrote:
 Commit:18bb426587d62f93c54c40bf8535eb8416603629
 Author:Lars Strojny lstro...@php.net Mon, 20 Aug 2012 23:42:31 
 +0200
 Parents:   ab4f3d93e812b96bf933a1fa7e0ad43671b38c77
 Branches:  master
 
 Link:   
 http://git.php.net/?p=php-src.git;a=commitdiff;h=18bb426587d62f93c54c40bf8535eb8416603629
 
 Log:
 Bug 62462: Prevent multibyte characters from being split between the lines
 
 Merged from https://github.com/php/php-src/pull/120
 
 Bugs:
 https://bugs.php.net/62462
 
 Changed paths:
  M  ext/standard/quot_print.c
  A  ext/standard/tests/strings/bug62462.phpt
 
 
 Diff:
 diff --git a/ext/standard/quot_print.c b/ext/standard/quot_print.c
 index 1ce7eff..4eb69d7 100644
 --- a/ext/standard/quot_print.c
 +++ b/ext/standard/quot_print.c
 @@ -162,7 +162,10 @@ PHPAPI unsigned char *php_quot_print_encode(const 
 unsigned char *str, size_t len
lp = 0;
} else {
if (iscntrl (c) || (c == 0x7f) || (c  0x80) || (c == 
 '=') || ((c == ' ')  (*str == '\015'))) {
 -   if ((lp += 3)  PHP_QPRINT_MAXL) {
 +   if lp+= 3)  PHP_QPRINT_MAXL)  (c = 
 0x7f))
 +|| ((c  0x7f)  (c = 0xdf)  ((lp + 3)  PHP_QPRINT_MAXL))
 +|| ((c  0xdf)  (c = 0xef)  ((lp + 6)  PHP_QPRINT_MAXL))
 +|| ((c  0xef)  (c = 0xf4)  ((lp + 9)  PHP_QPRINT_MAXL))) 
 {
*d++ = '=';
*d++ = '\015';
*d++ = '\012';
 @@ -283,4 +286,4 @@ PHP_FUNCTION(quoted_printable_encode)
  * End:
  * vim600: sw=4 ts=4 fdm=marker
  * vim600: sw=4 ts=4
 - */
 + */
 \ No newline at end of file
 diff --git a/ext/standard/tests/strings/bug62462.phpt 
 b/ext/standard/tests/strings/bug62462.phpt
 new file mode 100644
 index 000..c6eb41a
 --- /dev/null
 +++ b/ext/standard/tests/strings/bug62462.phpt
 @@ -0,0 +1,17 @@
 +--TEST--
 +Multibyte characters shouldn't be split by soft line break added by 
 quoted_printable_encode - 4 byte character test
 +--FILE--
 +?php
 +echo quoted_printable_encode(str_repeat(\xc4\x85, 77));
 +?
 +
 +==DONE==
 +--EXPECT--
 +=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=
 +=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=
 +=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=
 +=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=
 +=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=
 +=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=
 +=C4=85=C4=85=C4=85=C4=85=C4=85
 +==DONE==
 
 
 --
 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



[PHP-CVS] com php-src: Bug 62462: adjusting test: ext/standard/tests/strings/quoted_printable_encode_002.phpt

2012-08-21 Thread Lars Strojny
Commit:aaa2eee4c03ac362ebe9c6f1594776434814b083
Author:Lars Strojny lstro...@php.net Tue, 21 Aug 2012 10:08:46 
+0200
Parents:   c54d73d54c8e2166f680b3db03238d5263a451c1
Branches:  PHP-5.4

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

Log:
Bug 62462: adjusting test

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

Changed paths:
  M  ext/standard/tests/strings/quoted_printable_encode_002.phpt


Diff:
diff --git a/ext/standard/tests/strings/quoted_printable_encode_002.phpt 
b/ext/standard/tests/strings/quoted_printable_encode_002.phpt
index 5380eb0..aaf5608 100644
Binary files a/ext/standard/tests/strings/quoted_printable_encode_002.phpt and 
b/ext/standard/tests/strings/quoted_printable_encode_002.phpt differ


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



[PHP-CVS] com php-src: Bug 62462: adjusting test: ext/standard/tests/strings/quoted_printable_encode_002.phpt

2012-08-21 Thread Lars Strojny
Commit:a45e81d093e830c25aed13480091049c901c38ec
Author:Lars Strojny lstro...@php.net Tue, 21 Aug 2012 10:08:46 
+0200
Parents:   18bb426587d62f93c54c40bf8535eb8416603629
Branches:  master

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

Log:
Bug 62462: adjusting test

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

Changed paths:
  M  ext/standard/tests/strings/quoted_printable_encode_002.phpt


Diff:
diff --git a/ext/standard/tests/strings/quoted_printable_encode_002.phpt 
b/ext/standard/tests/strings/quoted_printable_encode_002.phpt
index 5380eb0..aaf5608 100644
Binary files a/ext/standard/tests/strings/quoted_printable_encode_002.phpt and 
b/ext/standard/tests/strings/quoted_printable_encode_002.phpt differ


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



[PHP-CVS] com php-src: Bug 62462: Prevent multibyte characters from being split between the lines: ext/standard/quot_print.c ext/standard/tests/strings/bug62462.phpt

2012-08-20 Thread Lars Strojny
Commit:c54d73d54c8e2166f680b3db03238d5263a451c1
Author:Lars Strojny lstro...@php.net Mon, 20 Aug 2012 23:42:31 
+0200
Parents:   cc5631eca3e9aac195493a0edb7a730f3bc82a65
Branches:  PHP-5.4

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

Log:
Bug 62462: Prevent multibyte characters from being split between the lines

Merged from https://github.com/php/php-src/pull/120

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

Changed paths:
  M  ext/standard/quot_print.c
  A  ext/standard/tests/strings/bug62462.phpt


Diff:
diff --git a/ext/standard/quot_print.c b/ext/standard/quot_print.c
index 1ce7eff..4eb69d7 100644
--- a/ext/standard/quot_print.c
+++ b/ext/standard/quot_print.c
@@ -162,7 +162,10 @@ PHPAPI unsigned char *php_quot_print_encode(const unsigned 
char *str, size_t len
lp = 0;
} else {
if (iscntrl (c) || (c == 0x7f) || (c  0x80) || (c == 
'=') || ((c == ' ')  (*str == '\015'))) {
-   if ((lp += 3)  PHP_QPRINT_MAXL) {
+   if lp+= 3)  PHP_QPRINT_MAXL)  (c = 
0x7f)) 
+|| ((c  0x7f)  (c = 0xdf)  ((lp + 3)  PHP_QPRINT_MAXL)) 
+|| ((c  0xdf)  (c = 0xef)  ((lp + 6)  PHP_QPRINT_MAXL)) 
+|| ((c  0xef)  (c = 0xf4)  ((lp + 9)  PHP_QPRINT_MAXL))) {
*d++ = '=';
*d++ = '\015';
*d++ = '\012';
@@ -283,4 +286,4 @@ PHP_FUNCTION(quoted_printable_encode)
  * End:
  * vim600: sw=4 ts=4 fdm=marker
  * vim600: sw=4 ts=4
- */
+ */
\ No newline at end of file
diff --git a/ext/standard/tests/strings/bug62462.phpt 
b/ext/standard/tests/strings/bug62462.phpt
new file mode 100644
index 000..c6eb41a
--- /dev/null
+++ b/ext/standard/tests/strings/bug62462.phpt
@@ -0,0 +1,17 @@
+--TEST--
+Multibyte characters shouldn't be split by soft line break added by 
quoted_printable_encode - 4 byte character test
+--FILE--
+?php
+echo quoted_printable_encode(str_repeat(\xc4\x85, 77));
+?
+
+==DONE==
+--EXPECT--
+=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=
+=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=
+=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=
+=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=
+=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=
+=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=
+=C4=85=C4=85=C4=85=C4=85=C4=85
+==DONE==


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



[PHP-CVS] com php-src: Bug 62462: Prevent multibyte characters from being split between the lines: ext/standard/quot_print.c ext/standard/tests/strings/bug62462.phpt

2012-08-20 Thread Lars Strojny
Commit:18bb426587d62f93c54c40bf8535eb8416603629
Author:Lars Strojny lstro...@php.net Mon, 20 Aug 2012 23:42:31 
+0200
Parents:   ab4f3d93e812b96bf933a1fa7e0ad43671b38c77
Branches:  master

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

Log:
Bug 62462: Prevent multibyte characters from being split between the lines

Merged from https://github.com/php/php-src/pull/120

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

Changed paths:
  M  ext/standard/quot_print.c
  A  ext/standard/tests/strings/bug62462.phpt


Diff:
diff --git a/ext/standard/quot_print.c b/ext/standard/quot_print.c
index 1ce7eff..4eb69d7 100644
--- a/ext/standard/quot_print.c
+++ b/ext/standard/quot_print.c
@@ -162,7 +162,10 @@ PHPAPI unsigned char *php_quot_print_encode(const unsigned 
char *str, size_t len
lp = 0;
} else {
if (iscntrl (c) || (c == 0x7f) || (c  0x80) || (c == 
'=') || ((c == ' ')  (*str == '\015'))) {
-   if ((lp += 3)  PHP_QPRINT_MAXL) {
+   if lp+= 3)  PHP_QPRINT_MAXL)  (c = 
0x7f)) 
+|| ((c  0x7f)  (c = 0xdf)  ((lp + 3)  PHP_QPRINT_MAXL)) 
+|| ((c  0xdf)  (c = 0xef)  ((lp + 6)  PHP_QPRINT_MAXL)) 
+|| ((c  0xef)  (c = 0xf4)  ((lp + 9)  PHP_QPRINT_MAXL))) {
*d++ = '=';
*d++ = '\015';
*d++ = '\012';
@@ -283,4 +286,4 @@ PHP_FUNCTION(quoted_printable_encode)
  * End:
  * vim600: sw=4 ts=4 fdm=marker
  * vim600: sw=4 ts=4
- */
+ */
\ No newline at end of file
diff --git a/ext/standard/tests/strings/bug62462.phpt 
b/ext/standard/tests/strings/bug62462.phpt
new file mode 100644
index 000..c6eb41a
--- /dev/null
+++ b/ext/standard/tests/strings/bug62462.phpt
@@ -0,0 +1,17 @@
+--TEST--
+Multibyte characters shouldn't be split by soft line break added by 
quoted_printable_encode - 4 byte character test
+--FILE--
+?php
+echo quoted_printable_encode(str_repeat(\xc4\x85, 77));
+?
+
+==DONE==
+--EXPECT--
+=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=
+=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=
+=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=
+=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=
+=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=
+=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=
+=C4=85=C4=85=C4=85=C4=85=C4=85
+==DONE==


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



[PHP-CVS] svn: /php/php-src/branches/PHP_5_4/ext/mbstring/tests/ mb_str_functions_opt-parameter.phpt

2012-02-01 Thread Lars Strojny
lstrojny Wed, 01 Feb 2012 14:43:52 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=323000

Log:
Test for null behavior with ext/mbstring functions

Changed paths:
A   
php/php-src/branches/PHP_5_4/ext/mbstring/tests/mb_str_functions_opt-parameter.phpt

Added: 
php/php-src/branches/PHP_5_4/ext/mbstring/tests/mb_str_functions_opt-parameter.phpt
===
--- 
php/php-src/branches/PHP_5_4/ext/mbstring/tests/mb_str_functions_opt-parameter.phpt
 (rev 0)
+++ 
php/php-src/branches/PHP_5_4/ext/mbstring/tests/mb_str_functions_opt-parameter.phpt
 2012-02-01 14:43:52 UTC (rev 323000)
@@ -0,0 +1,32 @@
+--TEST--
+Optional long parameter might be null
+--FILE--
+?php
+echo mb_strpos('abb', 'b', null, 'UTF-8') . \n;
+echo mb_strrpos('abb', 'b', null, 'UTF-8') . \n;
+echo mb_stripos('abb', 'B', null, 'UTF-8') . \n;
+echo mb_strripos('abb', 'B', null, 'UTF-8') . \n;
+echo mb_strstr('foobarbaz', 'ba', null, 'UTF-8') . \n;
+echo mb_strrchr('foobarbaz', 'ba', null, 'UTF-8') . \n;
+echo mb_stristr('foobarbaz', 'BA', null, 'UTF-8') . \n;
+echo mb_strrichr('foobarbaz', 'BA', null, 'UTF-8') . \n;
+echo mb_substr('foobarbaz', 6, null, 'UTF-8') . \n;
+echo mb_strcut('foobarbaz', 6, null, 'UTF-8') . \n;
+echo mb_strimwidth('foobar', 0, 3, null, 'UTF-8') . \n;
+?
+==DONE==
+--EXPECT--
+1
+2
+1
+2
+barbaz
+baz
+barbaz
+baz
+baz
+baz
+foo
+==DONE==
+--XFAIL--
+mb functions fail to allow null instead of actual value

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

Re: [PHP-CVS] svn: /php/php-src/branches/PHP_5_4/ ext/spl/tests/CallbackFilterIteratorTest-002.phpt tests/output/ob_start_error_001.phpt

2011-11-17 Thread Lars Strojny
Hi Christopher,

thanks for the hint. On my Mac OS X build it still works. Can somebody else try 
it?

With regards,
Lars

Am 16.11.2011 um 21:12 schrieb Christopher Jones:

 
 
 On 11/13/2011 04:26 PM, Lars Strojny wrote:
 lstrojny Mon, 14 Nov 2011 00:26:37 +
 
 Revision: http://svn.php.net/viewvc?view=revisionrevision=319136
 
 Log:
 Adjusting error messages
 
 Changed paths:
 U   
 php/php-src/branches/PHP_5_4/ext/spl/tests/CallbackFilterIteratorTest-002.phpt
 U   php/php-src/branches/PHP_5_4/tests/output/ob_start_error_001.phpt
 
 
 
 -Warning: ob_start(): no array or string given in %s on line 20
 +Warning: ob_start(): no array, string, closure or functor given in %s on 
 line 20
 
 
 Lars,
 
 This is now failing for me and in CI:
 http://ci.qa.php.net/job/php-src-5.4-matrix-tests/128/architecture=x86,os=bsd-freebsd-8.2/testReport/junit/tests_output_ob_start_error_001/phpt/Test_wrong_number_of_arguments_and_wrong_arg_types_for_ob_start__/
 Can you check it out?
 
 Thanks
 
 Chris
 
 -- 
 Email: christopher.jo...@oracle.com
 Tel:  +1 650 506 8630
 Blog:  http://blogs.oracle.com/opal/


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



Re: [PHP-CVS] svn: /php/php-src/branches/PHP_5_4/ ext/spl/tests/CallbackFilterIteratorTest-002.phpt tests/output/ob_start_error_001.phpt

2011-11-17 Thread Lars Strojny
Hi Ferenc, hi Christopher,

that was it, I’m deeply sorry. Overlook that local change. Will undo the change 
now.

With regards,
Lars

Am 17.11.2011 um 10:15 schrieb Ferenc Kovacs:

 fails here.
 and given the fact that we don't have 'functor' anywhere in the 5.4 branch, I 
 can only think that you have some local uncommited modifications related to 
 that.
 
 On Thu, Nov 17, 2011 at 10:10 AM, Lars Strojny l...@strojny.net wrote:
 Hi Christopher,
 
 thanks for the hint. On my Mac OS X build it still works. Can somebody else 
 try it?
 
 With regards,
 Lars
 
 Am 16.11.2011 um 21:12 schrieb Christopher Jones:
 
 
 
  On 11/13/2011 04:26 PM, Lars Strojny wrote:
  lstrojny Mon, 14 Nov 2011 00:26:37 +
 
  Revision: http://svn.php.net/viewvc?view=revisionrevision=319136
 
  Log:
  Adjusting error messages
 
  Changed paths:
  U   
  php/php-src/branches/PHP_5_4/ext/spl/tests/CallbackFilterIteratorTest-002.phpt
  U   php/php-src/branches/PHP_5_4/tests/output/ob_start_error_001.phpt
 
 
 
  -Warning: ob_start(): no array or string given in %s on line 20
  +Warning: ob_start(): no array, string, closure or functor given in %s on 
  line 20
 
 
  Lars,
 
  This is now failing for me and in CI:
  http://ci.qa.php.net/job/php-src-5.4-matrix-tests/128/architecture=x86,os=bsd-freebsd-8.2/testReport/junit/tests_output_ob_start_error_001/phpt/Test_wrong_number_of_arguments_and_wrong_arg_types_for_ob_start__/
  Can you check it out?
 
  Thanks
 
  Chris
 
  --
  Email: christopher.jo...@oracle.com
  Tel:  +1 650 506 8630
  Blog:  http://blogs.oracle.com/opal/
 
 
 --
 PHP CVS Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 
 
 -- 
 Ferenc Kovács
 @Tyr43l - http://tyrael.hu


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



[PHP-CVS] svn: /php/php-src/branches/PHP_5_4/tests/output/ ob_start_error_001.phpt

2011-11-17 Thread Lars Strojny
lstrojny Thu, 17 Nov 2011 09:24:15 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=319392

Log:
Reverting r319136

Changed paths:
U   php/php-src/branches/PHP_5_4/tests/output/ob_start_error_001.phpt

Modified: php/php-src/branches/PHP_5_4/tests/output/ob_start_error_001.phpt
===
--- php/php-src/branches/PHP_5_4/tests/output/ob_start_error_001.phpt   
2011-11-17 08:47:52 UTC (rev 319391)
+++ php/php-src/branches/PHP_5_4/tests/output/ob_start_error_001.phpt   
2011-11-17 09:24:15 UTC (rev 319392)
@@ -37,7 +37,7 @@

 - Arg 1 wrong type

-Warning: ob_start(): no array, string, closure or functor given in %s on line 
20
+Warning: ob_start(): no array or string given in %s on line 20

 Notice: ob_start(): failed to create buffer in %s on line 20
 bool(false)

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

[PHP-CVS] svn: /php/php-src/branches/PHP_5_4/ ext/spl/tests/CallbackFilterIteratorTest-002.phpt tests/output/ob_start_error_001.phpt

2011-11-13 Thread Lars Strojny
lstrojny Mon, 14 Nov 2011 00:26:37 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=319136

Log:
Adjusting error messages

Changed paths:
U   
php/php-src/branches/PHP_5_4/ext/spl/tests/CallbackFilterIteratorTest-002.phpt
U   php/php-src/branches/PHP_5_4/tests/output/ob_start_error_001.phpt

Modified: 
php/php-src/branches/PHP_5_4/ext/spl/tests/CallbackFilterIteratorTest-002.phpt
===
--- 
php/php-src/branches/PHP_5_4/ext/spl/tests/CallbackFilterIteratorTest-002.phpt  
2011-11-14 00:10:09 UTC (rev 319135)
+++ 
php/php-src/branches/PHP_5_4/ext/spl/tests/CallbackFilterIteratorTest-002.phpt  
2011-11-14 00:26:37 UTC (rev 319136)
@@ -45,6 +45,6 @@
 CallbackFilterIterator::__construct() expects exactly 2 parameters, 0 given
 Argument 1 passed to CallbackFilterIterator::__construct() must implement 
interface Iterator, null given
 CallbackFilterIterator::__construct() expects exactly 2 parameters, 1 given
-CallbackFilterIterator::__construct() expects parameter 2 to be a valid 
callback, no array or string given
+CallbackFilterIterator::__construct() expects parameter 2 to be a valid 
callback, no array, string, closure or functor given
 CallbackFilterIterator::__construct() expects parameter 2 to be a valid 
callback, array must have exactly two members
 some message

Modified: php/php-src/branches/PHP_5_4/tests/output/ob_start_error_001.phpt
===
--- php/php-src/branches/PHP_5_4/tests/output/ob_start_error_001.phpt   
2011-11-14 00:10:09 UTC (rev 319135)
+++ php/php-src/branches/PHP_5_4/tests/output/ob_start_error_001.phpt   
2011-11-14 00:26:37 UTC (rev 319136)
@@ -37,7 +37,7 @@

 - Arg 1 wrong type

-Warning: ob_start(): no array or string given in %s on line 20
+Warning: ob_start(): no array, string, closure or functor given in %s on line 
20

 Notice: ob_start(): failed to create buffer in %s on line 20
 bool(false)

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

[PHP-CVS] cvs: php-src /ext/standard/tests/streams stream_resolve_include_path.phpt

2008-12-20 Thread Lars Strojny
lstrojnySat Dec 20 16:23:38 2008 UTC

  Added files: 
/php-src/ext/standard/tests/streams 
stream_resolve_include_path.phpt 
  Log:
  Adding test for stream_resolve_include_path()
  
  

http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/streams/stream_resolve_include_path.phpt?view=markuprev=1.1
Index: php-src/ext/standard/tests/streams/stream_resolve_include_path.phpt
+++ php-src/ext/standard/tests/streams/stream_resolve_include_path.phpt
--TEST--
stream_resolve_include_path(string path[, stream context])
--FILE--
?php
$include_path = __DIR__ . '/test_path';
$include_path_nested = $include_path . '/nested';

$include_path_file = $include_path . DIRECTORY_SEPARATOR . 'file';
$include_path_nested_file = $include_path_nested . DIRECTORY_SEPARATOR . 'file';

mkdir($include_path);
mkdir($include_path_nested);

file_put_contents($include_path_file, 'include_path');
file_put_contents($include_path_nested_file, 'include_path');

var_dump(stream_resolve_include_path());

set_include_path($include_path . PATH_SEPARATOR . $include_path_nested);
var_dump(stream_resolve_include_path('file-does-not-exist'));

set_include_path($include_path . PATH_SEPARATOR . $include_path_nested);
var_dump(stream_resolve_include_path('file'));
set_include_path($include_path_nested . PATH_SEPARATOR . $include_path);
var_dump(stream_resolve_include_path('file'));

unlink($include_path_nested_file);
rmdir($include_path_nested);
unlink($include_path_file);
rmdir($include_path);
--EXPECTF--
Warning: stream_resolve_include_path() expects at least 1 parameter, 0 given in 
%s on line %d
NULL
bool(false)
%unicode|string%(%d) %s/test_path/file
%unicode|string%(%d) %s/test_path/nested/file



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



[PHP-CVS] cvs: php-src(PHP_5_3) /ext/standard/tests/file stream_001.phpt /main/streams streams.c

2008-12-14 Thread Lars Strojny
lstrojnySun Dec 14 16:25:38 2008 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/main/streams   streams.c 
/php-src/ext/standard/tests/filestream_001.phpt 
  Log:
  If a wrapper could not be found it is either a typo or a configuration issue. 
But in both cases it is critical enough to warn the user.
  
  
http://cvs.php.net/viewvc.cgi/php-src/main/streams/streams.c?r1=1.82.2.6.2.18.2.20r2=1.82.2.6.2.18.2.21diff_format=u
Index: php-src/main/streams/streams.c
diff -u php-src/main/streams/streams.c:1.82.2.6.2.18.2.20 
php-src/main/streams/streams.c:1.82.2.6.2.18.2.21
--- php-src/main/streams/streams.c:1.82.2.6.2.18.2.20   Mon Nov 24 15:36:47 2008
+++ php-src/main/streams/streams.c  Sun Dec 14 16:25:37 2008
@@ -19,7 +19,7 @@
+--+
  */
 
-/* $Id: streams.c,v 1.82.2.6.2.18.2.20 2008/11/24 15:36:47 dsp Exp $ */
+/* $Id: streams.c,v 1.82.2.6.2.18.2.21 2008/12/14 16:25:37 lstrojny Exp $ */
 
 #define _GNU_SOURCE
 #include php.h
@@ -1548,8 +1548,8 @@
n = sizeof(wrapper_name) - 1;
}
PHP_STRLCPY(wrapper_name, protocol, 
sizeof(wrapper_name), n);
-   
-   php_error_docref(NULL TSRMLS_CC, E_NOTICE, 
Unable to find the wrapper \%s\ - did you forget to enable it when you 
configured PHP?, wrapper_name);
+
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, 
Unable to find the wrapper \%s\ - did you forget to enable it when you 
configured PHP?, wrapper_name);
 
wrapperpp = NULL;
protocol = NULL;
@@ -1597,15 +1597,15 @@
if (options  STREAM_LOCATE_WRAPPERS_ONLY) {
return NULL;
}
-   
+
if (FG(stream_wrappers)) {
-   /* The file:// wrapper may have been 
disabled/overridden */
+   /* The file:// wrapper may have been disabled/overridden */
 
if (wrapperpp) {
/* It was found so go ahead and provide it */
return *wrapperpp;
}
-   
+
/* Check again, the original check might have not known 
the protocol name */
if (zend_hash_find(wrapper_hash, file, 
sizeof(file), (void**)wrapperpp) == SUCCESS) {
return *wrapperpp;
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/file/stream_001.phpt?r1=1.1.2.3.2.1r2=1.1.2.3.2.2diff_format=u
Index: php-src/ext/standard/tests/file/stream_001.phpt
diff -u php-src/ext/standard/tests/file/stream_001.phpt:1.1.2.3.2.1 
php-src/ext/standard/tests/file/stream_001.phpt:1.1.2.3.2.2
--- php-src/ext/standard/tests/file/stream_001.phpt:1.1.2.3.2.1 Tue Nov  6 
11:02:36 2007
+++ php-src/ext/standard/tests/file/stream_001.phpt Sun Dec 14 16:25:37 2008
@@ -13,7 +13,7 @@
 --EXPECTF--
 bool(true)
 
-Notice: fopen(): Unable to find the wrapper file - did you forget to enable 
it when you configured PHP? in %s on line %d
+Warning: fopen(): Unable to find the wrapper file - did you forget to enable 
it when you configured PHP? in %s on line %d
 
 Warning: fopen(): file:// wrapper is disabled in the server configuration in 
%s on line %d
 



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



[PHP-CVS] cvs: php-src /ext/standard/tests/file stream_001.phpt /main/streams streams.c

2008-12-14 Thread Lars Strojny
lstrojnySun Dec 14 16:27:31 2008 UTC

  Modified files:  
/php-src/main/streams   streams.c 
/php-src/ext/standard/tests/filestream_001.phpt 
  Log:
  MFB: If a wrapper could not be found it is either a typo or a configuration 
issue. But in both cases it is critical enough to warn the user. [DOC] (?)
  
  
http://cvs.php.net/viewvc.cgi/php-src/main/streams/streams.c?r1=1.175r2=1.176diff_format=u
Index: php-src/main/streams/streams.c
diff -u php-src/main/streams/streams.c:1.175 
php-src/main/streams/streams.c:1.176
--- php-src/main/streams/streams.c:1.175Mon Nov 24 15:35:03 2008
+++ php-src/main/streams/streams.c  Sun Dec 14 16:27:30 2008
@@ -19,7 +19,7 @@
+--+
  */
 
-/* $Id: streams.c,v 1.175 2008/11/24 15:35:03 dsp Exp $ */
+/* $Id: streams.c,v 1.176 2008/12/14 16:27:30 lstrojny Exp $ */
 
 #define _GNU_SOURCE
 #include php.h
@@ -2104,8 +2104,8 @@
n = sizeof(wrapper_name) - 1;
}
PHP_STRLCPY(wrapper_name, protocol, 
sizeof(wrapper_name), n);
-   
-   php_error_docref(NULL TSRMLS_CC, E_NOTICE, 
Unable to find the wrapper \%s\ - did you forget to enable it when you 
configured PHP?, wrapper_name);
+
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, 
Unable to find the wrapper \%s\ - did you forget to enable it when you 
configured PHP?, wrapper_name);
 
wrapperpp = NULL;
protocol = NULL;
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/file/stream_001.phpt?r1=1.3r2=1.4diff_format=u
Index: php-src/ext/standard/tests/file/stream_001.phpt
diff -u php-src/ext/standard/tests/file/stream_001.phpt:1.3 
php-src/ext/standard/tests/file/stream_001.phpt:1.4
--- php-src/ext/standard/tests/file/stream_001.phpt:1.3 Tue May 27 09:34:54 2008
+++ php-src/ext/standard/tests/file/stream_001.phpt Sun Dec 14 16:27:30 2008
@@ -13,7 +13,7 @@
 --EXPECTF--
 bool(true)
 
-Notice: fopen(): Unable to find the wrapper file - did you forget to enable 
it when you configured PHP? in %s on line %d
+Warning: fopen(): Unable to find the wrapper file - did you forget to enable 
it when you configured PHP? in %s on line %d
 
 Warning: fopen(): Plainfiles wrapper disabled in %s on line %d
 



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



[PHP-CVS] cvs: php-src(PHP_5_3) /ext/standard file.c

2008-12-13 Thread Lars Strojny
lstrojnySat Dec 13 15:06:20 2008 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/standard   file.c 
  Log:
  One len variable is enough here, we can reuse it
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/file.c?r1=1.409.2.6.2.28.2.26r2=1.409.2.6.2.28.2.27diff_format=u
Index: php-src/ext/standard/file.c
diff -u php-src/ext/standard/file.c:1.409.2.6.2.28.2.26 
php-src/ext/standard/file.c:1.409.2.6.2.28.2.27
--- php-src/ext/standard/file.c:1.409.2.6.2.28.2.26 Fri Dec 12 12:44:48 2008
+++ php-src/ext/standard/file.c Sat Dec 13 15:06:20 2008
@@ -21,7 +21,7 @@
+--+
 */
 
-/* $Id: file.c,v 1.409.2.6.2.28.2.26 2008/12/12 12:44:48 bjori Exp $ */
+/* $Id: file.c,v 1.409.2.6.2.28.2.27 2008/12/13 15:06:20 lstrojny Exp $ */
 
 /* Synced with php 3.0 revision 1.218 1999-06-16 [ssb] */
 
@@ -521,7 +521,7 @@
char *contents;
zend_bool use_include_path = 0;
php_stream *stream;
-   int len, newlen;
+   int len;
long offset = -1;
long maxlen = PHP_STREAM_COPY_ALL;
zval *zcontext = NULL;
@@ -556,8 +556,7 @@
if ((len = php_stream_copy_to_mem(stream, contents, maxlen, 0))  0) {
 
if (PG(magic_quotes_runtime)) {
-   contents = php_addslashes(contents, len, newlen, 1 
TSRMLS_CC); /* 1 = free source string */
-   len = newlen;
+   contents = php_addslashes(contents, len, len, 1 
TSRMLS_CC); /* 1 = free source string */
}
 
RETVAL_STRINGL(contents, len, 0);



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



[PHP-CVS] cvs: php-src(PHP_5_3) /main php_streams.h

2008-12-13 Thread Lars Strojny
lstrojnySat Dec 13 15:06:53 2008 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/main   php_streams.h 
  Log:
  Cleanup: remove trailing whitespaces
  
  
http://cvs.php.net/viewvc.cgi/php-src/main/php_streams.h?r1=1.103.2.1.2.4.2.6r2=1.103.2.1.2.4.2.7diff_format=u
Index: php-src/main/php_streams.h
diff -u php-src/main/php_streams.h:1.103.2.1.2.4.2.6 
php-src/main/php_streams.h:1.103.2.1.2.4.2.7
--- php-src/main/php_streams.h:1.103.2.1.2.4.2.6Wed Jul 23 11:25:14 2008
+++ php-src/main/php_streams.h  Sat Dec 13 15:06:53 2008
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_streams.h,v 1.103.2.1.2.4.2.6 2008/07/23 11:25:14 tony2001 Exp $ */
+/* $Id: php_streams.h,v 1.103.2.1.2.4.2.7 2008/12/13 15:06:53 lstrojny Exp $ */
 
 #ifndef PHP_STREAMS_H
 #define PHP_STREAMS_H
@@ -38,11 +38,11 @@
 #if ZEND_DEBUG
 /* these have more of a dependency on the definitions of the zend macros than
  * I would prefer, but doing it this way saves loads of idefs :-/ */
-# define STREAMS_D int __php_stream_call_depth 
ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC 
-# define STREAMS_C 0 ZEND_FILE_LINE_CC 
ZEND_FILE_LINE_EMPTY_CC 
+# define STREAMS_D int __php_stream_call_depth 
ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC
+# define STREAMS_C 0 ZEND_FILE_LINE_CC 
ZEND_FILE_LINE_EMPTY_CC
 # define STREAMS_REL_C __php_stream_call_depth + 1 ZEND_FILE_LINE_CC, \
__php_stream_call_depth ? __zend_orig_filename : __zend_filename, \
-   __php_stream_call_depth ? __zend_orig_lineno : __zend_lineno 
+   __php_stream_call_depth ? __zend_orig_lineno : __zend_lineno
 
 # define STREAMS_DC, STREAMS_D
 # define STREAMS_CC, STREAMS_C
@@ -62,33 +62,33 @@
 #define php_stream_alloc_rel(ops, thisptr, persistent, mode) 
_php_stream_alloc((ops), (thisptr), (persistent), (mode) STREAMS_REL_CC 
TSRMLS_CC)
 
 #define php_stream_copy_to_mem_rel(src, buf, maxlen, persistent) 
_php_stream_copy_to_mem((src), (buf), (maxlen), (persistent) STREAMS_REL_CC 
TSRMLS_CC)
-   
+
 #define php_stream_fopen_rel(filename, mode, opened, options) 
_php_stream_fopen((filename), (mode), (opened), (options) STREAMS_REL_CC 
TSRMLS_CC)
 
 #define php_stream_fopen_with_path_rel(filename, mode, path, opened, options) 
_php_stream_fopen_with_path((filename), (mode), (path), (opened), (options) 
STREAMS_REL_CC TSRMLS_CC)
 
 #define php_stream_fopen_from_fd_rel(fd, mode, persistent_id)   
_php_stream_fopen_from_fd((fd), (mode), (persistent_id) STREAMS_REL_CC 
TSRMLS_CC)
 #define php_stream_fopen_from_file_rel(file, mode)  
_php_stream_fopen_from_file((file), (mode) STREAMS_REL_CC TSRMLS_CC)
-   
+
 #define php_stream_fopen_from_pipe_rel(file, mode)  
_php_stream_fopen_from_pipe((file), (mode) STREAMS_REL_CC TSRMLS_CC)
-   
+
 #define php_stream_fopen_tmpfile_rel() _php_stream_fopen_tmpfile(0 
STREAMS_REL_CC TSRMLS_CC)
 
 #define php_stream_fopen_temporary_file_rel(dir, pfx, opened_path) 
_php_stream_fopen_temporary_file((dir), (pfx), (opened_path) STREAMS_REL_CC 
TSRMLS_CC)
-   
+
 #define php_stream_open_wrapper_rel(path, mode, options, opened) 
_php_stream_open_wrapper_ex((path), (mode), (options), (opened), NULL 
STREAMS_REL_CC TSRMLS_CC)
 #define php_stream_open_wrapper_ex_rel(path, mode, options, opened, context) 
_php_stream_open_wrapper_ex((path), (mode), (options), (opened), (context) 
STREAMS_REL_CC TSRMLS_CC)
 
 #define php_stream_make_seekable_rel(origstream, newstream, flags) 
_php_stream_make_seekable((origstream), (newstream), (flags) STREAMS_REL_CC 
TSRMLS_CC)
 
 /* }}} */
-   
+
 /* The contents of the php_stream_ops and php_stream should only be accessed
  * using the functions/macros in this header.
  * If you need to get at something that doesn't have an API,
  * drop me a line w...@thebrainroom.com and we can sort out a way to do
  * it properly.
- * 
+ *
  * The only exceptions to this rule are that stream implementations can use
  * the php_stream-abstract pointer to hold their context, and streams
  * opened via stream_open_wrappers can use the zval ptr in
@@ -119,9 +119,9 @@
size_t (*read)(php_stream *stream, char *buf, size_t count TSRMLS_DC);
int(*close)(php_stream *stream, int close_handle TSRMLS_DC);
int(*flush)(php_stream *stream TSRMLS_DC);
-   
+
const char *label; /* label for this ops structure */
-   
+
/* these are optional */
int (*seek)(php_stream *stream, off_t offset, int whence, off_t 
*newoffset TSRMLS_DC);
int (*cast)(php_stream *stream, int castas, void **ret TSRMLS_DC);
@@ -142,7 +142,7 @@
/* open a directory stream */
php_stream *(*dir_opener)(php_stream_wrapper *wrapper, char *filename, 
char *mode,
int options, char **opened_path, php_stream_context 
*context 

[PHP-CVS] cvs: php-src /main php_streams.h

2008-12-13 Thread Lars Strojny
lstrojnySat Dec 13 15:07:20 2008 UTC

  Modified files:  
/php-src/main   php_streams.h 
  Log:
  MFB: Remove trailing whitespaces
  
  
http://cvs.php.net/viewvc.cgi/php-src/main/php_streams.h?r1=1.137r2=1.138diff_format=u
Index: php-src/main/php_streams.h
diff -u php-src/main/php_streams.h:1.137 php-src/main/php_streams.h:1.138
--- php-src/main/php_streams.h:1.137Wed Jul 23 11:24:35 2008
+++ php-src/main/php_streams.h  Sat Dec 13 15:07:20 2008
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_streams.h,v 1.137 2008/07/23 11:24:35 tony2001 Exp $ */
+/* $Id: php_streams.h,v 1.138 2008/12/13 15:07:20 lstrojny Exp $ */
 
 #ifndef PHP_STREAMS_H
 #define PHP_STREAMS_H
@@ -40,11 +40,11 @@
 #if ZEND_DEBUG
 /* these have more of a dependency on the definitions of the zend macros than
  * I would prefer, but doing it this way saves loads of idefs :-/ */
-# define STREAMS_D int __php_stream_call_depth 
ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC 
-# define STREAMS_C 0 ZEND_FILE_LINE_CC 
ZEND_FILE_LINE_EMPTY_CC 
+# define STREAMS_D int __php_stream_call_depth 
ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC
+# define STREAMS_C 0 ZEND_FILE_LINE_CC 
ZEND_FILE_LINE_EMPTY_CC
 # define STREAMS_REL_C __php_stream_call_depth + 1 ZEND_FILE_LINE_CC, \
__php_stream_call_depth ? __zend_orig_filename : __zend_filename, \
-   __php_stream_call_depth ? __zend_orig_lineno : __zend_lineno 
+   __php_stream_call_depth ? __zend_orig_lineno : __zend_lineno
 
 # define STREAMS_DC, STREAMS_D
 # define STREAMS_CC, STREAMS_C
@@ -64,33 +64,33 @@
 #define php_stream_alloc_rel(ops, thisptr, persistent, mode) 
_php_stream_alloc((ops), (thisptr), (persistent), (mode) STREAMS_REL_CC 
TSRMLS_CC)
 
 #define php_stream_copy_to_mem_rel(src, buf, maxlen, persistent) 
_php_stream_copy_to_mem((src), (buf), (maxlen), (persistent) STREAMS_REL_CC 
TSRMLS_CC)
-   
+
 #define php_stream_fopen_rel(filename, mode, opened, options) 
_php_stream_fopen((filename), (mode), (opened), (options) STREAMS_REL_CC 
TSRMLS_CC)
 
 #define php_stream_fopen_with_path_rel(filename, mode, path, opened, options) 
_php_stream_fopen_with_path((filename), (mode), (path), (opened), (options) 
STREAMS_REL_CC TSRMLS_CC)
 
 #define php_stream_fopen_from_fd_rel(fd, mode, persistent_id)   
_php_stream_fopen_from_fd((fd), (mode), (persistent_id) STREAMS_REL_CC 
TSRMLS_CC)
 #define php_stream_fopen_from_file_rel(file, mode)  
_php_stream_fopen_from_file((file), (mode) STREAMS_REL_CC TSRMLS_CC)
-   
+
 #define php_stream_fopen_from_pipe_rel(file, mode)  
_php_stream_fopen_from_pipe((file), (mode) STREAMS_REL_CC TSRMLS_CC)
-   
+
 #define php_stream_fopen_tmpfile_rel() _php_stream_fopen_tmpfile(0 
STREAMS_REL_CC TSRMLS_CC)
 
 #define php_stream_fopen_temporary_file_rel(dir, pfx, opened_path) 
_php_stream_fopen_temporary_file((dir), (pfx), (opened_path) STREAMS_REL_CC 
TSRMLS_CC)
-   
+
 #define php_stream_open_wrapper_rel(path, mode, options, opened) 
_php_stream_open_wrapper_ex((path), (mode), (options), (opened), NULL 
STREAMS_REL_CC TSRMLS_CC)
 #define php_stream_open_wrapper_ex_rel(path, mode, options, opened, context) 
_php_stream_open_wrapper_ex((path), (mode), (options), (opened), (context) 
STREAMS_REL_CC TSRMLS_CC)
 
 #define php_stream_make_seekable_rel(origstream, newstream, flags) 
_php_stream_make_seekable((origstream), (newstream), (flags) STREAMS_REL_CC 
TSRMLS_CC)
 
 /* }}} */
-   
+
 /* The contents of the php_stream_ops and php_stream should only be accessed
  * using the functions/macros in this header.
  * If you need to get at something that doesn't have an API,
  * drop me a line w...@thebrainroom.com and we can sort out a way to do
  * it properly.
- * 
+ *
  * The only exceptions to this rule are that stream implementations can use
  * the php_stream-abstract pointer to hold their context, and streams
  * opened via stream_open_wrappers can use the zval ptr in
@@ -121,9 +121,9 @@
size_t (*read)(php_stream *stream, char *buf, size_t count TSRMLS_DC);
int(*close)(php_stream *stream, int close_handle TSRMLS_DC);
int(*flush)(php_stream *stream TSRMLS_DC);
-   
+
const char *label; /* label for this ops structure */
-   
+
/* these are optional */
int (*seek)(php_stream *stream, off_t offset, int whence, off_t 
*newoffset TSRMLS_DC);
int (*cast)(php_stream *stream, int castas, void **ret TSRMLS_DC);
@@ -144,7 +144,7 @@
/* open a directory stream */
php_stream *(*dir_opener)(php_stream_wrapper *wrapper, char *filename, 
char *mode,
int options, char **opened_path, php_stream_context 
*context STREAMS_DC TSRMLS_DC);
-   
+
const char *label;
 
/* delete a file */
@@ -188,14 +188,14 @@
 

[PHP-CVS] cvs: php-src(PHP_5_3) / run-tests.php

2008-12-10 Thread Lars Strojny
lstrojnyThu Dec 11 02:37:37 2008 UTC

  Modified files:  (Branch: PHP_5_3)
/php-srcrun-tests.php 
  Log:
  Fixing strict warning when null is passed
  
  
http://cvs.php.net/viewvc.cgi/php-src/run-tests.php?r1=1.226.2.37.2.35.2.55r2=1.226.2.37.2.35.2.56diff_format=u
Index: php-src/run-tests.php
diff -u php-src/run-tests.php:1.226.2.37.2.35.2.55 
php-src/run-tests.php:1.226.2.37.2.35.2.56
--- php-src/run-tests.php:1.226.2.37.2.35.2.55  Tue Dec  9 15:21:15 2008
+++ php-src/run-tests.php   Thu Dec 11 02:37:36 2008
@@ -24,7 +24,7 @@
+--+
  */
 
-/* $Id: run-tests.php,v 1.226.2.37.2.35.2.55 2008/12/09 15:21:15 jani Exp $ */
+/* $Id: run-tests.php,v 1.226.2.37.2.35.2.56 2008/12/11 02:37:36 lstrojny Exp 
$ */
 
 /* Sanity check to ensure that pcre extension needed by this script is 
available.
  * In the event it is not, print a nice error message indicating that this 
script will
@@ -617,7 +617,7 @@
$html_output = is_resource($html_file);
break;
case '--version':
-   echo '$Revision: 1.226.2.37.2.35.2.55 
$' . \n;
+   echo '$Revision: 1.226.2.37.2.35.2.56 
$' . \n;
exit(1);
 
default:
@@ -1009,7 +1009,7 @@
$data = '';
 
$bin_env = array();
-   foreach($env as $key = $value) {
+   foreach((array)$env as $key = $value) {
$bin_env[(binary)$key] = (binary)$value;
}
 



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



[PHP-CVS] cvs: php-src / run-tests.php

2008-12-10 Thread Lars Strojny
lstrojnyThu Dec 11 02:38:10 2008 UTC

  Modified files:  
/php-srcrun-tests.php 
  Log:
  MFB: Fixing strict warning
  
  
http://cvs.php.net/viewvc.cgi/php-src/run-tests.php?r1=1.384r2=1.385diff_format=u
Index: php-src/run-tests.php
diff -u php-src/run-tests.php:1.384 php-src/run-tests.php:1.385
--- php-src/run-tests.php:1.384 Tue Dec  9 15:20:58 2008
+++ php-src/run-tests.php   Thu Dec 11 02:38:10 2008
@@ -24,7 +24,7 @@
+--+
  */
 
-/* $Id: run-tests.php,v 1.384 2008/12/09 15:20:58 jani Exp $ */
+/* $Id: run-tests.php,v 1.385 2008/12/11 02:38:10 lstrojny Exp $ */
 
 /* Sanity check to ensure that pcre extension needed by this script is 
available.
  * In the event it is not, print a nice error message indicating that this 
script will
@@ -617,7 +617,7 @@
$html_output = is_resource($html_file);
break;
case '--version':
-   echo '$Revision: 1.384 $' . \n;
+   echo '$Revision: 1.385 $' . \n;
exit(1);
 
default:
@@ -1009,7 +1009,7 @@
$data = '';
 
$bin_env = array();
-   foreach($env as $key = $value) {
+   foreach((array)$env as $key = $value) {
$bin_env[(binary)$key] = (binary)$value;
}
 



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



[PHP-CVS] cvs: php-src(PHP_5_2) / run-tests.php

2008-12-10 Thread Lars Strojny
lstrojnyThu Dec 11 02:38:45 2008 UTC

  Modified files:  (Branch: PHP_5_2)
/php-srcrun-tests.php 
  Log:
  MFB: Fixing strict warning
  
  
http://cvs.php.net/viewvc.cgi/php-src/run-tests.php?r1=1.226.2.37.2.54r2=1.226.2.37.2.55diff_format=u
Index: php-src/run-tests.php
diff -u php-src/run-tests.php:1.226.2.37.2.54 
php-src/run-tests.php:1.226.2.37.2.55
--- php-src/run-tests.php:1.226.2.37.2.54   Tue Dec  9 15:21:33 2008
+++ php-src/run-tests.php   Thu Dec 11 02:38:44 2008
@@ -24,7 +24,7 @@
+--+
  */
 
-/* $Id: run-tests.php,v 1.226.2.37.2.54 2008/12/09 15:21:33 jani Exp $ */
+/* $Id: run-tests.php,v 1.226.2.37.2.55 2008/12/11 02:38:44 lstrojny Exp $ */
 
 /* Sanity check to ensure that pcre extension needed by this script is 
available.
  * In the event it is not, print a nice error message indicating that this 
script will
@@ -617,7 +617,7 @@
$html_output = is_resource($html_file);
break;
case '--version':
-   echo '$Revision: 1.226.2.37.2.54 $' . 
\n;
+   echo '$Revision: 1.226.2.37.2.55 $' . 
\n;
exit(1);
 
default:
@@ -1009,7 +1009,7 @@
$data = '';
 
$bin_env = array();
-   foreach($env as $key = $value) {
+   foreach((array)$env as $key = $value) {
$bin_env[(binary)$key] = (binary)$value;
}
 



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



[PHP-CVS] cvs: php-src /ext/gettext gettext.c /ext/gettext/tests 44938.phpt

2008-10-30 Thread Lars Strojny
lstrojnyThu Oct 30 14:22:21 2008 UTC

  Added files: 
/php-src/ext/gettext/tests  44938.phpt 

  Modified files:  
/php-src/ext/gettextgettext.c 
  Log:
  The real fix for the gettext overflow bug
   - The overflow issue was not limited to domains, but also present for msgids
   - [DOC] msgids are now limited to 4096 chars, domains to 1024
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/gettext/gettext.c?r1=1.59r2=1.60diff_format=u
Index: php-src/ext/gettext/gettext.c
diff -u php-src/ext/gettext/gettext.c:1.59 php-src/ext/gettext/gettext.c:1.60
--- php-src/ext/gettext/gettext.c:1.59  Wed Oct 29 21:02:14 2008
+++ php-src/ext/gettext/gettext.c   Thu Oct 30 14:22:21 2008
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: gettext.c,v 1.59 2008/10/29 21:02:14 iliaa Exp $ */
+/* $Id: gettext.c,v 1.60 2008/10/30 14:22:21 lstrojny Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -136,12 +136,35 @@
 #endif
 
 #define PHP_GETTEXT_MAX_DOMAIN_LENGTH 1024
+#define PHP_GETTEXT_MAX_MSGID_LENGTH 4096
+
 #define PHP_GETTEXT_DOMAIN_LENGTH_CHECK \
if (domain_len  PHP_GETTEXT_MAX_DOMAIN_LENGTH) { \
php_error_docref(NULL TSRMLS_CC, E_WARNING, domain passed too 
long); \
RETURN_FALSE; \
}
 
+#define PHP_GETTEXT_MSGID_LENGTH_CHECK \
+   char *check_name = msgid; \
+   int check_len   = msgid_len; \
+   PHP_GETTEXT_LENGTH_CHECK
+
+#define PHP_GETTEXT_LENGTH_CHECK \
+   if (check_len  PHP_GETTEXT_MAX_MSGID_LENGTH) { \
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, %s passed too 
long, check_name); \
+   RETURN_FALSE; \
+   }
+
+#define PHP_GETTEXT_MULTI_MSGID_LENGTH_CHECK \
+   int check_len; \
+   char *check_name; \
+   check_name = msgid1; \
+   check_len = msgid_len1; \
+   PHP_GETTEXT_LENGTH_CHECK \
+   check_name = msgid2; \
+   check_len = msgid_len2; \
+   PHP_GETTEXT_LENGTH_CHECK
+
 PHP_MINFO_FUNCTION(php_gettext)
 {
php_info_print_table_start();
@@ -184,10 +207,13 @@
 {
char *msgid_str;
int msgid_len;
-   
+
if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, s, 
msgid_str, msgid_len, UG(ascii_conv))) {
return;
}
+
+   PHP_GETTEXT_MSGID_LENGTH_CHECK
+
RETURN_STRING(gettext(msgid_str), ZSTR_DUPLICATE);
 }
 /* }}} */
@@ -204,6 +230,7 @@
}
 
PHP_GETTEXT_DOMAIN_LENGTH_CHECK
+   PHP_GETTEXT_MSGID_LENGTH_CHECK
 
RETURN_STRING(dgettext(domain_str, msgid_str), ZSTR_DUPLICATE);
 }
@@ -222,6 +249,7 @@
}
 
PHP_GETTEXT_DOMAIN_LENGTH_CHECK
+   PHP_GETTEXT_MSGID_LENGTH_CHECK
 
RETURN_STRING(dcgettext(domain_str, msgid_str, category), 
ZSTR_DUPLICATE);
 }
@@ -263,11 +291,13 @@
char *msgid_str1, *msgid_str2, *msgstr;
int msgid_len1, msgid_len2;
long count;
-   
+
if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, 
ssl, msgid_str1, msgid_len1, UG(ascii_conv), msgid_str2, msgid_len2, 
UG(ascii_conv), count)) {
RETURN_FALSE;
}
-   
+
+   PHP_GETTEXT_MULTI_MSGID_LENGTH_CHECK
+
if ((msgstr = ngettext(msgid_str1, msgid_str2, count))) {
RETURN_STRING(msgstr, ZSTR_DUPLICATE);
} else {
@@ -291,6 +321,7 @@
}
 
PHP_GETTEXT_DOMAIN_LENGTH_CHECK
+   PHP_GETTEXT_MULTI_MSGID_LENGTH_CHECK
 
if ((msgstr = dngettext(domain_str, msgid_str1, msgid_str2, count))) {
RETURN_STRING(msgstr, ZSTR_DUPLICATE);
@@ -315,6 +346,7 @@
}
 
PHP_GETTEXT_DOMAIN_LENGTH_CHECK
+   PHP_GETTEXT_MULTI_MSGID_LENGTH_CHECK
 
if ((msgstr = dcngettext(domain_str, msgid_str1, msgid_str2, count, 
category))) {
RETURN_STRING(msgstr, ZSTR_DUPLICATE);

http://cvs.php.net/viewvc.cgi/php-src/ext/gettext/tests/44938.phpt?view=markuprev=1.1
Index: php-src/ext/gettext/tests/44938.phpt
+++ php-src/ext/gettext/tests/44938.phpt
--TEST--
#44938: gettext functions crash with overlong strings
--SKIPIF--
?php
if (!extension_loaded(gettext)) {
die(skip\n);
}
--FILE--
?php
$overflown = str_repeat('C', 8476509);
$msgid = msgid;
$domain= domain;
$category  = cat;

var_dump(bindtextdomain($overflown, 'path'));

var_dump(dngettext($overflown, $msgid, $msgid, 1));
var_dump(dngettext($domain, $overflown, $msgid, 1));
var_dump(dngettext($domain, $msgid, $overflown, 1));

var_dump(gettext($overflown));

var_dump(ngettext($overflown, $msgid, -1));
var_dump(ngettext($msgid, $overflown, -1));

var_dump(dcgettext($overflown, $msgid, -1));
var_dump(dcgettext($domain, $overflown, -1));

var_dump(dcngettext($overflown, $msgid, $msgid, -1, -1));
var_dump(dcngettext($domain, $overflown, $msgid, -1, -1));
var_dump(dcngettext($domain, $msgid, $overflown, -1, -1));

var_dump(dgettext($overflown, $msgid));

[PHP-CVS] cvs: php-src(PHP_5_2) /ext/gettext gettext.c /ext/gettext/tests 44938.phpt

2008-10-30 Thread Lars Strojny
lstrojnyThu Oct 30 14:23:04 2008 UTC

  Added files: (Branch: PHP_5_2)
/php-src/ext/gettext/tests  44938.phpt 

  Modified files:  
/php-src/ext/gettextgettext.c 
  Log:
  MFH: #44938
  
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/gettext/gettext.c?r1=1.46.2.2.2.6r2=1.46.2.2.2.7diff_format=u
Index: php-src/ext/gettext/gettext.c
diff -u php-src/ext/gettext/gettext.c:1.46.2.2.2.6 
php-src/ext/gettext/gettext.c:1.46.2.2.2.7
--- php-src/ext/gettext/gettext.c:1.46.2.2.2.6  Wed Oct 29 20:41:43 2008
+++ php-src/ext/gettext/gettext.c   Thu Oct 30 14:23:03 2008
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: gettext.c,v 1.46.2.2.2.6 2008/10/29 20:41:43 iliaa Exp $ */
+/* $Id: gettext.c,v 1.46.2.2.2.7 2008/10/30 14:23:03 lstrojny Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -145,12 +145,35 @@
 #endif
 
 #define PHP_GETTEXT_MAX_DOMAIN_LENGTH 1024
+#define PHP_GETTEXT_MAX_MSGID_LENGTH 4096
+
 #define PHP_GETTEXT_DOMAIN_LENGTH_CHECK \
if (domain_len  PHP_GETTEXT_MAX_DOMAIN_LENGTH) { \
php_error_docref(NULL TSRMLS_CC, E_WARNING, domain passed too 
long); \
RETURN_FALSE; \
}
 
+#define PHP_GETTEXT_MSGID_LENGTH_CHECK \
+   char *check_name = msgid; \
+   int check_len   = msgid_len; \
+   PHP_GETTEXT_LENGTH_CHECK
+
+#define PHP_GETTEXT_LENGTH_CHECK \
+   if (check_len  PHP_GETTEXT_MAX_MSGID_LENGTH) { \
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, %s passed too 
long, check_name); \
+   RETURN_FALSE; \
+   }
+
+#define PHP_GETTEXT_MULTI_MSGID_LENGTH_CHECK \
+   int check_len; \
+   char *check_name; \
+   check_name = msgid1; \
+   check_len = msgid1_len; \
+   PHP_GETTEXT_LENGTH_CHECK \
+   check_name = msgid2; \
+   check_len = msgid2_len; \
+   PHP_GETTEXT_LENGTH_CHECK
+
 PHP_MINFO_FUNCTION(php_gettext)
 {
php_info_print_table_start();
@@ -194,6 +217,7 @@
return;
}
 
+   PHP_GETTEXT_MSGID_LENGTH_CHECK
msgstr = gettext(msgid);
 
RETURN_STRING(msgstr, 1);
@@ -212,6 +236,7 @@
}
 
PHP_GETTEXT_DOMAIN_LENGTH_CHECK
+   PHP_GETTEXT_MSGID_LENGTH_CHECK
 
msgstr = dgettext(domain, msgid);
 
@@ -232,6 +257,7 @@
}
 
PHP_GETTEXT_DOMAIN_LENGTH_CHECK
+   PHP_GETTEXT_MSGID_LENGTH_CHECK
 
msgstr = dcgettext(domain, msgid, category);
 
@@ -257,7 +283,7 @@
php_error(E_WARNING, The first parameter of bindtextdomain 
must not be empty);
RETURN_FALSE;
}
-   
+
if (dir[0] != '\0'  strcmp(dir, 0)) {
if (!VCWD_REALPATH(dir, dir_name)) {
RETURN_FALSE;
@@ -285,6 +311,8 @@
return;
}
 
+   PHP_GETTEXT_MULTI_MSGID_LENGTH_CHECK
+
msgstr = ngettext(msgid1, msgid2, count);
if (msgstr) {
RETVAL_STRING(msgstr, 1);
@@ -301,13 +329,14 @@
char *domain, *msgid1, *msgid2, *msgstr = NULL;
int domain_len, msgid1_len, msgid2_len;
long count;
-   
+
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, sssl, domain, 
domain_len,
msgid1, msgid1_len, msgid2, msgid2_len, count) == FAILURE) 
{
return;
}
 
PHP_GETTEXT_DOMAIN_LENGTH_CHECK
+   PHP_GETTEXT_MULTI_MSGID_LENGTH_CHECK
 
msgstr = dngettext(domain, msgid1, msgid2, count);
if (msgstr) {
@@ -319,7 +348,7 @@
 
 #if HAVE_DCNGETTEXT
 /* {{{ proto string dcngettext (string domain, string msgid1, string msgid2, 
int n, int category)
-   Plural version of dcgettext() */

+   Plural version of dcgettext() */
 PHP_NAMED_FUNCTION(zif_dcngettext)
 {
char *domain, *msgid1, *msgid2, *msgstr = NULL;
@@ -334,6 +363,7 @@
}
 
PHP_GETTEXT_DOMAIN_LENGTH_CHECK
+   PHP_GETTEXT_MULTI_MSGID_LENGTH_CHECK
 
msgstr = dcngettext(domain, msgid1, msgid2, count, category);
 

http://cvs.php.net/viewvc.cgi/php-src/ext/gettext/tests/44938.phpt?view=markuprev=1.1
Index: php-src/ext/gettext/tests/44938.phpt
+++ php-src/ext/gettext/tests/44938.phpt
--TEST--
#44938: gettext functions crash with overlong strings
--SKIPIF--
?php
if (!extension_loaded(gettext)) {
die(skip\n);
}
--FILE--
?php
$overflown = str_repeat('C', 8476509);
$msgid = msgid;
$domain= domain;
$category  = cat;

var_dump(bindtextdomain($overflown, 'path'));

var_dump(dngettext($overflown, $msgid, $msgid, 1));
var_dump(dngettext($domain, $overflown, $msgid, 1));
var_dump(dngettext($domain, $msgid, $overflown, 1));

var_dump(gettext($overflown));

var_dump(ngettext($overflown, $msgid, -1));
var_dump(ngettext($msgid, $overflown, -1));

var_dump(dcgettext($overflown, $msgid, -1));
var_dump(dcgettext($domain, $overflown, -1));


[PHP-CVS] cvs: php-src(PHP_5_3) /ext/gettext gettext.c /ext/gettext/tests 44938.phpt

2008-10-30 Thread Lars Strojny
lstrojnyThu Oct 30 14:22:50 2008 UTC

  Added files: (Branch: PHP_5_3)
/php-src/ext/gettext/tests  44938.phpt 

  Modified files:  
/php-src/ext/gettextgettext.c 
  Log:
  MFH: #44938
  
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/gettext/gettext.c?r1=1.46.2.2.2.4.2.5r2=1.46.2.2.2.4.2.6diff_format=u
Index: php-src/ext/gettext/gettext.c
diff -u php-src/ext/gettext/gettext.c:1.46.2.2.2.4.2.5 
php-src/ext/gettext/gettext.c:1.46.2.2.2.4.2.6
--- php-src/ext/gettext/gettext.c:1.46.2.2.2.4.2.5  Wed Oct 29 20:29:12 2008
+++ php-src/ext/gettext/gettext.c   Thu Oct 30 14:22:50 2008
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: gettext.c,v 1.46.2.2.2.4.2.5 2008/10/29 20:29:12 iliaa Exp $ */
+/* $Id: gettext.c,v 1.46.2.2.2.4.2.6 2008/10/30 14:22:50 lstrojny Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -136,12 +136,35 @@
 #endif
 
 #define PHP_GETTEXT_MAX_DOMAIN_LENGTH 1024
+#define PHP_GETTEXT_MAX_MSGID_LENGTH 4096
+
 #define PHP_GETTEXT_DOMAIN_LENGTH_CHECK \
if (domain_len  PHP_GETTEXT_MAX_DOMAIN_LENGTH) { \
php_error_docref(NULL TSRMLS_CC, E_WARNING, domain passed too 
long); \
RETURN_FALSE; \
}
 
+#define PHP_GETTEXT_MSGID_LENGTH_CHECK \
+   char *check_name = msgid; \
+   int check_len   = msgid_len; \
+   PHP_GETTEXT_LENGTH_CHECK
+
+#define PHP_GETTEXT_LENGTH_CHECK \
+   if (check_len  PHP_GETTEXT_MAX_MSGID_LENGTH) { \
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, %s passed too 
long, check_name); \
+   RETURN_FALSE; \
+   }
+
+#define PHP_GETTEXT_MULTI_MSGID_LENGTH_CHECK \
+   int check_len; \
+   char *check_name; \
+   check_name = msgid1; \
+   check_len = msgid1_len; \
+   PHP_GETTEXT_LENGTH_CHECK \
+   check_name = msgid2; \
+   check_len = msgid2_len; \
+   PHP_GETTEXT_LENGTH_CHECK
+
 PHP_MINFO_FUNCTION(php_gettext)
 {
php_info_print_table_start();
@@ -185,6 +208,7 @@
return;
}
 
+   PHP_GETTEXT_MSGID_LENGTH_CHECK
msgstr = gettext(msgid);
 
RETURN_STRING(msgstr, 1);
@@ -203,6 +227,7 @@
}
 
PHP_GETTEXT_DOMAIN_LENGTH_CHECK
+   PHP_GETTEXT_MSGID_LENGTH_CHECK
 
msgstr = dgettext(domain, msgid);
 
@@ -223,6 +248,7 @@
}
 
PHP_GETTEXT_DOMAIN_LENGTH_CHECK
+   PHP_GETTEXT_MSGID_LENGTH_CHECK
 
msgstr = dcgettext(domain, msgid, category);
 
@@ -248,7 +274,7 @@
php_error(E_WARNING, The first parameter of bindtextdomain 
must not be empty);
RETURN_FALSE;
}
-   
+
if (dir[0] != '\0'  strcmp(dir, 0)) {
if (!VCWD_REALPATH(dir, dir_name)) {
RETURN_FALSE;
@@ -276,6 +302,8 @@
return;
}
 
+   PHP_GETTEXT_MULTI_MSGID_LENGTH_CHECK
+
msgstr = ngettext(msgid1, msgid2, count);
if (msgstr) {
RETVAL_STRING(msgstr, 1);
@@ -292,13 +320,14 @@
char *domain, *msgid1, *msgid2, *msgstr = NULL;
int domain_len, msgid1_len, msgid2_len;
long count;
-   
+
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, sssl, domain, 
domain_len,
msgid1, msgid1_len, msgid2, msgid2_len, count) == FAILURE) 
{
return;
}
 
PHP_GETTEXT_DOMAIN_LENGTH_CHECK
+   PHP_GETTEXT_MULTI_MSGID_LENGTH_CHECK
 
msgstr = dngettext(domain, msgid1, msgid2, count);
if (msgstr) {
@@ -310,7 +339,7 @@
 
 #if HAVE_DCNGETTEXT
 /* {{{ proto string dcngettext (string domain, string msgid1, string msgid2, 
int n, int category)
-   Plural version of dcgettext() */

+   Plural version of dcgettext() */
 PHP_NAMED_FUNCTION(zif_dcngettext)
 {
char *domain, *msgid1, *msgid2, *msgstr = NULL;
@@ -325,6 +354,7 @@
}
 
PHP_GETTEXT_DOMAIN_LENGTH_CHECK
+   PHP_GETTEXT_MULTI_MSGID_LENGTH_CHECK
 
msgstr = dcngettext(domain, msgid1, msgid2, count, category);
 

http://cvs.php.net/viewvc.cgi/php-src/ext/gettext/tests/44938.phpt?view=markuprev=1.1
Index: php-src/ext/gettext/tests/44938.phpt
+++ php-src/ext/gettext/tests/44938.phpt
--TEST--
#44938: gettext functions crash with overlong strings
--SKIPIF--
?php
if (!extension_loaded(gettext)) {
die(skip\n);
}
--FILE--
?php
$overflown = str_repeat('C', 8476509);
$msgid = msgid;
$domain= domain;
$category  = cat;

var_dump(bindtextdomain($overflown, 'path'));

var_dump(dngettext($overflown, $msgid, $msgid, 1));
var_dump(dngettext($domain, $overflown, $msgid, 1));
var_dump(dngettext($domain, $msgid, $overflown, 1));

var_dump(gettext($overflown));

var_dump(ngettext($overflown, $msgid, -1));
var_dump(ngettext($msgid, $overflown, -1));

var_dump(dcgettext($overflown, $msgid, -1));
var_dump(dcgettext($domain, $overflown, 

[PHP-CVS] cvs: php-src /ext/standard/tests/array prev_basic.phpt prev_error1.phpt prev_error2.phpt prev_error3.phpt prev_variation1.phpt prev_variation2.phpt

2008-09-11 Thread Lars Strojny
lstrojnyThu Sep 11 18:21:25 2008 UTC

  Added files: 
/php-src/ext/standard/tests/array   prev_basic.phpt prev_error1.phpt 
prev_error2.phpt prev_error3.phpt 
prev_variation1.phpt 
prev_variation2.phpt 
  Log:
  prev()-tests by Iain Lewis [EMAIL PROTECTED]
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/array/prev_basic.phpt?view=markuprev=1.1
Index: php-src/ext/standard/tests/array/prev_basic.phpt
+++ php-src/ext/standard/tests/array/prev_basic.phpt
--TEST--
Test prev() function : basic functionality 
--FILE--
?php
/* Prototype  : mixed prev(array $array_arg)
 * Description: Move array argument's internal pointer to the previous element 
and return it 
 * Source code: ext/standard/array.c
 */

/*
 * Test basic functionality of prev()
 */

echo *** Testing prev() : basic functionality ***\n;

$array = array('zero', 'one', 'two');
end($array);
echo key($array) .  =  . current($array) . \n;
var_dump(prev($array));

echo key($array) .  =  . current($array) . \n;
var_dump(prev($array));

echo key($array) .  =  . current($array) . \n;
var_dump(prev($array));

echo \n*** Testing an array with differing values/keys ***\n;
$array2 = array('one', 2 = help, 3, false, 'stringkey2' = 'val2', 
'stringkey1' = 'val1');
end($array2);
$length = count($array2);
for ($i = $length; $i  0; $i--) {
var_dump(prev($array2));
}

?
===DONE===
--EXPECTF--
*** Testing prev() : basic functionality ***
2 = two
unicode(3) one
1 = one
unicode(4) zero
0 = zero
bool(false)

*** Testing an array with differing values/keys ***
unicode(4) val2
bool(false)
int(3)
unicode(4) help
unicode(3) one
bool(false)
===DONE===

http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/array/prev_error1.phpt?view=markuprev=1.1
Index: php-src/ext/standard/tests/array/prev_error1.phpt
+++ php-src/ext/standard/tests/array/prev_error1.phpt
--TEST--
Test prev() function : error conditions - Pass incorrect number of arguments
--FILE--
?php
/* Prototype  : mixed prev(array $array_arg)
 * Description: Move array argument's internal pointer to the previous element 
and return it 
 * Source code: ext/standard/array.c
 */

/*
 * Pass incorrect number of arguments to prev() to test behaviour
 */

echo *** Testing prev() : error conditions ***\n;

// Zero arguments
echo \n-- Testing prev() function with Zero arguments --\n;
var_dump( prev() );

//Test prev with one more than the expected number of arguments
echo \n-- Testing prev() function with more than expected no. of arguments 
--\n;
$array_arg = array(1, 2);
$extra_arg = 10;
var_dump( prev($array_arg, $extra_arg) );
?
===DONE===
--EXPECTF--
*** Testing prev() : error conditions ***

-- Testing prev() function with Zero arguments --

Warning: prev() expects exactly 1 parameter, 0 given in %s on line %d
NULL

-- Testing prev() function with more than expected no. of arguments --

Warning: prev() expects exactly 1 parameter, 2 given in %s on line %d
NULL
===DONE===

http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/array/prev_error2.phpt?view=markuprev=1.1
Index: php-src/ext/standard/tests/array/prev_error2.phpt
+++ php-src/ext/standard/tests/array/prev_error2.phpt
--TEST--
prev - ensure warning is received when passing an indirect temporary.
--FILE--
?php
/* Prototype  : mixed prev(array $array_arg)
 * Description: Move array argument's internal pointer to the previous element 
and return it 
 * Source code: ext/standard/array.c
 */

/*
 * Pass temporary variables to prev() to test behaviour
 */

function f() {
$array  = array(1,2);
end($array);
return $array;
}

echo \n-- Passing an indirect temporary variable --\n;
var_dump(prev(f()));

?
--EXPECTF--
-- Passing an indirect temporary variable --

Strict Standards: Only variables should be passed by reference in %s on line %d
int(1)

http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/array/prev_error3.phpt?view=markuprev=1.1
Index: php-src/ext/standard/tests/array/prev_error3.phpt
+++ php-src/ext/standard/tests/array/prev_error3.phpt
--TEST--
prev - ensure we cannot pass a temporary
--FILE--
?php
/* Prototype  : mixed prev(array $array_arg)
 * Description: Move array argument's internal pointer to the previous element 
and return it 
 * Source code: ext/standard/array.c
 */

/*
 * Pass temporary variables to prev() to test behaviour
 */


var_dump(prev(array(1, 2)));
?
--EXPECTF--

Fatal error: Only variables can be passed by reference in %s on line %d
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/array/prev_variation1.phpt?view=markuprev=1.1
Index: php-src/ext/standard/tests/array/prev_variation1.phpt
+++ php-src/ext/standard/tests/array/prev_variation1.phpt
--TEST--
Test prev() function : usage variation - Pass different data types as $array_arg
--FILE--
?php
/* Prototype  : mixed prev(array $array_arg)
 * Description: Move array argument's 

[PHP-CVS] cvs: php-src(PHP_5_3) /ext/standard/tests/array prev_basic.phpt prev_error1.phpt prev_error2.phpt prev_error3.phpt prev_variation1.phpt prev_variation2.phpt

2008-09-11 Thread Lars Strojny
lstrojnyThu Sep 11 18:21:37 2008 UTC

  Added files: (Branch: PHP_5_3)
/php-src/ext/standard/tests/array   prev_basic.phpt prev_error1.phpt 
prev_error2.phpt prev_error3.phpt 
prev_variation1.phpt 
prev_variation2.phpt 
  Log:
  MFH: prev()-tests by Iain Lewis [EMAIL PROTECTED]
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/array/prev_basic.phpt?view=markuprev=1.1
Index: php-src/ext/standard/tests/array/prev_basic.phpt
+++ php-src/ext/standard/tests/array/prev_basic.phpt
--TEST--
Test prev() function : basic functionality 
--FILE--
?php
/* Prototype  : mixed prev(array $array_arg)
 * Description: Move array argument's internal pointer to the previous element 
and return it 
 * Source code: ext/standard/array.c
 */

/*
 * Test basic functionality of prev()
 */

echo *** Testing prev() : basic functionality ***\n;

$array = array('zero', 'one', 'two');
end($array);
echo key($array) .  =  . current($array) . \n;
var_dump(prev($array));

echo key($array) .  =  . current($array) . \n;
var_dump(prev($array));

echo key($array) .  =  . current($array) . \n;
var_dump(prev($array));

echo \n*** Testing an array with differing values/keys ***\n;
$array2 = array('one', 2 = help, 3, false, 'stringkey2' = 'val2', 
'stringkey1' = 'val1');
end($array2);
$length = count($array2);
for ($i = $length; $i  0; $i--) {
var_dump(prev($array2));
}

?
===DONE===
--EXPECTF--
*** Testing prev() : basic functionality ***
2 = two
unicode(3) one
1 = one
unicode(4) zero
0 = zero
bool(false)

*** Testing an array with differing values/keys ***
unicode(4) val2
bool(false)
int(3)
unicode(4) help
unicode(3) one
bool(false)
===DONE===

http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/array/prev_error1.phpt?view=markuprev=1.1
Index: php-src/ext/standard/tests/array/prev_error1.phpt
+++ php-src/ext/standard/tests/array/prev_error1.phpt
--TEST--
Test prev() function : error conditions - Pass incorrect number of arguments
--FILE--
?php
/* Prototype  : mixed prev(array $array_arg)
 * Description: Move array argument's internal pointer to the previous element 
and return it 
 * Source code: ext/standard/array.c
 */

/*
 * Pass incorrect number of arguments to prev() to test behaviour
 */

echo *** Testing prev() : error conditions ***\n;

// Zero arguments
echo \n-- Testing prev() function with Zero arguments --\n;
var_dump( prev() );

//Test prev with one more than the expected number of arguments
echo \n-- Testing prev() function with more than expected no. of arguments 
--\n;
$array_arg = array(1, 2);
$extra_arg = 10;
var_dump( prev($array_arg, $extra_arg) );
?
===DONE===
--EXPECTF--
*** Testing prev() : error conditions ***

-- Testing prev() function with Zero arguments --

Warning: prev() expects exactly 1 parameter, 0 given in %s on line %d
NULL

-- Testing prev() function with more than expected no. of arguments --

Warning: prev() expects exactly 1 parameter, 2 given in %s on line %d
NULL
===DONE===

http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/array/prev_error2.phpt?view=markuprev=1.1
Index: php-src/ext/standard/tests/array/prev_error2.phpt
+++ php-src/ext/standard/tests/array/prev_error2.phpt
--TEST--
prev - ensure warning is received when passing an indirect temporary.
--FILE--
?php
/* Prototype  : mixed prev(array $array_arg)
 * Description: Move array argument's internal pointer to the previous element 
and return it 
 * Source code: ext/standard/array.c
 */

/*
 * Pass temporary variables to prev() to test behaviour
 */

function f() {
$array  = array(1,2);
end($array);
return $array;
}

echo \n-- Passing an indirect temporary variable --\n;
var_dump(prev(f()));

?
--EXPECTF--
-- Passing an indirect temporary variable --

Strict Standards: Only variables should be passed by reference in %s on line %d
int(1)

http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/array/prev_error3.phpt?view=markuprev=1.1
Index: php-src/ext/standard/tests/array/prev_error3.phpt
+++ php-src/ext/standard/tests/array/prev_error3.phpt
--TEST--
prev - ensure we cannot pass a temporary
--FILE--
?php
/* Prototype  : mixed prev(array $array_arg)
 * Description: Move array argument's internal pointer to the previous element 
and return it 
 * Source code: ext/standard/array.c
 */

/*
 * Pass temporary variables to prev() to test behaviour
 */


var_dump(prev(array(1, 2)));
?
--EXPECTF--

Fatal error: Only variables can be passed by reference in %s on line %d
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/array/prev_variation1.phpt?view=markuprev=1.1
Index: php-src/ext/standard/tests/array/prev_variation1.phpt
+++ php-src/ext/standard/tests/array/prev_variation1.phpt
--TEST--
Test prev() function : usage variation - Pass different data types as $array_arg
--FILE--
?php
/* Prototype  : mixed prev(array $array_arg)
 * Description: Move 

[PHP-CVS] cvs: php-src(PHP_5_3) / NEWS /ext/standard array.c url.c var.c /ext/standard/tests/array array_reduce.phpt

2008-08-20 Thread Lars Strojny
lstrojnyWed Aug 20 20:35:45 2008 UTC

  Added files: (Branch: PHP_5_3)
/php-src/ext/standard/tests/array   array_reduce.phpt 

  Modified files:  
/php-srcNEWS 
/php-src/ext/standard   array.c url.c var.c 
  Log:
  MFH: Allow mixed $initial (patch by Christian Seiler)
  
  
http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.965.2.282r2=1.2027.2.547.2.965.2.283diff_format=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.2027.2.547.2.965.2.282 
php-src/NEWS:1.2027.2.547.2.965.2.283
--- php-src/NEWS:1.2027.2.547.2.965.2.282   Wed Aug 20 01:34:51 2008
+++ php-src/NEWSWed Aug 20 20:35:34 2008
@@ -6,6 +6,7 @@
 - Changed session_start() to return false when session startup fails. (Jani)
 - Changed property_exists() to check the existence of a property independent of
   accessibility (like method_exists()). (Felipe)
+- Changed array_reduce() to allow mixed $initial (Christian Seiler)
 
 - Added system independent realpath() implementation which caches intermediate
   directories in realpath-cache. (Dmitry)
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/array.c?r1=1.308.2.21.2.37.2.41r2=1.308.2.21.2.37.2.42diff_format=u
Index: php-src/ext/standard/array.c
diff -u php-src/ext/standard/array.c:1.308.2.21.2.37.2.41 
php-src/ext/standard/array.c:1.308.2.21.2.37.2.42
--- php-src/ext/standard/array.c:1.308.2.21.2.37.2.41   Sun Aug 17 22:14:14 2008
+++ php-src/ext/standard/array.cWed Aug 20 20:35:34 2008
@@ -21,7 +21,7 @@
+--+
 */
 
-/* $Id: array.c,v 1.308.2.21.2.37.2.41 2008/08/17 22:14:14 felipe Exp $ */
+/* $Id: array.c,v 1.308.2.21.2.37.2.42 2008/08/20 20:35:34 lstrojny Exp $ */
 
 #include php.h
 #include php_ini.h
@@ -4067,7 +4067,7 @@
 }
 /* }}} */
 
-/* {{{ proto mixed array_reduce(array input, mixed callback [, int initial])
+/* {{{ proto mixed array_reduce(array input, mixed callback [, mixed initial])
Iteratively reduce the array to a single value via the callback. */
 PHP_FUNCTION(array_reduce)
 {
@@ -4078,18 +4078,19 @@
zval *retval;
zend_fcall_info fci;
zend_fcall_info_cache fci_cache = empty_fcall_info_cache;
-   long initial;
+   zval *initial;
HashPosition pos;
HashTable *htbl;
 
-   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, af|l, input, 
fci, fci_cache, initial) == FAILURE) {
+   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, af|z, input, 
fci, fci_cache, initial) == FAILURE) {
return;
}
 
if (ZEND_NUM_ARGS()  2) {
ALLOC_ZVAL(result);
+   *result = *initial;
+   zval_copy_ctor(result);
INIT_PZVAL(result);
-   ZVAL_LONG(result, initial);
} else {
MAKE_STD_ZVAL(result);
ZVAL_NULL(result);
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/url.c?r1=1.86.2.5.2.7.2.4r2=1.86.2.5.2.7.2.5diff_format=u
Index: php-src/ext/standard/url.c
diff -u php-src/ext/standard/url.c:1.86.2.5.2.7.2.4 
php-src/ext/standard/url.c:1.86.2.5.2.7.2.5
--- php-src/ext/standard/url.c:1.86.2.5.2.7.2.4 Wed Jun  4 19:35:15 2008
+++ php-src/ext/standard/url.c  Wed Aug 20 20:35:39 2008
@@ -15,7 +15,7 @@
| Author: Jim Winstead [EMAIL PROTECTED]  
|
+--+
  */
-/* $Id: url.c,v 1.86.2.5.2.7.2.4 2008/06/04 19:35:15 rrichards Exp $ */
+/* $Id: url.c,v 1.86.2.5.2.7.2.5 2008/08/20 20:35:39 lstrojny Exp $ */
 
 #include stdlib.h
 #include string.h
@@ -65,21 +65,23 @@
 {
unsigned char *s = (unsigned char *)str;
unsigned char *e = (unsigned char *)str + len;
-   
+   unsigned char *r[len + 1];
+   unsigned int c = 0;
+
if (!str) {
-   return (NULL);
+   return NULL;
}
-   
+
while (s  e) {
-   
-   if (iscntrl(*s)) {
-   *s='_';
-   }   
+   if (0 == iscntrl(*s)) {
+   r[c] = *s;
+   c++;
+   }
s++;
}
-   
-   return (str);
-} 
+
+   return (unsigned char *)r;
+}
 /* }}} */
 
 PHPAPI char *php_replace_controlchars(char *str)
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/var.c?r1=1.203.2.7.2.18.2.10r2=1.203.2.7.2.18.2.11diff_format=u
Index: php-src/ext/standard/var.c
diff -u php-src/ext/standard/var.c:1.203.2.7.2.18.2.10 
php-src/ext/standard/var.c:1.203.2.7.2.18.2.11
--- php-src/ext/standard/var.c:1.203.2.7.2.18.2.10  Thu Jul 24 19:52:24 2008
+++ php-src/ext/standard/var.c  Wed Aug 20 20:35:40 2008
@@ -18,7 +18,7 @@
+--+
 */
 
-/* $Id: var.c,v 1.203.2.7.2.18.2.10 2008/07/24 19:52:24 felipe Exp $ */
+/* $Id: var.c,v 1.203.2.7.2.18.2.11 2008/08/20 20:35:40 

[PHP-CVS] cvs: php-src(PHP_5_3) /ext/standard url.c var.c

2008-08-20 Thread Lars Strojny
lstrojnyWed Aug 20 21:26:04 2008 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/standard   var.c url.c 
  Log:
  Reverting local change
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/var.c?r1=1.203.2.7.2.18.2.11r2=1.203.2.7.2.18.2.12diff_format=u
Index: php-src/ext/standard/var.c
diff -u php-src/ext/standard/var.c:1.203.2.7.2.18.2.11 
php-src/ext/standard/var.c:1.203.2.7.2.18.2.12
--- php-src/ext/standard/var.c:1.203.2.7.2.18.2.11  Wed Aug 20 20:35:40 2008
+++ php-src/ext/standard/var.c  Wed Aug 20 21:26:04 2008
@@ -18,7 +18,7 @@
+--+
 */
 
-/* $Id: var.c,v 1.203.2.7.2.18.2.11 2008/08/20 20:35:40 lstrojny Exp $ */
+/* $Id: var.c,v 1.203.2.7.2.18.2.12 2008/08/20 21:26:04 lstrojny Exp $ */
 
 /* {{{ includes
 */
@@ -422,7 +422,7 @@
php_printf(\n%*c, level - 1, ' ');
}
Z_OBJ_HANDLER(**struc, get_class_name)(*struc, class_name, 
class_name_len, 0 TSRMLS_CC);
-   php_printf (%s::__setState(array(\n, class_name);
+   php_printf (%s::__set_state(array(\n, class_name);
efree(class_name);
if (myht) {
zend_hash_apply_with_arguments(myht TSRMLS_CC, 
(apply_func_args_t) php_object_element_export, 1, level);
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/url.c?r1=1.86.2.5.2.7.2.5r2=1.86.2.5.2.7.2.6diff_format=u
Index: php-src/ext/standard/url.c
diff -u php-src/ext/standard/url.c:1.86.2.5.2.7.2.5 
php-src/ext/standard/url.c:1.86.2.5.2.7.2.6
--- php-src/ext/standard/url.c:1.86.2.5.2.7.2.5 Wed Aug 20 20:35:39 2008
+++ php-src/ext/standard/url.c  Wed Aug 20 21:26:04 2008
@@ -15,7 +15,7 @@
| Author: Jim Winstead [EMAIL PROTECTED]  
|
+--+
  */
-/* $Id: url.c,v 1.86.2.5.2.7.2.5 2008/08/20 20:35:39 lstrojny Exp $ */
+/* $Id: url.c,v 1.86.2.5.2.7.2.6 2008/08/20 21:26:04 lstrojny Exp $ */
 
 #include stdlib.h
 #include string.h
@@ -65,23 +65,21 @@
 {
unsigned char *s = (unsigned char *)str;
unsigned char *e = (unsigned char *)str + len;
-   unsigned char *r[len + 1];
-   unsigned int c = 0;
-
+   
if (!str) {
-   return NULL;
+   return (NULL);
}
-
+   
while (s  e) {
-   if (0 == iscntrl(*s)) {
-   r[c] = *s;
-   c++;
-   }
+   
+   if (iscntrl(*s)) {
+   *s='_';
+   }   
s++;
}
-
-   return (unsigned char *)r;
-}
+   
+   return (str);
+} 
 /* }}} */
 
 PHPAPI char *php_replace_controlchars(char *str)



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



[PHP-CVS] cvs: php-src / run-tests.php

2008-07-23 Thread Lars Strojny
lstrojnyWed Jul 23 16:10:14 2008 UTC

  Modified files:  
/php-srcrun-tests.php 
  Log:
  Allowing %unicode|string% as a placeholder. In 6, this placeholder is 
resolved
  to unicode, in 6 to string. This allows to easily write portable tests.
  Patch by uw
  
  
  
http://cvs.php.net/viewvc.cgi/php-src/run-tests.php?r1=1.366r2=1.367diff_format=u
Index: php-src/run-tests.php
diff -u php-src/run-tests.php:1.366 php-src/run-tests.php:1.367
--- php-src/run-tests.php:1.366 Tue Jul 22 19:53:00 2008
+++ php-src/run-tests.php   Wed Jul 23 16:10:14 2008
@@ -24,7 +24,7 @@
+--+
  */
 
-/* $Id: run-tests.php,v 1.366 2008/07/22 19:53:00 felipe Exp $ */
+/* $Id: run-tests.php,v 1.367 2008/07/23 16:10:14 lstrojny Exp $ */
 
 /* Sanity check to ensure that pcre extension needed by this script is 
available.
  * In the event it is not, print a nice error message indicating that this 
script will
@@ -478,7 +478,7 @@
$html_output = is_resource($html_file);
break;
case '--version':
-   echo '$Revision: 1.366 $' . \n;
+   echo '$Revision: 1.367 $' . \n;
exit(1);
 
default:
@@ -1711,6 +1711,11 @@
 
if (isset($section_text['EXPECTF'])) {
$wanted_re = preg_quote($wanted_re, '/');
+   $wanted_re = str_replace(
+   array('%unicode\|string%', '%string\|unicode%'),
+   version_compare(PHP_VERSION, '6.0.0-dev') == -1 
? 'string' : 'unicode',
+   $wanted_re
+   );
// Stick to basics
$wanted_re = str_replace('%e', '\\' . 
DIRECTORY_SEPARATOR, $wanted_re);
$wanted_re = str_replace('%s', '[^\r\n]+', $wanted_re);



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



[PHP-CVS] cvs: php-src(PHP_5_3) / run-tests.php

2008-07-23 Thread Lars Strojny
lstrojnyWed Jul 23 16:11:00 2008 UTC

  Modified files:  (Branch: PHP_5_3)
/php-srcrun-tests.php 
  Log:
  Allowing %unicode|string% as a placeholder (backport from HEAD)
  
  
http://cvs.php.net/viewvc.cgi/php-src/run-tests.php?r1=1.226.2.37.2.35.2.37r2=1.226.2.37.2.35.2.38diff_format=u
Index: php-src/run-tests.php
diff -u php-src/run-tests.php:1.226.2.37.2.35.2.37 
php-src/run-tests.php:1.226.2.37.2.35.2.38
--- php-src/run-tests.php:1.226.2.37.2.35.2.37  Tue Jul 22 19:59:37 2008
+++ php-src/run-tests.php   Wed Jul 23 16:11:00 2008
@@ -24,7 +24,7 @@
+--+
  */
 
-/* $Id: run-tests.php,v 1.226.2.37.2.35.2.37 2008/07/22 19:59:37 felipe Exp $ 
*/
+/* $Id: run-tests.php,v 1.226.2.37.2.35.2.38 2008/07/23 16:11:00 lstrojny Exp 
$ */
 
 /* Sanity check to ensure that pcre extension needed by this script is 
available.
  * In the event it is not, print a nice error message indicating that this 
script will
@@ -478,7 +478,7 @@
$html_output = is_resource($html_file);
break;
case '--version':
-   echo '$Revision: 1.226.2.37.2.35.2.37 
$' . \n;
+   echo '$Revision: 1.226.2.37.2.35.2.38 
$' . \n;
exit(1);
 
default:
@@ -1711,6 +1711,11 @@
 
if (isset($section_text['EXPECTF'])) {
$wanted_re = preg_quote($wanted_re, '/');
+   $wanted_re = str_replace(
+   array('%unicode\|string%', '%string\|unicode%'),
+   version_compare(PHP_VERSION, '6.0.0-dev') == -1 
? 'string' : 'unicode',
+   $wanted_re
+   );
// Stick to basics
$wanted_re = str_replace('%e', '\\' . 
DIRECTORY_SEPARATOR, $wanted_re);
$wanted_re = str_replace('%s', '[^\r\n]+', $wanted_re);



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



[PHP-CVS] cvs: php-src(PHP_5_3) /ext/standard/tests array_intersect_ukey_error.phpt array_intersect_ukey_variation1.phpt array_intersect_ukey_variation2.phpt array_intersect_ukey_variation3.phpt array

2008-07-23 Thread Lars Strojny
lstrojnyWed Jul 23 20:37:23 2008 UTC

  Added files: (Branch: PHP_5_3)
/php-src/ext/standard/tests array_intersect_ukey_error.phpt 
array_intersect_ukey_variation1.phpt 
array_intersect_ukey_variation2.phpt 
array_intersect_ukey_variation3.phpt 
array_intersect_ukey_variation4.phpt 
array_intersect_ukey_variation5.phpt 
array_intersect_ukey_variation6.phpt 
array_intersect_ukey_variation7.phpt 
array_intersect_ukey_variation8.phpt 
array_intersect_ukey_variation9.phpt 
  Log:
  array_intersect_ukey tests by Sanjay Mantoor
  
  

http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/array_intersect_ukey_error.phpt?view=markuprev=1.1
Index: php-src/ext/standard/tests/array_intersect_ukey_error.phpt
+++ php-src/ext/standard/tests/array_intersect_ukey_error.phpt

http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/array_intersect_ukey_variation1.phpt?view=markuprev=1.1
Index: php-src/ext/standard/tests/array_intersect_ukey_variation1.phpt
+++ php-src/ext/standard/tests/array_intersect_ukey_variation1.phpt

http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/array_intersect_ukey_variation2.phpt?view=markuprev=1.1
Index: php-src/ext/standard/tests/array_intersect_ukey_variation2.phpt
+++ php-src/ext/standard/tests/array_intersect_ukey_variation2.phpt

http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/array_intersect_ukey_variation3.phpt?view=markuprev=1.1
Index: php-src/ext/standard/tests/array_intersect_ukey_variation3.phpt
+++ php-src/ext/standard/tests/array_intersect_ukey_variation3.phpt

http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/array_intersect_ukey_variation4.phpt?view=markuprev=1.1
Index: php-src/ext/standard/tests/array_intersect_ukey_variation4.phpt
+++ php-src/ext/standard/tests/array_intersect_ukey_variation4.phpt

http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/array_intersect_ukey_variation5.phpt?view=markuprev=1.1
Index: php-src/ext/standard/tests/array_intersect_ukey_variation5.phpt
+++ php-src/ext/standard/tests/array_intersect_ukey_variation5.phpt

http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/array_intersect_ukey_variation6.phpt?view=markuprev=1.1
Index: php-src/ext/standard/tests/array_intersect_ukey_variation6.phpt
+++ php-src/ext/standard/tests/array_intersect_ukey_variation6.phpt

http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/array_intersect_ukey_variation7.phpt?view=markuprev=1.1
Index: php-src/ext/standard/tests/array_intersect_ukey_variation7.phpt
+++ php-src/ext/standard/tests/array_intersect_ukey_variation7.phpt

http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/array_intersect_ukey_variation8.phpt?view=markuprev=1.1
Index: php-src/ext/standard/tests/array_intersect_ukey_variation8.phpt
+++ php-src/ext/standard/tests/array_intersect_ukey_variation8.phpt

http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/array_intersect_ukey_variation9.phpt?view=markuprev=1.1
Index: php-src/ext/standard/tests/array_intersect_ukey_variation9.phpt
+++ php-src/ext/standard/tests/array_intersect_ukey_variation9.phpt



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



[PHP-CVS] cvs: php-src /ext/standard/tests array_intersect_ukey_error.phpt array_intersect_ukey_variation1.phpt array_intersect_ukey_variation2.phpt array_intersect_ukey_variation3.phpt array_intersec

2008-07-23 Thread Lars Strojny
lstrojnyWed Jul 23 20:38:10 2008 UTC

  Modified files:  
/php-src/ext/standard/tests array_intersect_ukey_error.phpt 
array_intersect_ukey_variation1.phpt 
array_intersect_ukey_variation2.phpt 
array_intersect_ukey_variation3.phpt 
array_intersect_ukey_variation4.phpt 
array_intersect_ukey_variation5.phpt 
array_intersect_ukey_variation6.phpt 
array_intersect_ukey_variation7.phpt 
array_intersect_ukey_variation8.phpt 
array_intersect_ukey_variation9.phpt 
  Log:
  array_intersect_ukey tests by Sanjay Mantoor
  
  http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/array_intersect_ukey_error.phpt?r1=1.1r2=1.2diff_format=u
Index: php-src/ext/standard/tests/array_intersect_ukey_error.phpt
diff -u /dev/null php-src/ext/standard/tests/array_intersect_ukey_error.phpt:1.2
--- /dev/null   Wed Jul 23 20:38:10 2008
+++ php-src/ext/standard/tests/array_intersect_ukey_error.phpt  Wed Jul 23 
20:38:10 2008
@@ -0,0 +1,56 @@
+--TEST--
+Test array_intersect_ukey() function : error conditions 
+--FILE--
+?php
+/* Prototype  : array array_intersect_ukey(array arr1, array arr2 [, array 
...], callback key_compare_func)
+ * Description: Computes the intersection of arrays using a callback function 
on the keys for comparison. 
+ * Source code: ext/standard/array.c
+ */
+
+echo *** Testing array_intersect_ukey() : error conditions ***\n;
+
+//Initialise arguments
+$array1 = array('blue'  = 1, 'red'  = 2, 'green'  = 3, 'purple' = 4);
+$array2 = array('green' = 5, 'blue' = 6, 'yellow' = 7, 'cyan'   = 8);
+
+//Call back function
+function key_compare_func($key1, $key2)
+{
+if ($key1 == $key2)
+return 0;
+else
+return ($key1  $key2)? 1:-1; 
+}
+
+//Test array_intersect_ukey with one more than the expected number of arguments
+echo \n-- Testing array_intersect_ukey() function with more than expected no. 
of arguments --\n;
+$extra_arg = 10;
+var_dump( array_intersect_ukey($array1, $array2, 
'key_compare_func',$extra_arg) );
+
+// Testing array_intersect_ukey with one less than the expected number of 
arguments
+echo \n-- Testing array_intersect_ukey() function with less than expected no. 
of arguments --\n;
+var_dump( array_intersect_ukey($array1, $array2) );
+
+// Testing array_intersect_ukey with no arguments
+echo \n-- Testing array_intersect_ukey() function with no arguments --\n;
+var_dump( array_intersect_ukey() );
+?
+===DONE===
+--EXPECTF--
+*** Testing array_intersect_ukey() : error conditions ***
+
+-- Testing array_intersect_ukey() function with more than expected no. of 
arguments --
+
+Warning: array_intersect_ukey() expects parameter 4 to be a valid callback, no 
array or string given in %s on line %d
+NULL
+
+-- Testing array_intersect_ukey() function with less than expected no. of 
arguments --
+
+Warning: array_intersect_ukey(): at least 3 parameters are required, 2 given 
in %s on line %d
+NULL
+
+-- Testing array_intersect_ukey() function with no arguments --
+
+Warning: array_intersect_ukey(): at least 3 parameters are required, 0 given 
in %s on line %d
+NULL
+===DONE===
\ No newline at end of file
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/array_intersect_ukey_variation1.phpt?r1=1.1r2=1.2diff_format=u
Index: php-src/ext/standard/tests/array_intersect_ukey_variation1.phpt
diff -u /dev/null 
php-src/ext/standard/tests/array_intersect_ukey_variation1.phpt:1.2
--- /dev/null   Wed Jul 23 20:38:10 2008
+++ php-src/ext/standard/tests/array_intersect_ukey_variation1.phpt Wed Jul 
23 20:38:10 2008
@@ -0,0 +1,320 @@
+--TEST--
+Test array_intersect_ukey() function : usage variation - Passing unexpected 
values to first argument
+--FILE--
+?php
+/* Prototype  : array array_intersect_ukey(array arr1, array arr2 [, array 
...], callback key_compare_func)
+ * Description: Computes the intersection of arrays using a callback function 
on the keys for comparison. 
+ * Source code: ext/standard/array.c
+ */
+
+echo *** Testing array_intersect_ukey() : usage variation ***\n;
+
+//Initialise arguments
+$array2 = array('green' = 5, 'blue' = 6, 'yellow' = 7, 'cyan'   = 8);
+$array3 = array('green' = 5, 'cyan'   = 8);
+
+//Call back function
+function key_compare_func($key1, $key2)
+{
+if ($key1 == $key2)
+return 0;
+else
+return ($key1  $key2)? 1:-1; 
+}
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+//resource variable
+$fp = fopen(__FILE__, r);
+
+// define some classes
+class classWithToString
+{
+   public function __toString() {
+   return Class A object;
+   }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = EOT
+hello world
+EOT;
+
+//array of values to iterate over
+$inputs 

[PHP-CVS] cvs: php-src(PHP_5_3) /tests/lang 033.phpt

2008-07-15 Thread Lars Strojny
lstrojnyTue Jul 15 08:34:18 2008 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/tests/lang 033.phpt 
  Log:
  Reenabling the test but removing the test cases for old_function as the 
alternative syntaxes are still there
  
  
http://cvs.php.net/viewvc.cgi/php-src/tests/lang/033.phpt?r1=1.2r2=1.2.8.1diff_format=u
Index: php-src/tests/lang/033.phpt
diff -u php-src/tests/lang/033.phpt:1.2 php-src/tests/lang/033.phpt:1.2.8.1
--- php-src/tests/lang/033.phpt:1.2 Sat Nov 23 22:08:05 2002
+++ php-src/tests/lang/033.phpt Tue Jul 15 08:34:18 2008
@@ -1,7 +1,5 @@
 --TEST--
 Alternative syntaxes test
---SKIPIF--
-?php if(version_compare(zend_version(), 2.0.0-dev, '=')) echo skip 
removed in Zend Engine 2\n; ?
 --FILE--
 ?php
 $a = 1;
@@ -38,16 +36,12 @@
echo 0;
break;
 endswitch;
-
-echo \nold_function: ;
-old_function foo $bar, $baz (
-   return sprintf(foo(%s, %s);\n, $bar, $baz);
-);
-echo foo(1,2);
 ?
+
+===DONE===
 --EXPECT--
 If: 11
 While: 12346789
 For: 0123401234
 Switch: 1
-old_function: foo(1, 2);
+===DONE===



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



[PHP-CVS] cvs: php-src(PHP_5_3) /main output.c

2008-07-15 Thread Lars Strojny
lstrojnyTue Jul 15 08:50:04 2008 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/main   output.c 
  Log:
  New parameter parsing API
  
  
http://cvs.php.net/viewvc.cgi/php-src/main/output.c?r1=1.167.2.3.2.4.2.3r2=1.167.2.3.2.4.2.4diff_format=u
Index: php-src/main/output.c
diff -u php-src/main/output.c:1.167.2.3.2.4.2.3 
php-src/main/output.c:1.167.2.3.2.4.2.4
--- php-src/main/output.c:1.167.2.3.2.4.2.3 Mon Mar 10 22:12:33 2008
+++ php-src/main/output.c   Tue Jul 15 08:50:04 2008
@@ -18,7 +18,7 @@
+--+
 */
 
-/* $Id: output.c,v 1.167.2.3.2.4.2.3 2008/03/10 22:12:33 felipe Exp $ */
+/* $Id: output.c,v 1.167.2.3.2.4.2.4 2008/07/15 08:50:04 lstrojny Exp $ */
 
 #include php.h
 #include ext/standard/head.h
@@ -999,24 +999,12 @@
Turn implicit flush on/off and is equivalent to calling flush() after every 
output call */
 PHP_FUNCTION(ob_implicit_flush)
 {
-   zval **zv_flag;
-   int flag;
+   long flag = 1;
 
-   switch(ZEND_NUM_ARGS()) {
-   case 0:
-   flag = 1;
-   break;
-   case 1:
-   if (zend_get_parameters_ex(1, zv_flag)==FAILURE) {
-   RETURN_FALSE;
-   }
-   convert_to_long_ex(zv_flag);
-   flag = Z_LVAL_PP(zv_flag);
-   break;
-   default:
-   ZEND_WRONG_PARAM_COUNT();
-   break;
+   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, |l, flag) == 
FAILURE) {
+   RETURN_FALSE;
}
+
if (flag) {
php_start_implicit_flush(TSRMLS_C);
} else {



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



[PHP-CVS] cvs: php-src(PHP_5_3) /main output.c

2008-07-15 Thread Lars Strojny
lstrojnyTue Jul 15 09:09:09 2008 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/main   output.c 
  Log:
  Return null on when param parsing errors occur
  
  
http://cvs.php.net/viewvc.cgi/php-src/main/output.c?r1=1.167.2.3.2.4.2.4r2=1.167.2.3.2.4.2.5diff_format=u
Index: php-src/main/output.c
diff -u php-src/main/output.c:1.167.2.3.2.4.2.4 
php-src/main/output.c:1.167.2.3.2.4.2.5
--- php-src/main/output.c:1.167.2.3.2.4.2.4 Tue Jul 15 08:50:04 2008
+++ php-src/main/output.c   Tue Jul 15 09:09:09 2008
@@ -18,7 +18,7 @@
+--+
 */
 
-/* $Id: output.c,v 1.167.2.3.2.4.2.4 2008/07/15 08:50:04 lstrojny Exp $ */
+/* $Id: output.c,v 1.167.2.3.2.4.2.5 2008/07/15 09:09:09 lstrojny Exp $ */
 
 #include php.h
 #include ext/standard/head.h
@@ -738,15 +738,14 @@
zval *output_handler=NULL;
long chunk_size=0;
zend_bool erase=1;
-   int argc = ZEND_NUM_ARGS();
-   
-   if (zend_parse_parameters(argc TSRMLS_CC, |zlb, output_handler, 
chunk_size, erase) == FAILURE) {
-   RETURN_FALSE;
+
+   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, |zlb, 
output_handler, chunk_size, erase) == FAILURE) {
+   return;
}
 
if (chunk_size  0)
chunk_size = 0;
-   
+
if (php_start_ob_buffer(output_handler, chunk_size, erase 
TSRMLS_CC)==FAILURE) {
RETURN_FALSE;
}
@@ -965,12 +964,12 @@
Return the status of the active or all output buffers */
 PHP_FUNCTION(ob_get_status)
 {
-   int argc = ZEND_NUM_ARGS();
zend_bool full_status = 0;
-   
-   if (zend_parse_parameters(argc TSRMLS_CC, |b, full_status) == 
FAILURE )
-   RETURN_FALSE;
-   
+
+   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, |b, 
full_status) == FAILURE ) {
+   return;
+   }
+
array_init(return_value);
 
if (full_status) {
@@ -1002,7 +1001,7 @@
long flag = 1;
 
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, |l, flag) == 
FAILURE) {
-   RETURN_FALSE;
+   return;
}
 
if (flag) {
@@ -1053,7 +1052,7 @@
int name_len, value_len;
 
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, ss, name, 
name_len, value, value_len) == FAILURE) {
-   RETURN_FALSE;
+   return;
}
 
if (php_url_scanner_add_var(name, name_len, value, value_len, 1 
TSRMLS_CC) == SUCCESS) {



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



Re: [PHP-CVS] cvs: php-src(PHP_5_3) /main output.c

2008-07-15 Thread Lars Strojny
Hi Hannes,

Am Dienstag, den 15.07.2008, 15:07 +0200 schrieb Hannes Magnusson:
 I see no point in breaking bc just to break it.

that's how it is done elsewhere too. The issue is, there are no tests to
tell us how the behaviour was before the parameter handling was changed
to the new API, so we can only guess. And return null is the better
guess from MPOV.
cu, Lars


signature.asc
Description: Dies ist ein digital signierter Nachrichtenteil


Re: [PHP-CVS] cvs: php-src(PHP_5_3) /ext/reflection php_reflection.c /ext/reflection/tests ReflectionFunction_getNamespaceName.phpt reflectionClass_getNamespaceName.phpt

2008-06-25 Thread Lars Strojny
Thank you very much!

Am Mittwoch, den 25.06.2008, 12:33 + schrieb Dmitry Stogov:
 dmitryWed Jun 25 12:33:46 2008 UTC
 
   Added files: (Branch: PHP_5_3)
 /php-src/ext/reflection/tests 
   
 ReflectionFunction_getNamespaceName.phpt 
   reflectionClass_getNamespaceName.phpt 
 
   Modified files:  
 /php-src/ext/reflection   php_reflection.c 
   Log:
   Added support for namespaces
   
   
 http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/php_reflection.c?r1=1.164.2.33.2.45.2.16r2=1.164.2.33.2.45.2.17diff_format=u
 Index: php-src/ext/reflection/php_reflection.c
 diff -u php-src/ext/reflection/php_reflection.c:1.164.2.33.2.45.2.16 
 php-src/ext/reflection/php_reflection.c:1.164.2.33.2.45.2.17
 --- php-src/ext/reflection/php_reflection.c:1.164.2.33.2.45.2.16  Sat Jun 
 21 02:41:27 2008
 +++ php-src/ext/reflection/php_reflection.c   Wed Jun 25 12:33:46 2008
 @@ -20,7 +20,7 @@
 +--+
  */
  
 -/* $Id: php_reflection.c,v 1.164.2.33.2.45.2.16 2008/06/21 02:41:27 felipe 
 Exp $ */
 +/* $Id: php_reflection.c,v 1.164.2.33.2.45.2.17 2008/06/25 12:33:46 dmitry 
 Exp $ */
  
  #ifdef HAVE_CONFIG_H
  #include config.h
 @@ -2550,6 +2550,66 @@
  }
  /* }}} */
  
 +/* {{{ proto public bool ReflectionFunction::inNamespace()
 +   Returns whether this function is defined in namespace */
 +ZEND_METHOD(reflection_function, inNamespace)
 +{
 + zval **name;
 + char *colon;
 +
 + METHOD_NOTSTATIC_NUMPARAMS(reflection_function_abstract_ptr, 0);
 + if (zend_hash_find(Z_OBJPROP_P(getThis()), name, sizeof(name), 
 (void **) name) == FAILURE) {
 + RETURN_FALSE;
 + }
 + if (Z_TYPE_PP(name) == IS_STRING 
 + (colon = zend_memrchr(Z_STRVAL_PP(name), ':', Z_STRLEN_PP(name))) 
 + colon  Z_STRVAL_PP(name)  *(colon-1) == ':') {
 + RETURN_TRUE;
 +}
 + RETURN_FALSE;
 +}
 +/* }}} */
 +
 +/* {{{ proto public string ReflectionFunction::getNamespaceName()
 +   Returns the name of namespace where this function is defined */
 +ZEND_METHOD(reflection_function, getNamespaceName)
 +{
 + zval **name;
 + char *colon;
 +
 + METHOD_NOTSTATIC_NUMPARAMS(reflection_function_abstract_ptr, 0);
 + if (zend_hash_find(Z_OBJPROP_P(getThis()), name, sizeof(name), 
 (void **) name) == FAILURE) {
 + RETURN_FALSE;
 + }
 + if (Z_TYPE_PP(name) == IS_STRING 
 + (colon = zend_memrchr(Z_STRVAL_PP(name), ':', Z_STRLEN_PP(name))) 
 + colon  Z_STRVAL_PP(name)  *(colon-1) == ':') {
 + RETURN_STRINGL(Z_STRVAL_PP(name), colon - Z_STRVAL_PP(name) - 
 1, 1);
 +}
 + RETURN_EMPTY_STRING();
 +}
 +/* }}} */
 +
 +/* {{{ proto public string ReflectionFunction::getShortName()
 +   Returns the short name of the function (without namespace part) */
 +ZEND_METHOD(reflection_function, getShortName)
 +{
 + zval **name;
 + char *colon;
 +
 + METHOD_NOTSTATIC_NUMPARAMS(reflection_function_abstract_ptr, 0);
 + if (zend_hash_find(Z_OBJPROP_P(getThis()), name, sizeof(name), 
 (void **) name) == FAILURE) {
 + RETURN_FALSE;
 + }
 + if (Z_TYPE_PP(name) == IS_STRING 
 + (colon = zend_memrchr(Z_STRVAL_PP(name), ':', Z_STRLEN_PP(name))) 
 + colon  Z_STRVAL_PP(name)  *(colon-1) == ':') {
 + RETURN_STRINGL(colon + 1, Z_STRLEN_PP(name) - (colon - 
 Z_STRVAL_PP(name) + 1), 1);
 +}
 +RETURN_ZVAL(*name, 1, 0);
 +}
 +/* }}} */
 +
  /* {{{ proto public bool ReflectionMethod::isConstructor()
 Returns whether this method is the constructor */
  ZEND_METHOD(reflection_method, isConstructor)
 @@ -3760,6 +3820,66 @@
  }
  /* }}} */
  
 +/* {{{ proto public bool ReflectionClass::inNamespace()
 +   Returns whether this class is defined in namespace */
 +ZEND_METHOD(reflection_class, inNamespace)
 +{
 + zval **name;
 + char *colon;
 +
 + METHOD_NOTSTATIC_NUMPARAMS(reflection_class_ptr, 0);
 + if (zend_hash_find(Z_OBJPROP_P(getThis()), name, sizeof(name), 
 (void **) name) == FAILURE) {
 + RETURN_FALSE;
 + }
 + if (Z_TYPE_PP(name) == IS_STRING 
 + (colon = zend_memrchr(Z_STRVAL_PP(name), ':', Z_STRLEN_PP(name))) 
 + colon  Z_STRVAL_PP(name)  *(colon-1) == ':') {
 + RETURN_TRUE;
 +}
 + RETURN_FALSE;
 +}
 +/* }}} */
 +
 +/* {{{ proto public string ReflectionClass::getNamespaceName()
 +   Returns the name of namespace where this class is defined */
 +ZEND_METHOD(reflection_class, getNamespaceName)
 +{
 + zval **name;
 + char *colon;
 +
 + METHOD_NOTSTATIC_NUMPARAMS(reflection_class_ptr, 0);
 + if (zend_hash_find(Z_OBJPROP_P(getThis()), name, sizeof(name), 
 (void **) name) == FAILURE) {
 + RETURN_FALSE;
 + }
 + if (Z_TYPE_PP(name) == IS_STRING 
 + (colon = zend_memrchr(Z_STRVAL_PP(name), 

[PHP-CVS] cvs: php-src /ext/reflection/tests reflectionClass_getModifierNames_basic.phpt

2008-06-12 Thread Lars Strojny
lstrojnyThu Jun 12 20:30:46 2008 UTC

  Added files: 
/php-src/ext/reflection/tests   

reflectionClass_getModifierNames_basic.phpt 
  Log:
  Reflection::getModifierNames()-test by Felix De Vliegher (Testfest)
  
  

http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/tests/reflectionClass_getModifierNames_basic.phpt?view=markuprev=1.1
Index: php-src/ext/reflection/tests/reflectionClass_getModifierNames_basic.phpt
+++ php-src/ext/reflection/tests/reflectionClass_getModifierNames_basic.phpt
--TEST--
ReflectionClass::getModifierNames() basic tests
--CREDITS--
Felix De Vliegher [EMAIL PROTECTED]
--FILE--
?php

class a {}
abstract class b {}
final class c {}

class x
{
function __construct() {}
function __destruct() {}
private function a() {}
private static function b() {}
protected function c() {}
protected static function d() {}
public function e() {}
public static function f() {}
final function g() {}
function h() {}
}

abstract class y
{
abstract function a();
abstract protected function b();
}

function dump_modifierNames($class) {
$obj = new ReflectionClass($class);
var_dump($obj-getName(), 
Reflection::getModifierNames($obj-getModifiers()));
}

function dump_methodModifierNames($class) {
$obj = new ReflectionClass($class);
foreach($obj-getMethods() as $method) {
var_dump($obj-getName() . :: . $method-getName(), 
Reflection::getModifierNames($method-getModifiers()));
}
}

dump_modifierNames('a');
dump_modifierNames('b');
dump_modifierNames('c');

dump_methodModifierNames('x');
dump_methodModifierNames('y');

?
==DONE==
--EXPECT--
unicode(1) a
array(0) {
}
unicode(1) b
array(1) {
  [0]=
  unicode(8) abstract
}
unicode(1) c
array(1) {
  [0]=
  unicode(5) final
}
unicode(14) x::__construct
array(1) {
  [0]=
  unicode(6) public
}
unicode(13) x::__destruct
array(1) {
  [0]=
  unicode(6) public
}
unicode(4) x::a
array(1) {
  [0]=
  unicode(7) private
}
unicode(4) x::b
array(2) {
  [0]=
  unicode(7) private
  [1]=
  unicode(6) static
}
unicode(4) x::c
array(1) {
  [0]=
  unicode(9) protected
}
unicode(4) x::d
array(2) {
  [0]=
  unicode(9) protected
  [1]=
  unicode(6) static
}
unicode(4) x::e
array(1) {
  [0]=
  unicode(6) public
}
unicode(4) x::f
array(2) {
  [0]=
  unicode(6) public
  [1]=
  unicode(6) static
}
unicode(4) x::g
array(2) {
  [0]=
  unicode(5) final
  [1]=
  unicode(6) public
}
unicode(4) x::h
array(1) {
  [0]=
  unicode(6) public
}
unicode(4) y::a
array(2) {
  [0]=
  unicode(8) abstract
  [1]=
  unicode(6) public
}
unicode(4) y::b
array(2) {
  [0]=
  unicode(8) abstract
  [1]=
  unicode(9) protected
}
==DONE==



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



[PHP-CVS] cvs: php-src(PHP_5_3) /ext/reflection/tests reflectionClass_getModifierNames_basic.phpt

2008-06-12 Thread Lars Strojny
lstrojnyThu Jun 12 20:31:06 2008 UTC

  Added files: (Branch: PHP_5_3)
/php-src/ext/reflection/tests   

reflectionClass_getModifierNames_basic.phpt 
  Log:
  Reflection::getModifierNames()-test by Felix De Vliegher (Testfest)
  
  

http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/tests/reflectionClass_getModifierNames_basic.phpt?view=markuprev=1.1
Index: php-src/ext/reflection/tests/reflectionClass_getModifierNames_basic.phpt
+++ php-src/ext/reflection/tests/reflectionClass_getModifierNames_basic.phpt
--TEST--
ReflectionClass::getModifierNames() basic tests
--CREDITS--
Felix De Vliegher [EMAIL PROTECTED]
--FILE--
?php

class a {}
abstract class b {}
final class c {}

class x
{
function __construct() {}
function __destruct() {}
private function a() {}
private static function b() {}
protected function c() {}
protected static function d() {}
public function e() {}
public static function f() {}
final function g() {}
function h() {}
}

abstract class y
{
abstract function a();
abstract protected function b();
}

function dump_modifierNames($class) {
$obj = new ReflectionClass($class);
var_dump($obj-getName(), 
Reflection::getModifierNames($obj-getModifiers()));
}

function dump_methodModifierNames($class) {
$obj = new ReflectionClass($class);
foreach($obj-getMethods() as $method) {
var_dump($obj-getName() . :: . $method-getName(), 
Reflection::getModifierNames($method-getModifiers()));
}
}

dump_modifierNames('a');
dump_modifierNames('b');
dump_modifierNames('c');

dump_methodModifierNames('x');
dump_methodModifierNames('y');

?
==DONE==
--EXPECT--
unicode(1) a
array(0) {
}
unicode(1) b
array(1) {
  [0]=
  unicode(8) abstract
}
unicode(1) c
array(1) {
  [0]=
  unicode(5) final
}
unicode(14) x::__construct
array(1) {
  [0]=
  unicode(6) public
}
unicode(13) x::__destruct
array(1) {
  [0]=
  unicode(6) public
}
unicode(4) x::a
array(1) {
  [0]=
  unicode(7) private
}
unicode(4) x::b
array(2) {
  [0]=
  unicode(7) private
  [1]=
  unicode(6) static
}
unicode(4) x::c
array(1) {
  [0]=
  unicode(9) protected
}
unicode(4) x::d
array(2) {
  [0]=
  unicode(9) protected
  [1]=
  unicode(6) static
}
unicode(4) x::e
array(1) {
  [0]=
  unicode(6) public
}
unicode(4) x::f
array(2) {
  [0]=
  unicode(6) public
  [1]=
  unicode(6) static
}
unicode(4) x::g
array(2) {
  [0]=
  unicode(5) final
  [1]=
  unicode(6) public
}
unicode(4) x::h
array(1) {
  [0]=
  unicode(6) public
}
unicode(4) y::a
array(2) {
  [0]=
  unicode(8) abstract
  [1]=
  unicode(6) public
}
unicode(4) y::b
array(2) {
  [0]=
  unicode(8) abstract
  [1]=
  unicode(9) protected
}
==DONE==



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



  1   2   >