[PHP-CVS] com php-src: - Fixed bug #62415 (Undefined variable: diff in run-tests.php on line 2093 for successful XFAIL): run-tests.php

2012-06-30 Thread Felipe Pena
Commit:75d8af715cd624dda243d31f826c7da927ccd22f
Author:Felipe Pena  Sat, 30 Jun 2012 16:29:30 
-0300
Parents:   8fe87e7feaab2c031998d553585ba8cabf077499
Branches:  PHP-5.3 PHP-5.4

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

Log:
- Fixed bug #62415 (Undefined variable: diff in run-tests.php on line 2093 for 
successful XFAIL)

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

Changed paths:
  M  run-tests.php


Diff:
diff --git a/run-tests.php b/run-tests.php
index 9a01f56..2a46986 100755
--- a/run-tests.php
+++ b/run-tests.php
@@ -2089,8 +2089,10 @@ $output
if (isset($old_php)) {
$php = $old_php;
}
+   
+   $diff = empty($diff) ? '' : "";
 
-   junit_mark_test_as($restype, str_replace($cwd . '/', '', $tested_file), 
$tested, null, $info, "");
+   junit_mark_test_as($restype, str_replace($cwd . '/', '', $tested_file), 
$tested, null, $info, $diff);
 
return $restype[0] . 'ED';
 }


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



[PHP-CVS] com php-src: - Fixed bug #62415 (Undefined variable: diff in run-tests.php on line 2093 for successful XFAIL): run-tests.php

2012-06-30 Thread Felipe Pena
Commit:eb012cf88440423ff02c46421f29a1c6e850702c
Author:Felipe Pena  Sat, 30 Jun 2012 16:42:28 
-0300
Parents:   c51fbbe4b4e2c047d1be76d8bffc6391203adbdd 
b8d453d8d4b6a67531aa1c2d0d7bab1e25ed1d4f
Branches:  master

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

Log:
- Fixed bug #62415 (Undefined variable: diff in run-tests.php on line 2093 for 
successful XFAIL)

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

Changed paths:
  MM  run-tests.php


Diff:



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



Re: [PHP-CVS] com php-src: Add json_last_error_msg() function: ext/json/json.c ext/json/tests/003.phpt ext/json/tests/004.phpt ext/json/tests/007.phpt ext/json/tests/bug54058.phpt ext/json/tests/bug61

2012-06-30 Thread Stas Malyshev
Hi!

> 
> I hope you picked this function name to fuel the "PHP is so
> inconsistent" lovers.  Could I suggest picking something a little less
> a) different from everything else, and b) different from *everything*
> else?
> 

I think function name should be changed, and also all these big changes
better belong to 5.5 than 5.3.

I would propose renaming json_last_error to json_errno (keeping the
json_last_error as an alias for BC) and having json_error as error
message - just like all DB functions and many others do.
-- 
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: Fixed the common misspelling of the word occurred (occured -> occurred): Zend/tests/bug39018.phpt Zend/tests/offset_string.phpt Zend/zend_compile.c Zend/zend_execute.c ext/dom/x

2012-06-30 Thread Stanislav Malyshev
Commit:896ac689c91967dec0601fa9fe048c518da52a3c
Author:Marc Easen  Mon, 11 Jun 2012 21:47:40 +0100
Committer: Stanislav Malyshev   Sat, 30 Jun 2012 16:54:03 
-0700
Parents:   b8d453d8d4b6a67531aa1c2d0d7bab1e25ed1d4f
Branches:  PHP-5.4 master

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

Log:
Fixed the common misspelling of the word occurred (occured -> occurred)

Changed paths:
  M  Zend/tests/bug39018.phpt
  M  Zend/tests/offset_string.phpt
  M  Zend/zend_compile.c
  M  Zend/zend_execute.c
  M  ext/dom/xpath.c
  M  ext/imap/tests/imap_errors_basic.phpt
  M  ext/intl/common/common_error.c
  M  ext/intl/doc/collator_api.php
  M  ext/intl/doc/common_api.php
  M  ext/intl/doc/datefmt_api.php
  M  ext/intl/doc/formatter_api.php
  M  ext/intl/doc/msgfmt_api.php
  M  ext/intl/intl_convert.c
  M  ext/intl/normalizer/normalizer_normalize.c
  M  ext/intl/tests/formatter_get_error.phpt
  M  ext/mysqli/mysqli.c
  M  ext/mysqli/tests/mysqli_stmt_affected_rows.phpt
  M  ext/mysqlnd/mysqlnd_loaddata.c
  M  ext/pcntl/pcntl.c
  M  ext/pcntl/tests/pcntl_exec_3.phpt
  M  ext/pdo_mysql/mysql_statement.c
  M  ext/simplexml/tests/bug48601.phpt
  M  ext/sockets/tests/socket_sentto_recvfrom_ipv4_udp.phpt
  M  ext/sockets/tests/socket_sentto_recvfrom_ipv6_udp.phpt
  M  ext/sockets/tests/socket_sentto_recvfrom_unix.phpt
  M  ext/spl/tests/bug52238.phpt
  M  ext/sqlite3/libsqlite/sqlite3.c
  M  ext/sqlite3/sqlite3.c
  M  ext/standard/basic_functions.c
  M  ext/standard/tests/file/umask_basic.phpt
  M  ext/tidy/examples/cleanhtml.php
  M  ext/tidy/examples/cleanhtml5.php
  M  ext/tidy/tidy.c
  M  ext/xsl/xsltprocessor.c

diff --git a/Zend/tests/bug39018.phpt b/Zend/tests/bug39018.phpt
index e1968ad..32566ba 100644
--- a/Zend/tests/bug39018.phpt
+++ b/Zend/tests/bug39018.phpt
@@ -62,17 +62,17 @@ print "\nDone\n";
 
 ?>
 --EXPECTF--
-Notice: String offset cast occured in %s on line %d
+Notice: String offset cast occurred in %s on line %d
 
 Notice: Uninitialized string offset: 0 in %s on line %d
 
 Notice: Uninitialized string offset: 0 in %s on line %d
 
-Notice: String offset cast occured in %s on line %d
+Notice: String offset cast occurred in %s on line %d
 
 Notice: Uninitialized string offset: %i in %s on line %d
 
-Notice: String offset cast occured in %s on line %d
+Notice: String offset cast occurred in %s on line %d
 
 Notice: Uninitialized string offset: %i in %s on line %d
 
@@ -88,16 +88,16 @@ Notice: Uninitialized string offset: 4 in %s on line %d
 
 Notice: Uninitialized string offset: 4 in %s on line %d
 
-Notice: String offset cast occured in %s on line %d
+Notice: String offset cast occurred in %s on line %d
 
 Notice: Uninitialized string offset: 12 in %s on line %d
 
-Notice: String offset cast occured in %s on line %d
+Notice: String offset cast occurred in %s on line %d
 
 Notice: Uninitialized string offset: 12 in %s on line %d
 
-Notice: String offset cast occured in %s on line %d
+Notice: String offset cast occurred in %s on line %d
 
-Notice: String offset cast occured in %s on line %d
+Notice: String offset cast occurred in %s on line %d
 b
 Done
diff --git a/Zend/tests/offset_string.phpt b/Zend/tests/offset_string.phpt
index 34604d6..f7cb81b 100644
--- a/Zend/tests/offset_string.phpt
+++ b/Zend/tests/offset_string.phpt
@@ -30,10 +30,10 @@ echo "Done\n";
 --EXPECTF--
 string(1) "i"
 
-Notice: String offset cast occured in %s on line %d
+Notice: String offset cast occurred in %s on line %d
 string(1) "S"
 
-Notice: String offset cast occured in %s on line %d
+Notice: String offset cast occurred in %s on line %d
 string(1) "S"
 
 Warning: Illegal string offset 'run away' in %s on line %d
@@ -46,10 +46,10 @@ string(1) "o"
 Notice: A non well formed numeric value encountered in %s on line %d
 string(1) "r"
 
-Notice: String offset cast occured in %s on line %d
+Notice: String offset cast occurred in %s on line %d
 string(1) "i"
 
-Notice: String offset cast occured in %s on line %d
+Notice: String offset cast occurred in %s on line %d
 string(1) "S"
 
 Warning: Illegal offset type in %s on line %d
diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c
index cca7c19..841e1b9 100644
--- a/Zend/zend_compile.c
+++ b/Zend/zend_compile.c
@@ -3712,7 +3712,7 @@ static int zend_traits_merge_functions(zend_function *fn 
TSRMLS_DC, int num_args
} else {
/* Add it to result function table */
if (zend_hash_quick_add(resulting_table, hash_key->arKey, 
hash_key->nKeyLength, hash_key->h, fn, sizeof(zend_function), NULL)==FAILURE) {
-   zend_error(E_COMPILE_ERROR, "Trait method %s has not 
been applied, because failure occured during updating resulting trait method 
table", fn->common.function_name);
+   zend_error(E_COMPILE_ERROR, "Trait method %s has not 
been applied, because failure occurred during updating resulting trait method 
table", fn->common.function_name);
   

[PHP-CVS] com php-src: Merge branch 'PHP-5.4': Zend/tests/offset_string.phpt Zend/zend_compile.c ext/mysqli/mysqli.c ext/mysqlnd/mysqlnd_loaddata.c ext/pcntl/pcntl.c ext/sqlite3/libsqlite/sqlite3.c ex

2012-06-30 Thread Stanislav Malyshev
Commit:a3322f8927618a8cadbef4ae2121084b44a564d3
Author:Stanislav Malyshev  Sat, 30 Jun 2012 17:00:25 
-0700
Parents:   eb012cf88440423ff02c46421f29a1c6e850702c 
896ac689c91967dec0601fa9fe048c518da52a3c
Branches:  master

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

Log:
Merge branch 'PHP-5.4'

* PHP-5.4:
  Fixed the common misspelling of the word occurred (occured -> occurred)

Changed paths:
  MM  Zend/tests/offset_string.phpt
  MM  Zend/zend_compile.c
  MM  ext/mysqli/mysqli.c
  MM  ext/mysqlnd/mysqlnd_loaddata.c
  MM  ext/pcntl/pcntl.c
  MM  ext/sqlite3/libsqlite/sqlite3.c
  MM  ext/standard/basic_functions.c


Diff:
diff --cc Zend/tests/offset_string.phpt
index 1283501,f7cb81b..c546b37
--- a/Zend/tests/offset_string.phpt
+++ b/Zend/tests/offset_string.phpt
@@@ -27,13 -27,13 +27,13 @@@ var_dump($str[$arr])
  
  echo "Done\n";
  ?>
 ---EXPECTF--
 +--EXPECTF--   
  string(1) "i"
  
- Notice: String offset cast occured in %s on line %d
+ Notice: String offset cast occurred in %s on line %d
  string(1) "S"
  
- Notice: String offset cast occured in %s on line %d
+ Notice: String offset cast occurred in %s on line %d
  string(1) "S"
  
  Warning: Illegal string offset 'run away' in %s on line %d


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



[PHP-CVS] com php-src: update NEWS: NEWS

2012-06-30 Thread Stanislav Malyshev
Commit:dfce6bf5d698a65f76f5ab416c022d8f2af92288
Author:Stanislav Malyshev  Sat, 30 Jun 2012 17:37:09 
-0700
Parents:   896ac689c91967dec0601fa9fe048c518da52a3c
Branches:  PHP-5.4 master

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

Log:
update NEWS

Changed paths:
  M  NEWS

diff --git a/NEWS b/NEWS
index f511250..4478462 100644
--- a/NEWS
+++ b/NEWS
@@ -5,6 +5,10 @@ PHP
NEWS
 - Core:
   . Fixed bug #62443 (Crypt SHA256/512 Segfaults With Malformed 
 Salt). (Anthony Ferrara)
+  . Fixed bug #62432 (ReflectionMethod random corrupt memory on high
+concurrent). (Johannes)
+  . Fixed bug #62373 (serialize() generates wrong reference to the object).
+(Moriyoshi)
   . Fixed bug #62357 (compile failure: (S) Arguments missing for built-in
 function __memcmp). (Laruence)
   . Fixed bug #61998 (Using traits with method aliases appears to result in
@@ -46,11 +50,15 @@ PHP 
   NEWS
   . Fixed bug #62070 (Collator::getSortKey() returns garbage). (Gustavo)
   . Fixed bug #62017 (datefmt_create with incorrectly encoded timezone leaks
 pattern). (Gustavo)
+  . Fixed bug #60785 (memory leak in IntlDateFormatter constructor). (Gustavo)
 
 - libxml:
   . Fixed bug #62266 (Custom extension segfaults during xmlParseFile with FPM
 SAPI). (Gustavo)
 
+- Phar:
+  . Fixed bug #62227 (Invalid phar stream path causes crash). (Felipe)
+
 - Readline:
   . Fixed bug #62186 (readline fails to compile - void function should not
 return a value). (Johannes)
@@ -64,6 +72,10 @@ PHP  
  NEWS
 - Sockets:
   . Fixed bug #62025 (__ss_family was changed on AIX 5.3). (Felipe)
 
+- SPL:
+  . Fixed bug #62262 (RecursiveArrayIterator does not implement Countable).
+(Nikita Popov)
+
 - XML Writer:
   . Fixed bug #62064 (memory leak in the XML Writer module). 
 (jean-pierre dot lozi at lip6 dot fr)
@@ -85,10 +97,6 @@ PHP  
  NEWS
   . Fixed bug #61546 (functions related to current script failed when chdir() 
 in cli sapi). (Laruence, reeze@gmail.com)
 
-- CURL:
-  . Fixed bug #61948 (CURLOPT_COOKIEFILE '' raises open_basedir restriction).
-(Laruence)
-
 - Core:
   . Fixed missing bound check in iptcparse(). (chris at chiappa.net)
   . Fixed CVE-2012-2143. (Solar Designer)
@@ -103,12 +111,15 @@ PHP   
 NEWS
   . Fixed bug #61827 (incorrect \e processing on Windows) (Anatoliy)
   . Fixed bug #61782 (__clone/__destruct do not match other methods when 
checking
 access controls). (Stas)
+  . Fixed bug #61764 ('I' unpacks n as signed if n > 2^31-1 on LP64). (Gustavo)
   . Fixed bug #61761 ('Overriding' a private static method with a different 
 signature causes crash). (Laruence)
   . Fixed bug #61730 (Segfault from array_walk modifying an array passed by
 reference). (Laruence)
   . Fixed bug #61728 (PHP crash when calling ob_start in request_shutdown 
 phase). (Laruence)
+  . Fixed bug #61713 (Logic error in charset detection for htmlentities).
+(Anatoliy)
   . Fixed bug #61660 (bin2hex(hex2bin($data)) != $data). (Nikita Popov)
   . Fixed bug #61650 (ini parser crashes when using ${} ini variables
 (without apache2)). (Laruence)
@@ -118,15 +129,9 @@ PHP
NEWS
 set to null). (Anatoliy)
   . Changed php://fd to be available only for CLI.
 
-- PDO:
-  . Fixed bug #61755 (A parsing bug in the prepared statements can lead to
-access violations). (Johannes)
-
-- Phar:
-  . Fix bug #61065 (Secunia SA44335, CVE-2012-2386). (Rasmus)
-
-- Pgsql:
-  . Added pg_escape_identifier/pg_escape_literal. (Yasuo Ohgaki)
+- CURL:
+  . Fixed bug #61948 (CURLOPT_COOKIEFILE '' raises open_basedir restriction).
+(Laruence)
 
 - Fileinfo
   . Fixed bug #61812 (Uninitialised value used in libmagic). 
@@ -144,6 +149,20 @@ PHP
NEWS
   . Fixed bug #61617 (Libxml tests failed(ht is already destroyed)).
 (Laruence)
 
+- PDO:
+  . Fixed bug #61755 (A parsing bug in the prepared statements can lead to
+access violations). (Johannes)
+
+- Phar:
+  . Fixed bug #61065 (Secunia SA44335, CVE-2012-2386). (Rasmus)
+
+- Pgsql:
+  . Added pg_escape_identifier/pg_escape_literal. (Yasuo Ohgaki)
+
+- Streams:
+  . Fixed bug #61961 (file_get_contents leaks when access empty file with
+maxlen set). (Reeze)
+
 - Zlib:
   . Fixed bug #61820 (using ob_gzhandler will complain about headers already 
 sent when no compression). (Mike)
@@ -232,23 +251,6 @@ PHP
NEWS
   . Fixed bug #

[PHP-CVS] com php-src: remove duplicates, fix order: NEWS

2012-06-30 Thread Stanislav Malyshev
Commit:5f31c81f0754ac031c2c5c056cb48ff4153fea81
Author:Stanislav Malyshev  Sat, 30 Jun 2012 17:36:22 
-0700
Parents:   75d8af715cd624dda243d31f826c7da927ccd22f
Branches:  PHP-5.3 PHP-5.4 master

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

Log:
remove duplicates, fix order

Changed paths:
  M  NEWS


Diff:
diff --git a/NEWS b/NEWS
index 80d56bc..c650c85 100644
--- a/NEWS
+++ b/NEWS
@@ -9,7 +9,6 @@ PHP 
   NEWS
   . Fixed bug #62146 com_dotnet cannot be built shared. (Johannes)
 
 - Core:
-  . Fixed CVE-2012-2143. (Solar Designer)
   . Fixed potential overflow in _php_stream_scandir. (Jason Powell,
 Stas)
   . Fixed bug #62432 (ReflectionMethod random corrupt memory on high
@@ -37,8 +36,6 @@ PHP   
 NEWS
 
 - Intl:
   . Fixed bug #62083 (grapheme_extract() memory leaks). (Gustavo)
-  . Fixed bug #62082 (memory corruption in internal get_icu_disp_value_src_php
-function). (Gustavo)
   . Fixed bug #62081 (IntlDateFormatter constructor leaks memory when called
 twice). (Gustavo)
   . Fixed bug #62070 (Collator::getSortKey() returns garbage). (Gustavo)
@@ -48,10 +45,6 @@ PHP  
  NEWS
 
 - JSON:
   . Improved error handling. (Nikita Popov)
-  
-- PDO:
-  . Fixed bug #61755 (A parsing bug in the prepared statements can lead to
-access violations). (Johannes)
 
 - Phar:
   . Fixed bug #62227 (Invalid phar stream path causes crash). (Felipe)
@@ -87,20 +80,20 @@ PHP 
   NEWS
 
 - Core:
   . Fixed CVE-2012-2143. (Solar Designer)
+  . Fixed missing bound check in iptcparse(). (chris at chiappa.net)
+  . Fixed bug #62373 (serialize() generates wrong reference to the object).
+(Moriyoshi)
   . Fixed bug #62005 (unexpected behavior when incrementally assigning to a 
 member of a null object). (Laruence)
+  . Fixed bug #61991 (long overflow in realpath_cache_get()). (Anatoliy)
+  . Fixed bug #61764 ('I' unpacks n as signed if n > 2^31-1 on LP64). (Gustavo)
   . Fixed bug #61730 (Segfault from array_walk modifying an array passed by
 reference). (Laruence)
-  . Fixed missing bound check in iptcparse(). (chris at chiappa.net)
-  . Fixed bug #61764 ('I' unpacks n as signed if n > 2^31-1 on LP64). (Gustavo)
-  . Fixed bug #54197 ([PATH=] sections incompatibility with user_ini.filename
-set to null). (Anatoliy)
   . Fixed bug #61713 (Logic error in charset detection for htmlentities).
 (Anatoliy)
-  . Fixed bug #61991 (long overflow in realpath_cache_get()). (Anatoliy)
+  . Fixed bug #54197 ([PATH=] sections incompatibility with user_ini.filename
+set to null). (Anatoliy)
   . Changed php://fd to be available only for CLI.
-  . Fixed bug #62373 (serialize() generates wrong reference to the object).
-(Moriyoshi)
 
 - Fileinfo:
   . Fixed bug #61812 (Uninitialised value used in libmagic).


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



[PHP-CVS] com php-src: fix bug #61359: json_encode() calls too many reallocs: NEWS ext/json/json.c

2012-06-30 Thread Stanislav Malyshev
Commit:b741d3315be5cbddae5a895b9dceb2b71d394366
Author:Stanislav Malyshev  Sat, 30 Jun 2012 19:14:30 
-0700
Parents:   4420b439073a77354293695133d744c1c5297c0f
Branches:  PHP-5.4 master

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

Log:
fix bug #61359: json_encode() calls too many reallocs

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

Changed paths:
  M  NEWS
  M  ext/json/json.c


Diff:
diff --git a/NEWS b/NEWS
index 4478462..6dd1feb 100644
--- a/NEWS
+++ b/NEWS
@@ -52,6 +52,9 @@ PHP   
 NEWS
 pattern). (Gustavo)
   . Fixed bug #60785 (memory leak in IntlDateFormatter constructor). (Gustavo)
 
+- JSON:
+  . Fixed bug #61359 (json_encode() calls too many reallocs). (Stas)
+
 - libxml:
   . Fixed bug #62266 (Custom extension segfaults during xmlParseFile with FPM
 SAPI). (Gustavo)
diff --git a/ext/json/json.c b/ext/json/json.c
index b467079..9669047 100644
--- a/ext/json/json.c
+++ b/ext/json/json.c
@@ -311,7 +311,7 @@ static void json_encode_array(smart_str *buf, zval **val, 
int options TSRMLS_DC)
smart_str_appendc(buf, ':');
 
json_pretty_print_char(buf, 
options, ' ' TSRMLS_CC);
- 
+
php_json_encode(buf, *data, 
options TSRMLS_CC);
} else {
if (need_comma) {
@@ -329,7 +329,7 @@ static void json_encode_array(smart_str *buf, zval **val, 
int options TSRMLS_DC)
smart_str_appendc(buf, ':');
 
json_pretty_print_char(buf, 
options, ' ' TSRMLS_CC);
- 
+
php_json_encode(buf, *data, 
options TSRMLS_CC);
}
}
@@ -340,7 +340,7 @@ static void json_encode_array(smart_str *buf, zval **val, 
int options TSRMLS_DC)
}
}
}
-   
+
--JSON_G(encoder_depth);
json_pretty_print_char(buf, options, '\n' TSRMLS_CC);
json_pretty_print_indent(buf, options TSRMLS_CC);
@@ -360,6 +360,7 @@ static void json_escape_string(smart_str *buf, char *s, int 
len, int options TSR
int pos = 0, ulen = 0;
unsigned short us;
unsigned short *utf16;
+   size_t newlen;
 
if (len == 0) {
smart_str_appendl(buf, "\"\"", 2);
@@ -387,9 +388,9 @@ static void json_escape_string(smart_str *buf, char *s, int 
len, int options TSR
}
return;
}
-   
+
}
-   
+
utf16 = (options & PHP_JSON_UNESCAPED_UNICODE) ? NULL : (unsigned short 
*) safe_emalloc(len, sizeof(unsigned short), 0);
ulen = utf8_to_utf16(utf16, s, len);
if (ulen <= 0) {
@@ -408,6 +409,8 @@ static void json_escape_string(smart_str *buf, char *s, int 
len, int options TSR
len = ulen;
}
 
+   /* pre-allocate for string length plus 2 quotes */
+   smart_str_alloc(buf, len+2, 0);
smart_str_appendc(buf, '"');
 
while (pos < len)
@@ -520,13 +523,13 @@ static void json_encode_serializable_object(smart_str 
*buf, zval *val, int optio
zend_class_entry *ce = Z_OBJCE_P(val);
zval *retval = NULL, fname;
HashTable* myht;
-   
+
if (Z_TYPE_P(val) == IS_ARRAY) {
myht = HASH_OF(val);
} else {
myht = Z_OBJPROP_P(val);
-   }   
-   
+   }
+
if (myht && myht->nApplyCount > 1) {
JSON_G(error_code) = PHP_JSON_ERROR_RECURSION;
smart_str_appendl(buf, "null", 4);
@@ -539,7 +542,7 @@ static void json_encode_serializable_object(smart_str *buf, 
zval *val, int optio
zend_throw_exception_ex(NULL, 0 TSRMLS_CC, "Failed calling 
%s::jsonSerialize()", ce->name);
smart_str_appendl(buf, "null", sizeof("null") - 1);
return;
-}   
+}
 
if (EG(exception)) {
/* Error already raised */


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



Re: [PHP-CVS] com php-src: Add json_last_error_msg() function: ext/json/json.c ext/json/tests/003.phpt ext/json/tests/004.phpt ext/json/tests/007.phpt ext/json/tests/bug54058.phpt ext/json/tests/bug61

2012-06-30 Thread Laruence
On Sun, Jul 1, 2012 at 6:45 AM, Stas Malyshev  wrote:
> Hi!
>
>>
>> I hope you picked this function name to fuel the "PHP is so
>> inconsistent" lovers.  Could I suggest picking something a little less
>> a) different from everything else, and b) different from *everything*
>> else?
>>
>
> I think function name should be changed, and also all these big changes
> better belong to 5.5 than 5.3.
>
> I would propose renaming json_last_error to json_errno (keeping the
> json_last_error as an alias for BC) and having json_error as error
> message - just like all DB functions and many others do.
in this case,

I would suggest,  json_errno,  json_strerr,  :)

thanks
> --
> 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
>



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

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