Re: [PHP-CVS] com php-src: Add optional depth parameter to json_encode #62369: ext/json/json.c ext/json/php_json.h ext/json/tests/bug62369.phpt

2012-07-26 Thread Florian Anderiasch

On 26.07.2012 14:14, Pierre Joye wrote:

Was it ever discussed?


afair we did not want to add that, back then when we discussed the
security issue related to huge input data.


Hi,
I hadn't seen any discussion apart from Laruence's change to FR so I 
went ahead and implemented it.


The default behavior is unchanged, I'm not really seeing how this is 
security relevant when in the bug it's going up to segfault and now you 
can limit it and get a real error.


It has no NEWS entry because when I asked dsp if that's something for 
5.4 I didn't get a yes or no - so I didn't update as I didn't know where.


Greetings,
Florian

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



[PHP-CVS] com php-src: Add syslog support to mail.log #62356: ext/standard/mail.c php.ini-development php.ini-production

2012-07-24 Thread Florian Anderiasch
Commit:ddc8d1624525e500c593f4cbd30b3358ad4ad95e
Author:Florian Anderiasch f...@php.net Tue, 24 Jul 2012 14:29:25 
+0200
Parents:   9fe8c58130ac82d2b52b35a290b71569abe50d18
Branches:  PHP-5.4 master

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

Log:
Add syslog support to mail.log #62356

Patch by Michael Orlitzky

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

Changed paths:
  M  ext/standard/mail.c
  M  php.ini-development
  M  php.ini-production


Diff:
diff --git a/ext/standard/mail.c b/ext/standard/mail.c
index 36568c5..0bbdebc 100644
--- a/ext/standard/mail.c
+++ b/ext/standard/mail.c
@@ -39,6 +39,7 @@
 #endif
 #endif
 
+#include php_syslog.h
 #include php_mail.h
 #include php_ini.h
 #include php_string.h
@@ -189,6 +190,37 @@ PHP_FUNCTION(mail)
 }
 /* }}} */
 
+
+void php_mail_log_crlf_to_spaces(char *message) {
+   /* Find all instances of carriage returns or line feeds and
+* replace them with spaces. Thus, a log line is always one line
+* long
+*/
+   char *p = message;
+   while ((p = strpbrk(p, \r\n))) {
+   *p = ' ';
+   }
+}
+
+void php_mail_log_to_syslog(char *message) {
+   /* Write 'message' to syslog. */
+#ifdef HAVE_SYSLOG_H
+   php_syslog(LOG_NOTICE, %s, message);
+#endif
+}
+
+
+void php_mail_log_to_file(char *filename, char *message, size_t message_size) {
+   /* Write 'message' to the given file. */
+   uint flags = IGNORE_URL_WIN | REPORT_ERRORS | 
STREAM_DISABLE_OPEN_BASEDIR;
+   php_stream *stream = php_stream_open_wrapper(filename, a, flags, 
NULL);
+   if (stream) {
+   php_stream_write(stream, message, message_size);
+   php_stream_close(stream);
+   }
+}
+
+
 /* {{{ php_mail
  */
 PHPAPI int php_mail(char *to, char *subject, char *message, char *headers, 
char *extra_cmd TSRMLS_DC)
@@ -216,19 +248,22 @@ PHPAPI int php_mail(char *to, char *subject, char 
*message, char *headers, char
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 : );
-   php_stream *stream = php_stream_open_wrapper(mail_log, a, 
IGNORE_URL_WIN | REPORT_ERRORS | STREAM_DISABLE_OPEN_BASEDIR, NULL);
 
-   if (hdr) { /* find all \r\n instances and replace them with 
spaces, so a log line is always one line long */ 
-   char *p = tmp;
-   while ((p = strpbrk(p, \r\n))) {
-   *p = ' ';
-   }
-   tmp[l - 1] = '\n';
+   if (hdr) {
+   php_mail_log_crlf_to_spaces(tmp);
}
-   if (stream) {
-   php_stream_write(stream, tmp, l);
-   php_stream_close(stream);
+
+   if (!strcmp(mail_log, syslog)) {
+   /* Drop the final space when logging to syslog. */
+   tmp[l - 1] = 0;
+   php_mail_log_to_syslog(tmp);
+   }
+   else {
+   /* Convert the final space to a newline when logging to 
file. */
+   tmp[l - 1] = '\n';
+   php_mail_log_to_file(mail_log, tmp, l);
}
+
efree(tmp);
}
if (PG(mail_x_header)) {
diff --git a/php.ini-development b/php.ini-development
index 298cb06..4ff4192 100644
--- a/php.ini-development
+++ b/php.ini-development
@@ -1020,6 +1020,8 @@ mail.add_x_header = On
 ; The path to a log file that will log all mail() calls. Log entries include
 ; the full path of the script, line number, To address and headers.
 ;mail.log =
+; Log mail to syslog (Event Log on NT, not valid in Windows 95).
+;mail.log = syslog
 
 [SQL]
 ; http://php.net/sql.safe-mode
diff --git a/php.ini-production b/php.ini-production
index d4c1261..814455b 100644
--- a/php.ini-production
+++ b/php.ini-production
@@ -1020,6 +1020,8 @@ mail.add_x_header = On
 ; The path to a log file that will log all mail() calls. Log entries include
 ; the full path of the script, line number, To address and headers.
 ;mail.log =
+; Log mail to syslog (Event Log on NT, not valid in Windows 95).
+;mail.log = syslog
 
 [SQL]
 ; http://php.net/sql.safe-mode


--
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': php.ini-development php.ini-production

2012-07-24 Thread Florian Anderiasch
Commit:81de31884d219645e4128e3dd57db8edbf5c
Author:Florian Anderiasch f...@php.net Tue, 24 Jul 2012 14:34:41 
+0200
Parents:   45d596ea1e32792c7b7b7f28be220dea861b6708 
ddc8d1624525e500c593f4cbd30b3358ad4ad95e
Branches:  master

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

Log:
Merge branch 'PHP-5.4'

* PHP-5.4:
  Add syslog support to mail.log #62356

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

Changed paths:
  MM  php.ini-development
  MM  php.ini-production


Diff:



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



[PHP-CVS] com php-src: Add optional depth parameter to json_encode #62369: ext/json/json.c ext/json/php_json.h ext/json/tests/bug62369.phpt

2012-07-24 Thread Florian Anderiasch
Commit:45d596ea1e32792c7b7b7f28be220dea861b6708
Author:Florian Anderiasch f...@php.net Tue, 24 Jul 2012 13:15:16 
+0200
Parents:   dd9d64b21e4bbc8a106a6156dc6ffefbcc33ec02
Branches:  master

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

Log:
Add optional depth parameter to json_encode #62369

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

Changed paths:
  M  ext/json/json.c
  M  ext/json/php_json.h
  A  ext/json/tests/bug62369.phpt


Diff:
diff --git a/ext/json/json.c b/ext/json/json.c
index 9669047..dab4230 100644
--- a/ext/json/json.c
+++ b/ext/json/json.c
@@ -47,6 +47,7 @@ ZEND_DECLARE_MODULE_GLOBALS(json)
 ZEND_BEGIN_ARG_INFO_EX(arginfo_json_encode, 0, 0, 1)
ZEND_ARG_INFO(0, value)
ZEND_ARG_INFO(0, options)
+   ZEND_ARG_INFO(0, depth)
 ZEND_END_ARG_INFO()
 
 ZEND_BEGIN_ARG_INFO_EX(arginfo_json_decode, 0, 0, 1)
@@ -126,6 +127,7 @@ static PHP_GINIT_FUNCTION(json)
 {
json_globals-encoder_depth = 0;
json_globals-error_code = 0;
+   json_globals-encode_max_depth = 0;
 }
 /* }}} */
 
@@ -341,6 +343,9 @@ static void json_encode_array(smart_str *buf, zval **val, 
int options TSRMLS_DC)
}
}
 
+   if (JSON_G(encoder_depth)  JSON_G(encode_max_depth)) {
+   JSON_G(error_code) = PHP_JSON_ERROR_DEPTH;
+   }
--JSON_G(encoder_depth);
json_pretty_print_char(buf, options, '\n' TSRMLS_CC);
json_pretty_print_indent(buf, options TSRMLS_CC);
@@ -702,13 +707,16 @@ static PHP_FUNCTION(json_encode)
zval *parameter;
smart_str buf = {0};
long options = 0;
+long depth = JSON_PARSER_DEFAULT_DEPTH;
 
-   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, z|l, parameter, 
options) == FAILURE) {
+   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, z|ll, 
parameter, options, depth) == FAILURE) {
return;
}
 
JSON_G(error_code) = PHP_JSON_ERROR_NONE;
 
+   JSON_G(encode_max_depth) = depth;
+
php_json_encode(buf, parameter, options TSRMLS_CC);
 
if (JSON_G(error_code) != PHP_JSON_ERROR_NONE  !(options  
PHP_JSON_PARTIAL_OUTPUT_ON_ERROR)) {
diff --git a/ext/json/php_json.h b/ext/json/php_json.h
index afeff3f..2b3cf58 100644
--- a/ext/json/php_json.h
+++ b/ext/json/php_json.h
@@ -40,6 +40,7 @@ extern zend_module_entry json_module_entry;
 ZEND_BEGIN_MODULE_GLOBALS(json)
int encoder_depth;
int error_code;
+   int encode_max_depth;
 ZEND_END_MODULE_GLOBALS(json)
 
 #ifdef ZTS
diff --git a/ext/json/tests/bug62369.phpt b/ext/json/tests/bug62369.phpt
new file mode 100644
index 000..a5efd80
--- /dev/null
+++ b/ext/json/tests/bug62369.phpt
@@ -0,0 +1,34 @@
+--TEST--
+FR #62369 (Segfault on json_encode(deeply_nested_array)
+--SKIPIF--
+?php if (!extension_loaded(json)) print skip; ?
+--FILE--
+?php
+
+$array = array();
+for ($i=0; $i550; $i++) {
+$array = array($array);
+}
+
+json_encode($array, 0, 551);
+switch (json_last_error()) {
+case JSON_ERROR_NONE:
+echo 'OK'.PHP_EOL;
+break;
+case JSON_ERROR_DEPTH:
+echo 'ERROR'.PHP_EOL;
+break;
+}
+
+json_encode($array, 0, 540);
+switch (json_last_error()) {
+case JSON_ERROR_NONE:
+echo 'OK'.PHP_EOL;
+break;
+case JSON_ERROR_DEPTH:
+echo 'ERROR'.PHP_EOL;
+break;
+}
+--EXPECTF--
+OK
+ERROR


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



[PHP-CVS] com php-src: Updated NES: NEWS

2012-07-24 Thread Florian Anderiasch
Commit:f2cef8afc499ede08e935449030595933d070c5e
Author:Florian Anderiasch f...@php.net Tue, 24 Jul 2012 14:46:19 
+0200
Parents:   ddc8d1624525e500c593f4cbd30b3358ad4ad95e
Branches:  PHP-5.4

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

Log:
Updated NES

Changed paths:
  M  NEWS


Diff:
diff --git a/NEWS b/NEWS
index 883d910..0df6970 100644
--- a/NEWS
+++ b/NEWS
@@ -21,6 +21,9 @@ PHP   
 NEWS
   . Fixed bug #62564 (Extending MessageFormatter and adding property causes 
 crash). (Felipe)
 
+- Mail:
+  . Fixed bug #62356 (Add syslog support to mail.log). (Michael Orlitzky)
+
 - MySQLnd:
   . Fixed bug #62594 (segfault in mysqlnd_res_meta::set_mode). (Laruence)


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



[PHP-CVS] com karma: Fix format of the bugsweb post: hooks/post-receive.bugsweb

2012-03-21 Thread Florian Anderiasch
Commit:228b3322b737e364c3cbaf37567142768e015f92
Author:Florian Anderiasch f...@php.net Wed, 21 Mar 2012 15:07:54 
+0100
Parents:   bacc09d8928b6a04b9e8337d089eebd96f4a795d
Branches:  master

Link:   
http://git.php.net/?p=karma.git;a=commitdiff;h=228b3322b737e364c3cbaf37567142768e015f92

Log:
Fix format of the bugsweb post

Changed paths:
  M  hooks/post-receive.bugsweb


Diff:
228b3322b737e364c3cbaf37567142768e015f92
diff --git a/hooks/post-receive.bugsweb b/hooks/post-receive.bugsweb
index 683ffe2..6bf432e 100755
--- a/hooks/post-receive.bugsweb
+++ b/hooks/post-receive.bugsweb
@@ -71,8 +71,9 @@ foreach ($rpath as $commit) {
 $commit_info = array();
 $commit_info['log_message'] = $commitMsg;
 $commit_info['author'] = $committer;
+$commit_info['author'] = preg_replace(#@php\.net$#, , $committer);
 $viewvc_url_prefix = sprintf(
-'http://git.php.net/?p=%s.git;a=commit;h=',
+'http://git.php.net/?p=%s;a=commit;h=',
 $hook-getRepositoryName()
 );
 $REV = $commitHash;


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



[PHP-CVS] com karma: Add dsp's multi-STDIN fix: hooks/post-receive

2012-03-21 Thread Florian Anderiasch
Commit:89727c1b8c23217fafd72f06664648f350b0e525
Author:Florian Anderiasch f...@php.net Wed, 21 Mar 2012 15:22:34 
+0100
Parents:   ce38e2cad55e0530306df767261624505f9bf448
Branches:  master

Link:   
http://git.php.net/?p=karma.git;a=commitdiff;h=89727c1b8c23217fafd72f06664648f350b0e525

Log:
Add dsp's multi-STDIN fix

Changed paths:
  M  hooks/post-receive


Diff:
89727c1b8c23217fafd72f06664648f350b0e525
diff --git a/hooks/post-receive b/hooks/post-receive
index 2016acb..74fce6b 100755
--- a/hooks/post-receive
+++ b/hooks/post-receive
@@ -1,4 +1,5 @@
 #!/bin/sh
-[ -f 'hooks/post-receive.mail' ] hooks/post-receive.mail
-[ -f 'hooks/post-receive.bugsweb' ]  hooks/post-receive.bugsweb
+in=$(cat)
+[ -f 'hooks/post-receive.mail' ] (echo $in | hooks/post-receive.mail )
+[ -f 'hooks/post-receive.bugsweb' ]  (echo $in | hooks/post-receive.bugsweb )
 [ -f 'hooks/post-receive.mirror' ]   hooks/post-receive.mirror


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



[PHP-CVS] com karma: Fix the bugsweb POST template: hooks/post-receive.bugsweb

2012-03-21 Thread Florian Anderiasch
Commit:d7109df39a028fec7e5603073147647b471c9b8a
Author:Florian Anderiasch f...@php.net Wed, 21 Mar 2012 15:30:32 
+0100
Parents:   89727c1b8c23217fafd72f06664648f350b0e525
Branches:  master

Link:   
http://git.php.net/?p=karma.git;a=commitdiff;h=d7109df39a028fec7e5603073147647b471c9b8a

Log:
Fix the bugsweb POST template

Changed paths:
  M  hooks/post-receive.bugsweb


Diff:
d7109df39a028fec7e5603073147647b471c9b8a
diff --git a/hooks/post-receive.bugsweb b/hooks/post-receive.bugsweb
index 6bf432e..030997c 100755
--- a/hooks/post-receive.bugsweb
+++ b/hooks/post-receive.bugsweb
@@ -17,9 +17,6 @@ include 'Git/PushInformation.php';
 include 'Git/ReceiveHook.php';
 include 'Git/BugsWebPostReceiveHook.php';
 
-$recipients = exec('git config hooks.mailinglist');
-$emailPrefix = exec('git config hooks.emailprefix') ?: '[git]';
-
 $user = null;
 if (getenv('REMOTE_USER')) {
 $user = getenv('REMOTE_USER');
@@ -28,13 +25,10 @@ if (getenv('REMOTE_USER')) {
 $user = getenv('GL_USER');
 }
 
-$hook = new \Git\BugsWebPostReceiveHook(KARMA_FILE, REPOSITORY_PATH);
-$rpath = $hook-getReceivedMessages(
-getenv('GL_REPO_BASE_ABS') ?: REPOSITORY_PATH,
-$user,
-getenv('USERS_DB_FILE') ?: USERS_DB_FILE,
-$recipients,
-$emailPrefix);
+$hook = new \Git\BugsWebPostReceiveHook(
+getenv('GL_REPO_BASE_ABS') ?: REPOSITORY_PATH
+);
+$rpath = $hook-getReceivedMessages();
 
 $template = Automatic comment from GIT on behalf of %s
 Revision: http://git.php.net/%s


--
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_3/README.SVN-RULES branches/PHP_5_4/README.SVN-RULES trunk/README.SVN-RULES

2011-11-14 Thread Florian Anderiasch
fa   Mon, 14 Nov 2011 15:39:35 +

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

Log:
Fixed a typo in README.SVN-RULES.

Changed paths:
U   php/php-src/branches/PHP_5_3/README.SVN-RULES
U   php/php-src/branches/PHP_5_4/README.SVN-RULES
U   php/php-src/trunk/README.SVN-RULES

Modified: php/php-src/branches/PHP_5_3/README.SVN-RULES
===
--- php/php-src/branches/PHP_5_3/README.SVN-RULES   2011-11-14 15:17:09 UTC 
(rev 319173)
+++ php/php-src/branches/PHP_5_3/README.SVN-RULES   2011-11-14 15:39:35 UTC 
(rev 319174)
@@ -39,7 +39,7 @@
   To do so use make test.

7. For development use the --enable-maintainer-zts switch to ensure your
-  code handles TSRM correctly and doesn't break for thos who need that.
+  code handles TSRM correctly and doesn't break for those who need that.

 Currently we have the following branches in use::


Modified: php/php-src/branches/PHP_5_4/README.SVN-RULES
===
--- php/php-src/branches/PHP_5_4/README.SVN-RULES   2011-11-14 15:17:09 UTC 
(rev 319173)
+++ php/php-src/branches/PHP_5_4/README.SVN-RULES   2011-11-14 15:39:35 UTC 
(rev 319174)
@@ -39,7 +39,7 @@
   To do so use make test.

7. For development use the --enable-maintainer-zts switch to ensure your
-  code handles TSRM correctly and doesn't break for thos who need that.
+  code handles TSRM correctly and doesn't break for those who need that.

 Currently we have the following branches in use::


Modified: php/php-src/trunk/README.SVN-RULES
===
--- php/php-src/trunk/README.SVN-RULES  2011-11-14 15:17:09 UTC (rev 319173)
+++ php/php-src/trunk/README.SVN-RULES  2011-11-14 15:39:35 UTC (rev 319174)
@@ -39,7 +39,7 @@
   To do so use make test.

7. For development use the --enable-maintainer-zts switch to ensure your
-  code handles TSRM correctly and doesn't break for thos who need that.
+  code handles TSRM correctly and doesn't break for those who need that.

 Currently we have the following branches in use::


-- 
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_3/ext/intl/collator/collator_compare.c branches/PHP_5_3/ext/intl/collator/collator_locale.c branches/PHP_5_3/ext/intl/collator/collator_sort.c branches/PHP_

2011-11-03 Thread Florian Anderiasch
fa   Thu, 03 Nov 2011 16:20:11 +

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

Log:
Redid the fix for #60192 with suggestions by Pierre and Kalle

Bug: https://bugs.php.net/60192 (Closed) SegFault when Collator not constructed 
properly
  
Changed paths:
U   php/php-src/branches/PHP_5_3/ext/intl/collator/collator_compare.c
U   php/php-src/branches/PHP_5_3/ext/intl/collator/collator_locale.c
U   php/php-src/branches/PHP_5_3/ext/intl/collator/collator_sort.c
U   php/php-src/branches/PHP_5_3/ext/intl/tests/bug60192-compare.phpt
U   php/php-src/branches/PHP_5_3/ext/intl/tests/bug60192-getlocale.phpt
U   php/php-src/branches/PHP_5_3/ext/intl/tests/bug60192-getsortkey.phpt
U   php/php-src/branches/PHP_5_3/ext/intl/tests/bug60192-sort.phpt
U   
php/php-src/branches/PHP_5_3/ext/intl/tests/bug60192-sortwithsortkeys.phpt
U   php/php-src/branches/PHP_5_4/ext/intl/collator/collator_compare.c
U   php/php-src/branches/PHP_5_4/ext/intl/collator/collator_locale.c
U   php/php-src/branches/PHP_5_4/ext/intl/collator/collator_sort.c
U   php/php-src/branches/PHP_5_4/ext/intl/tests/bug60192-compare.phpt
U   php/php-src/branches/PHP_5_4/ext/intl/tests/bug60192-getlocale.phpt
U   php/php-src/branches/PHP_5_4/ext/intl/tests/bug60192-getsortkey.phpt
U   php/php-src/branches/PHP_5_4/ext/intl/tests/bug60192-sort.phpt
U   
php/php-src/branches/PHP_5_4/ext/intl/tests/bug60192-sortwithsortkeys.phpt
U   php/php-src/trunk/ext/intl/collator/collator_compare.c
U   php/php-src/trunk/ext/intl/collator/collator_locale.c
U   php/php-src/trunk/ext/intl/collator/collator_sort.c
U   php/php-src/trunk/ext/intl/tests/bug60192-compare.phpt
U   php/php-src/trunk/ext/intl/tests/bug60192-getlocale.phpt
U   php/php-src/trunk/ext/intl/tests/bug60192-getsortkey.phpt
U   php/php-src/trunk/ext/intl/tests/bug60192-sort.phpt
U   php/php-src/trunk/ext/intl/tests/bug60192-sortwithsortkeys.phpt

Modified: php/php-src/branches/PHP_5_3/ext/intl/collator/collator_compare.c
===
--- php/php-src/branches/PHP_5_3/ext/intl/collator/collator_compare.c	2011-11-03 15:47:19 UTC (rev 318743)
+++ php/php-src/branches/PHP_5_3/ext/intl/collator/collator_compare.c	2011-11-03 16:20:11 UTC (rev 318744)
@@ -58,7 +58,15 @@
 	/* Fetch the object. */
 	COLLATOR_METHOD_FETCH_OBJECT;

+	if (!co || !co-ucoll) {
+		intl_error_set_code( NULL, COLLATOR_ERROR_CODE( co ) TSRMLS_CC );
+		intl_errors_set_custom_msg( COLLATOR_ERROR_P( co ),
+			Object not initialized, 0 TSRMLS_CC );
+		php_error_docref(NULL TSRMLS_CC, E_RECOVERABLE_ERROR, Object not initialized);

+		RETURN_FALSE;
+	}
+
 	/*
 	 * Compare given strings (converting them to UTF-16 first).
 	 */
@@ -99,10 +107,6 @@
 		RETURN_FALSE;
 	}

-	if (!co || !co-ucoll) {
-		php_error_docref(NULL TSRMLS_CC, E_ERROR, Object not initialized);
-	}
-
 	/* Then compare them. */
 	result = ucol_strcoll(
 		co-ucoll,

Modified: php/php-src/branches/PHP_5_3/ext/intl/collator/collator_locale.c
===
--- php/php-src/branches/PHP_5_3/ext/intl/collator/collator_locale.c	2011-11-03 15:47:19 UTC (rev 318743)
+++ php/php-src/branches/PHP_5_3/ext/intl/collator/collator_locale.c	2011-11-03 16:20:11 UTC (rev 318744)
@@ -52,7 +52,12 @@
 	COLLATOR_METHOD_FETCH_OBJECT;

 	if (!co || !co-ucoll) {
-		php_error_docref(NULL TSRMLS_CC, E_ERROR, Object not initialized);
+		intl_error_set_code( NULL, COLLATOR_ERROR_CODE( co ) TSRMLS_CC );
+		intl_errors_set_custom_msg( COLLATOR_ERROR_P( co ),
+			Object not initialized, 0 TSRMLS_CC );
+		php_error_docref(NULL TSRMLS_CC, E_RECOVERABLE_ERROR, Object not initialized);
+
+		RETURN_FALSE;
 	}

 	/* Get locale by specified type. */

Modified: php/php-src/branches/PHP_5_3/ext/intl/collator/collator_sort.c
===
--- php/php-src/branches/PHP_5_3/ext/intl/collator/collator_sort.c	2011-11-03 15:47:19 UTC (rev 318743)
+++ php/php-src/branches/PHP_5_3/ext/intl/collator/collator_sort.c	2011-11-03 16:20:11 UTC (rev 318744)
@@ -74,7 +74,10 @@
 		co = (Collator_object *) zend_object_store_get_object( INTL_G(current_collator) TSRMLS_CC );

 		if (!co || !co-ucoll) {
-			php_error_docref(NULL TSRMLS_CC, E_ERROR, Object not initialized);
+			intl_error_set_code( NULL, COLLATOR_ERROR_CODE( co ) TSRMLS_CC );
+			intl_errors_set_custom_msg( COLLATOR_ERROR_P( co ),
+Object not initialized, 0 TSRMLS_CC );
+			php_error_docref(NULL TSRMLS_CC, E_RECOVERABLE_ERROR, Object not initialized);
 		}

 		/* Compare the strings using ICU. */
@@ -391,7 +394,15 @@
 	/* Fetch the object. */
 	COLLATOR_METHOD_FETCH_OBJECT;

+	if (!co || !co-ucoll) {
+		intl_error_set_code( NULL, COLLATOR_ERROR_CODE( co ) TSRMLS_CC );
+		intl_errors_set_custom_msg( COLLATOR_ERROR_P( co ),
+			Object not initialized, 0 TSRMLS_CC 

[PHP-CVS] svn: /php/php-src/branches/PHP_5_3/ NEWS

2011-11-03 Thread Florian Anderiasch
fa   Thu, 03 Nov 2011 16:23:48 +

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

Log:
Added info to 2 fixed bugs

Changed paths:
U   php/php-src/branches/PHP_5_3/NEWS

Modified: php/php-src/branches/PHP_5_3/NEWS
===
--- php/php-src/branches/PHP_5_3/NEWS   2011-11-03 16:20:11 UTC (rev 318744)
+++ php/php-src/branches/PHP_5_3/NEWS   2011-11-03 16:23:48 UTC (rev 318745)
@@ -5,7 +5,15 @@
 - PHP-FPM SAPI:
   . Fixed bug #60179 (php_flag and php_value does not work properly). (fat)

+- Intl:
+  . Fixed bug #60192 (SegFault when Collator not constructed
+properly). (Florian)

+- Gd:
+  . Fixed bug #60160 (imagefill() doesn't work correctly
+for small images). (Florian)
+
+
 03 Nov 2011, PHP 5.3.9RC1

 - Core:

-- 
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_3/ext/intl/collator/collator_compare.c branches/PHP_5_3/ext/intl/collator/collator_locale.c branches/PHP_5_3/ext/intl/collator/collator_sort.c branches/PHP_

2011-11-02 Thread Florian Anderiasch
fa   Wed, 02 Nov 2011 07:36:52 +

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

Log:
Fix #60192 SegFault when Collator not constructed properly

Bug: https://bugs.php.net/60192 (Assigned) SegFault when Collator not 
constructed properly
  
Changed paths:
U   php/php-src/branches/PHP_5_3/ext/intl/collator/collator_compare.c
U   php/php-src/branches/PHP_5_3/ext/intl/collator/collator_locale.c
U   php/php-src/branches/PHP_5_3/ext/intl/collator/collator_sort.c
A   php/php-src/branches/PHP_5_3/ext/intl/tests/bug60192-compare.phpt
A   php/php-src/branches/PHP_5_3/ext/intl/tests/bug60192-getlocale.phpt
A   php/php-src/branches/PHP_5_3/ext/intl/tests/bug60192-getsortkey.phpt
A   php/php-src/branches/PHP_5_3/ext/intl/tests/bug60192-sort.phpt
A   
php/php-src/branches/PHP_5_3/ext/intl/tests/bug60192-sortwithsortkeys.phpt
U   php/php-src/branches/PHP_5_4/ext/intl/collator/collator_compare.c
U   php/php-src/branches/PHP_5_4/ext/intl/collator/collator_locale.c
U   php/php-src/branches/PHP_5_4/ext/intl/collator/collator_sort.c
A   php/php-src/branches/PHP_5_4/ext/intl/tests/bug60192-compare.phpt
A   php/php-src/branches/PHP_5_4/ext/intl/tests/bug60192-getlocale.phpt
A   php/php-src/branches/PHP_5_4/ext/intl/tests/bug60192-getsortkey.phpt
A   php/php-src/branches/PHP_5_4/ext/intl/tests/bug60192-sort.phpt
A   
php/php-src/branches/PHP_5_4/ext/intl/tests/bug60192-sortwithsortkeys.phpt
U   php/php-src/trunk/ext/intl/collator/collator_compare.c
U   php/php-src/trunk/ext/intl/collator/collator_locale.c
U   php/php-src/trunk/ext/intl/collator/collator_sort.c
A   php/php-src/trunk/ext/intl/tests/bug60192-compare.phpt
A   php/php-src/trunk/ext/intl/tests/bug60192-getlocale.phpt
A   php/php-src/trunk/ext/intl/tests/bug60192-getsortkey.phpt
A   php/php-src/trunk/ext/intl/tests/bug60192-sort.phpt
A   php/php-src/trunk/ext/intl/tests/bug60192-sortwithsortkeys.phpt

Modified: php/php-src/branches/PHP_5_3/ext/intl/collator/collator_compare.c
===
--- php/php-src/branches/PHP_5_3/ext/intl/collator/collator_compare.c	2011-11-02 06:31:33 UTC (rev 318671)
+++ php/php-src/branches/PHP_5_3/ext/intl/collator/collator_compare.c	2011-11-02 07:36:52 UTC (rev 318672)
@@ -99,6 +99,10 @@
 		RETURN_FALSE;
 	}

+	if (!co || !co-ucoll) {
+		php_error_docref(NULL TSRMLS_CC, E_ERROR, Object not initialized);
+	}
+
 	/* Then compare them. */
 	result = ucol_strcoll(
 		co-ucoll,

Modified: php/php-src/branches/PHP_5_3/ext/intl/collator/collator_locale.c
===
--- php/php-src/branches/PHP_5_3/ext/intl/collator/collator_locale.c	2011-11-02 06:31:33 UTC (rev 318671)
+++ php/php-src/branches/PHP_5_3/ext/intl/collator/collator_locale.c	2011-11-02 07:36:52 UTC (rev 318672)
@@ -51,6 +51,10 @@
 	/* Fetch the object. */
 	COLLATOR_METHOD_FETCH_OBJECT;

+	if (!co || !co-ucoll) {
+		php_error_docref(NULL TSRMLS_CC, E_ERROR, Object not initialized);
+	}
+
 	/* Get locale by specified type. */
 	locale_name = (char*) ucol_getLocaleByType(
 		co-ucoll, type, COLLATOR_ERROR_CODE_P( co ) );

Modified: php/php-src/branches/PHP_5_3/ext/intl/collator/collator_sort.c
===
--- php/php-src/branches/PHP_5_3/ext/intl/collator/collator_sort.c	2011-11-02 06:31:33 UTC (rev 318671)
+++ php/php-src/branches/PHP_5_3/ext/intl/collator/collator_sort.c	2011-11-02 07:36:52 UTC (rev 318672)
@@ -73,6 +73,10 @@
 		/* Fetch collator object. */
 		co = (Collator_object *) zend_object_store_get_object( INTL_G(current_collator) TSRMLS_CC );

+		if (!co || !co-ucoll) {
+			php_error_docref(NULL TSRMLS_CC, E_ERROR, Object not initialized);
+		}
+
 		/* Compare the strings using ICU. */
 		result-value.lval = ucol_strcoll(
 co-ucoll,
@@ -441,6 +445,10 @@
 		/* Get sort key, reallocating the buffer if needed. */
 		bufLeft = sortKeyBufSize - sortKeyBufOffset;

+		if (!co || !co-ucoll) {
+			php_error_docref(NULL TSRMLS_CC, E_ERROR, Object not initialized);
+		}
+
 		sortKeyLen = ucol_getSortKey( co-ucoll,
 	  utf16_buf,
 	  utf16_len,
@@ -571,6 +579,10 @@
 		RETURN_FALSE;
 	}

+	if (!co || !co-ucoll) {
+		php_error_docref(NULL TSRMLS_CC, E_ERROR, Object not initialized);
+	}
+
 	key_len = ucol_getSortKey(co-ucoll, ustr, ustr_len, key, 0);
 	if(!key_len) {
 		efree( ustr );

Added: php/php-src/branches/PHP_5_3/ext/intl/tests/bug60192-compare.phpt
===
--- php/php-src/branches/PHP_5_3/ext/intl/tests/bug60192-compare.phpt	(rev 0)
+++ php/php-src/branches/PHP_5_3/ext/intl/tests/bug60192-compare.phpt	2011-11-02 07:36:52 UTC (rev 318672)
@@ -0,0 +1,20 @@
+--TEST--
+Bug #60192 (SegFault when Collator not constructed properly)
+--SKIPIF--
+?php
+	if 

[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/gd/libgd/gd.c branches/PHP_5_3/ext/gd/tests/bug60160.phpt branches/PHP_5_4/ext/gd/libgd/gd.c branches/PHP_5_4/ext/gd/tests/bug60160.phpt trunk/ext/gd/

2011-11-01 Thread Florian Anderiasch
fa   Tue, 01 Nov 2011 11:51:53 +

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

Log:
Fixed #60160 and added a test for it

Bug: https://bugs.php.net/60160 (Analyzed) imagefill() doesn't work correctly 
for small images
  
Changed paths:
U   php/php-src/branches/PHP_5_3/ext/gd/libgd/gd.c
A   php/php-src/branches/PHP_5_3/ext/gd/tests/bug60160.phpt
U   php/php-src/branches/PHP_5_4/ext/gd/libgd/gd.c
A   php/php-src/branches/PHP_5_4/ext/gd/tests/bug60160.phpt
U   php/php-src/trunk/ext/gd/libgd/gd.c
A   php/php-src/trunk/ext/gd/tests/bug60160.phpt

Modified: php/php-src/branches/PHP_5_3/ext/gd/libgd/gd.c
===
--- php/php-src/branches/PHP_5_3/ext/gd/libgd/gd.c  2011-11-01 10:25:47 UTC 
(rev 318637)
+++ php/php-src/branches/PHP_5_3/ext/gd/libgd/gd.c  2011-11-01 11:51:53 UTC 
(rev 318638)
@@ -1894,19 +1894,14 @@
if (im-sx  4) {
int ix = x, iy = y, c;
do {
-   c = gdImageGetPixel(im, ix, iy);
-   if (c != oc) {
-   goto done;
-   }
-   gdImageSetPixel(im, ix, iy, nc);
-   } while(ix++  (im-sx -1));
-   ix = x; iy = y + 1;
-   do {
-   c = gdImageGetPixel(im, ix, iy);
-   if (c != oc) {
-   goto done;
-   }
-   gdImageSetPixel(im, ix, iy, nc);
+   do {
+   c = gdImageGetPixel(im, ix, iy);
+   if (c != oc) {
+   goto done;
+   }
+   gdImageSetPixel(im, ix, iy, nc);
+   } while(ix++  (im-sx -1));
+   ix = x;
} while(iy++  (im-sy -1));
goto done;
}

Added: php/php-src/branches/PHP_5_3/ext/gd/tests/bug60160.phpt
===
--- php/php-src/branches/PHP_5_3/ext/gd/tests/bug60160.phpt 
(rev 0)
+++ php/php-src/branches/PHP_5_3/ext/gd/tests/bug60160.phpt 2011-11-01 
11:51:53 UTC (rev 318638)
@@ -0,0 +1,26 @@
+--TEST--
+Bug #60160 (imagefill does not work correctly for small images) @see bug51671
+--SKIPIF--
+?php
+   if(!extension_loaded('gd')){ die('skip gd extension not available'); }
+?
+--FILE--
+?php
+$w = 3;
+$h = 50;
+$im = imagecreatetruecolor($w, $h);
+$white = imagecolorallocate($im, 255, 255, 255);
+imagefill($im, 0, 0, $white);
+
+for ($ix = 0; $ix  $w; $ix++) {
+for ($iy = 0; $iy  $h; $iy++) {
+if (($c = imagecolorat($im, $ix, $iy)) != $white) {
+printf(Failed, ($ix, $iy) is %X\n, $c);
+}
+}
+}
+
+echo OK\n;
+?
+--EXPECTF--
+OK

Modified: php/php-src/branches/PHP_5_4/ext/gd/libgd/gd.c
===
--- php/php-src/branches/PHP_5_4/ext/gd/libgd/gd.c  2011-11-01 10:25:47 UTC 
(rev 318637)
+++ php/php-src/branches/PHP_5_4/ext/gd/libgd/gd.c  2011-11-01 11:51:53 UTC 
(rev 318638)
@@ -1894,19 +1894,14 @@
if (im-sx  4) {
int ix = x, iy = y, c;
do {
-   c = gdImageGetPixel(im, ix, iy);
-   if (c != oc) {
-   goto done;
-   }
-   gdImageSetPixel(im, ix, iy, nc);
-   } while(ix++  (im-sx -1));
-   ix = x; iy = y + 1;
-   do {
-   c = gdImageGetPixel(im, ix, iy);
-   if (c != oc) {
-   goto done;
-   }
-   gdImageSetPixel(im, ix, iy, nc);
+   do {
+   c = gdImageGetPixel(im, ix, iy);
+   if (c != oc) {
+   goto done;
+   }
+   gdImageSetPixel(im, ix, iy, nc);
+   } while(ix++  (im-sx -1));
+   ix = x;
} while(iy++  (im-sy -1));
goto done;
}

Added: php/php-src/branches/PHP_5_4/ext/gd/tests/bug60160.phpt
===
--- php/php-src/branches/PHP_5_4/ext/gd/tests/bug60160.phpt 
(rev 0)
+++ php/php-src/branches/PHP_5_4/ext/gd/tests/bug60160.phpt 2011-11-01 
11:51:53 UTC (rev 318638)
@@ -0,0 +1,26 @@
+--TEST--
+Bug #60160 (imagefill does not work correctly for small images) @see bug51671
+--SKIPIF--
+?php
+   if(!extension_loaded('gd')){ die('skip gd extension not available'); }
+?
+--FILE--
+?php

[PHP-CVS] svn: /php/php-src/trunk/ext/sockets/tests/ socket_strerror.phpt

2011-09-06 Thread Florian Anderiasch
fa   Tue, 06 Sep 2011 09:56:13 +

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

Log:
Fixed ext/sockets/tests/socket_strerror.phpt

So it seems a missing ) killed the test.

Changed paths:
U   php/php-src/trunk/ext/sockets/tests/socket_strerror.phpt

Modified: php/php-src/trunk/ext/sockets/tests/socket_strerror.phpt
===
--- php/php-src/trunk/ext/sockets/tests/socket_strerror.phpt2011-09-06 
09:45:21 UTC (rev 316241)
+++ php/php-src/trunk/ext/sockets/tests/socket_strerror.phpt2011-09-06 
09:56:13 UTC (rev 316242)
@@ -5,11 +5,11 @@
 f...@php.net
 --SKIPIF--
 ?php
-if (!extension_loaded('sockets')) {
+if (!extension_loaded('sockets') || !function_exists('socket_strerror')) {
 die('skip sockets extension not available.');
 }
-if (!stristr(PHP_OS, linux) {
-die('skip - test validtes linux error strings only.');
+if (!stristr(PHP_OS, Linux)) {
+die('skip - test validates linux error strings only.');
 }
 ?
 --FILE--

-- 
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_3/ext/sockets/tests/socket_strerror.phpt PHP_5_4/ext/sockets/tests/socket_strerror.phpt

2011-09-06 Thread Florian Anderiasch
fa   Tue, 06 Sep 2011 11:15:23 +

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

Log:
MFH: Fixed ext/sockets/tests/socket_strerror.phpt

So it seems a missing ) killed the test.

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/sockets/tests/socket_strerror.phpt
U   php/php-src/branches/PHP_5_4/ext/sockets/tests/socket_strerror.phpt

Modified: php/php-src/branches/PHP_5_3/ext/sockets/tests/socket_strerror.phpt
===
--- php/php-src/branches/PHP_5_3/ext/sockets/tests/socket_strerror.phpt 
2011-09-06 10:34:59 UTC (rev 316244)
+++ php/php-src/branches/PHP_5_3/ext/sockets/tests/socket_strerror.phpt 
2011-09-06 11:15:23 UTC (rev 316245)
@@ -5,10 +5,10 @@
 f...@php.net
 --SKIPIF--
 ?php
-if (!extension_loaded('sockets')) {
+if (!extension_loaded('sockets') || !function_exists('socket_strerror')) {
 die('skip sockets extension not available.');
 }
-if (!stristr(PHP_OS, linux) {
+if (!stristr(PHP_OS, Linux)) {
 die('skip - test validtes linux error strings only.');
 }
 ?

Modified: php/php-src/branches/PHP_5_4/ext/sockets/tests/socket_strerror.phpt
===
--- php/php-src/branches/PHP_5_4/ext/sockets/tests/socket_strerror.phpt 
2011-09-06 10:34:59 UTC (rev 316244)
+++ php/php-src/branches/PHP_5_4/ext/sockets/tests/socket_strerror.phpt 
2011-09-06 11:15:23 UTC (rev 316245)
@@ -5,10 +5,10 @@
 f...@php.net
 --SKIPIF--
 ?php
-if (!extension_loaded('sockets')) {
+if (!extension_loaded('sockets') || !function_exists('socket_strerror')) {
 die('skip sockets extension not available.');
 }
-if (!stristr(PHP_OS, linux) {
+if (!stristr(PHP_OS, Linux)) {
 die('skip - test validtes linux error strings only.');
 }
 ?

-- 
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/sapi/cli/php_cli_server.c trunk/sapi/cli/php_cli_server.c

2011-07-25 Thread Florian Anderiasch
fa   Mon, 25 Jul 2011 16:45:39 +

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

Log:
Fix #55121 Segfault with multipart/form-data POST

Bug: https://bugs.php.net/55121 (Assigned) Segfault with multipart/form-data 
POST / 404 request
  
Changed paths:
U   php/php-src/branches/PHP_5_4/sapi/cli/php_cli_server.c
U   php/php-src/trunk/sapi/cli/php_cli_server.c

Modified: php/php-src/branches/PHP_5_4/sapi/cli/php_cli_server.c
===
--- php/php-src/branches/PHP_5_4/sapi/cli/php_cli_server.c  2011-07-25 
15:35:10 UTC (rev 313676)
+++ php/php-src/branches/PHP_5_4/sapi/cli/php_cli_server.c  2011-07-25 
16:45:39 UTC (rev 313677)
@@ -1409,8 +1409,9 @@
request_info-content_length = request_info-post_data_length = 
client-request.content_len;
{
char **val;
+   const char delimiter[] = ;;
if (SUCCESS == zend_hash_find(client-request.headers, 
Content-Type, sizeof(Content-Type), (void**)val)) {
-   request_info-content_type = *val;
+   request_info-content_type = strtok(*val, delimiter);
}
}
 } /* }}} */

Modified: php/php-src/trunk/sapi/cli/php_cli_server.c
===
--- php/php-src/trunk/sapi/cli/php_cli_server.c 2011-07-25 15:35:10 UTC (rev 
313676)
+++ php/php-src/trunk/sapi/cli/php_cli_server.c 2011-07-25 16:45:39 UTC (rev 
313677)
@@ -1409,8 +1409,9 @@
request_info-content_length = request_info-post_data_length = 
client-request.content_len;
{
char **val;
+   const char delimiter[] = ;;
if (SUCCESS == zend_hash_find(client-request.headers, 
Content-Type, sizeof(Content-Type), (void**)val)) {
-   request_info-content_type = *val;
+   request_info-content_type = strtok(*val, delimiter);
}
}
 } /* }}} */

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