[PHP-CVS] com php-src: Revert JSON changes to PHP 5.3: ext/json/JSON_parser.h 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/j

2012-07-01 Thread Nikita Popov
Commit:250393f92523fffe643df06a1de2101fd50a327e
Author:Nikita Popov ni...@php.net Sun, 1 Jul 2012 16:28:57 +0200
Parents:   5f31c81f0754ac031c2c5c056cb48ff4153fea81
Branches:  PHP-5.3 PHP-5.4 master

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

Log:
Revert JSON changes to PHP 5.3

This reverts the following commits:

974324676b2436f159f42d9241c569f813471684
4662151ea7d7b6920d115cf2a2d6e9d4232727a3
84fe2cc890e49f40bac7c3ba74b3cfc6dc4cef2f

This does not revert the JSON changes released in PHP 5.3.14.

Changed paths:
  M  ext/json/JSON_parser.h
  M  ext/json/json.c
  M  ext/json/tests/003.phpt
  M  ext/json/tests/004.phpt
  M  ext/json/tests/007.phpt
  M  ext/json/tests/bug54058.phpt
  M  ext/json/tests/bug61537.phpt
  D  ext/json/tests/inf_nan_error.phpt
  M  ext/json/tests/json_encode_basic.phpt
  M  ext/json/tests/pass001.1.phpt
  M  ext/json/tests/pass001.phpt
  D  ext/json/tests/unsupported_type_error.phpt

diff --git a/ext/json/JSON_parser.h b/ext/json/JSON_parser.h
index 5037344..746190b 100644
--- a/ext/json/JSON_parser.h
+++ b/ext/json/JSON_parser.h
@@ -24,10 +24,7 @@ enum error_codes {
 PHP_JSON_ERROR_STATE_MISMATCH,  
 PHP_JSON_ERROR_CTRL_CHAR,   
 PHP_JSON_ERROR_SYNTAX,
-PHP_JSON_ERROR_UTF8,
-PHP_JSON_ERROR_RECURSION,
-PHP_JSON_ERROR_INF_OR_NAN,
-PHP_JSON_ERROR_UNSUPPORTED_TYPE
+PHP_JSON_ERROR_UTF8
 };
 
 extern JSON_parser new_JSON_parser(int depth);
diff --git a/ext/json/json.c b/ext/json/json.c
index 4d29a66..ce2cf43 100644
--- a/ext/json/json.c
+++ b/ext/json/json.c
@@ -34,7 +34,6 @@ static PHP_MINFO_FUNCTION(json);
 static PHP_FUNCTION(json_encode);
 static PHP_FUNCTION(json_decode);
 static PHP_FUNCTION(json_last_error);
-static PHP_FUNCTION(json_last_error_msg);
 
 static const char digits[] = 0123456789abcdef;
 
@@ -54,9 +53,6 @@ ZEND_END_ARG_INFO()
 
 ZEND_BEGIN_ARG_INFO(arginfo_json_last_error, 0)
 ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_json_last_error_msg, 0)
-ZEND_END_ARG_INFO()
 /* }}} */
 
 /* {{{ json_functions[] */
@@ -64,7 +60,6 @@ static const function_entry json_functions[] = {
PHP_FE(json_encode, arginfo_json_encode)
PHP_FE(json_decode, arginfo_json_decode)
PHP_FE(json_last_error, arginfo_json_last_error)
-   PHP_FE(json_last_error_msg, arginfo_json_last_error_msg)
PHP_FE_END
 };
 /* }}} */
@@ -86,9 +81,6 @@ static PHP_MINIT_FUNCTION(json)
REGISTER_LONG_CONSTANT(JSON_ERROR_CTRL_CHAR, 
PHP_JSON_ERROR_CTRL_CHAR, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT(JSON_ERROR_SYNTAX, PHP_JSON_ERROR_SYNTAX, 
CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT(JSON_ERROR_UTF8, PHP_JSON_ERROR_UTF8, CONST_CS 
| CONST_PERSISTENT);
-   REGISTER_LONG_CONSTANT(JSON_ERROR_RECURSION, 
PHP_JSON_ERROR_RECURSION, CONST_CS | CONST_PERSISTENT);
-   REGISTER_LONG_CONSTANT(JSON_ERROR_INF_OR_NAN, 
PHP_JSON_ERROR_INF_OR_NAN, CONST_CS | CONST_PERSISTENT);
-   REGISTER_LONG_CONSTANT(JSON_ERROR_UNSUPPORTED_TYPE, 
PHP_JSON_ERROR_UNSUPPORTED_TYPE, CONST_CS | CONST_PERSISTENT);
 
return SUCCESS;
 }
@@ -189,7 +181,7 @@ static void json_encode_array(smart_str *buf, zval **val, 
int options TSRMLS_DC)
}
 
if (myht  myht-nApplyCount  1) {
-   JSON_G(error_code) = PHP_JSON_ERROR_RECURSION;
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, recursion 
detected);
smart_str_appendl(buf, null, 4);
return;
}
@@ -311,7 +303,7 @@ static void json_escape_string(smart_str *buf, char *s, int 
len, int options TSR
smart_str_appendl(buf, tmp, l);
efree(tmp);
} else {
-   JSON_G(error_code) = 
PHP_JSON_ERROR_INF_OR_NAN;
+   php_error_docref(NULL TSRMLS_CC, 
E_WARNING, double %.9g does not conform to the JSON spec, encoded as 0, d);
smart_str_appendc(buf, '0');
}
}
@@ -329,6 +321,7 @@ static void json_escape_string(smart_str *buf, char *s, int 
len, int options TSR
}
if (len  0) {
JSON_G(error_code) = PHP_JSON_ERROR_UTF8;
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, Invalid 
UTF-8 sequence in argument);
smart_str_appendl(buf, null, 4);
} else {
smart_str_appendl(buf, \\, 2);
@@ -467,7 +460,7 @@ PHP_JSON_API void php_json_encode(smart_str *buf, zval 
*val, int options TSRMLS_
smart_str_appendl(buf, d, len);
efree(d);
} else {
-   JSON_G(error_code) = 
PHP_JSON_ERROR_INF_OR_NAN;
+ 

[PHP-CVS] com php-src: Revert JSON merges to 5.4: ext/json/JSON_parser.h ext/json/json.c ext/json/php_json.h ext/json/tests/003.phpt ext/json/tests/004.phpt ext/json/tests/007.phpt ext/json/tests/bug4

2012-07-01 Thread Nikita Popov
Commit:b7903f9778a57fda71867f9661505f635d602067
Author:Nikita Popov ni...@php.net Sun, 1 Jul 2012 16:38:26 +0200
Parents:   9cbd7a24b6d1d61e51fd6d32669dcfa1df30c883
Branches:  PHP-5.4 master

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

Log:
Revert JSON merges to 5.4

This reverts the following merge commits (-m 1):

405ebfcd182a39f0960ff7d7055d49053d3e0316
d372b33c9b941be9a795bf3705bd22dc5f6092c3
36fa17a5fae84ab332366a202f0a709279a2466a

Changed paths:
  M  ext/json/JSON_parser.h
  M  ext/json/json.c
  M  ext/json/php_json.h
  M  ext/json/tests/003.phpt
  M  ext/json/tests/004.phpt
  M  ext/json/tests/007.phpt
  M  ext/json/tests/bug43941.phpt
  M  ext/json/tests/bug53946.phpt
  M  ext/json/tests/bug54058.phpt
  D  ext/json/tests/bug61537.phpt
  M  ext/json/tests/bug61978.phpt
  D  ext/json/tests/inf_nan_error.phpt
  M  ext/json/tests/json_encode_basic.phpt
  M  ext/json/tests/pass001.1.phpt
  M  ext/json/tests/pass001.phpt
  D  ext/json/tests/unsupported_type_error.phpt
  M  main/php_version.h

diff --git a/ext/json/JSON_parser.h b/ext/json/JSON_parser.h
index 8671765..541664b 100644
--- a/ext/json/JSON_parser.h
+++ b/ext/json/JSON_parser.h
@@ -25,10 +25,7 @@ enum error_codes {
 PHP_JSON_ERROR_STATE_MISMATCH,  
 PHP_JSON_ERROR_CTRL_CHAR,   
 PHP_JSON_ERROR_SYNTAX,
-PHP_JSON_ERROR_UTF8,
-PHP_JSON_ERROR_RECURSION,
-PHP_JSON_ERROR_INF_OR_NAN,
-PHP_JSON_ERROR_UNSUPPORTED_TYPE
+PHP_JSON_ERROR_UTF8
 };
 
 extern JSON_parser new_JSON_parser(int depth);
diff --git a/ext/json/json.c b/ext/json/json.c
index 9669047..786b21a 100644
--- a/ext/json/json.c
+++ b/ext/json/json.c
@@ -35,7 +35,6 @@ static PHP_MINFO_FUNCTION(json);
 static PHP_FUNCTION(json_encode);
 static PHP_FUNCTION(json_decode);
 static PHP_FUNCTION(json_last_error);
-static PHP_FUNCTION(json_last_error_msg);
 
 static const char digits[] = 0123456789abcdef;
 
@@ -58,9 +57,6 @@ ZEND_END_ARG_INFO()
 
 ZEND_BEGIN_ARG_INFO(arginfo_json_last_error, 0)
 ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_json_last_error_msg, 0)
-ZEND_END_ARG_INFO()
 /* }}} */
 
 /* {{{ json_functions[] */
@@ -68,7 +64,6 @@ static const zend_function_entry json_functions[] = {
PHP_FE(json_encode, arginfo_json_encode)
PHP_FE(json_decode, arginfo_json_decode)
PHP_FE(json_last_error, arginfo_json_last_error)
-   PHP_FE(json_last_error_msg, arginfo_json_last_error_msg)
PHP_FE_END
 };
 /* }}} */
@@ -101,7 +96,6 @@ static PHP_MINIT_FUNCTION(json)
REGISTER_LONG_CONSTANT(JSON_UNESCAPED_SLASHES, 
PHP_JSON_UNESCAPED_SLASHES, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT(JSON_PRETTY_PRINT, PHP_JSON_PRETTY_PRINT, 
CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT(JSON_UNESCAPED_UNICODE, 
PHP_JSON_UNESCAPED_UNICODE, CONST_CS | CONST_PERSISTENT);
-   REGISTER_LONG_CONSTANT(JSON_PARTIAL_OUTPUT_ON_ERROR, 
PHP_JSON_PARTIAL_OUTPUT_ON_ERROR, CONST_CS | CONST_PERSISTENT);
 
REGISTER_LONG_CONSTANT(JSON_ERROR_NONE, PHP_JSON_ERROR_NONE, CONST_CS 
| CONST_PERSISTENT);
REGISTER_LONG_CONSTANT(JSON_ERROR_DEPTH, PHP_JSON_ERROR_DEPTH, 
CONST_CS | CONST_PERSISTENT);
@@ -109,9 +103,6 @@ static PHP_MINIT_FUNCTION(json)
REGISTER_LONG_CONSTANT(JSON_ERROR_CTRL_CHAR, 
PHP_JSON_ERROR_CTRL_CHAR, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT(JSON_ERROR_SYNTAX, PHP_JSON_ERROR_SYNTAX, 
CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT(JSON_ERROR_UTF8, PHP_JSON_ERROR_UTF8, CONST_CS 
| CONST_PERSISTENT);
-   REGISTER_LONG_CONSTANT(JSON_ERROR_RECURSION, 
PHP_JSON_ERROR_RECURSION, CONST_CS | CONST_PERSISTENT);
-   REGISTER_LONG_CONSTANT(JSON_ERROR_INF_OR_NAN, 
PHP_JSON_ERROR_INF_OR_NAN, CONST_CS | CONST_PERSISTENT);
-   REGISTER_LONG_CONSTANT(JSON_ERROR_UNSUPPORTED_TYPE, 
PHP_JSON_ERROR_UNSUPPORTED_TYPE, CONST_CS | CONST_PERSISTENT);
 
REGISTER_LONG_CONSTANT(JSON_OBJECT_AS_ARRAY,  
PHP_JSON_OBJECT_AS_ARRAY,   CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT(JSON_BIGINT_AS_STRING, 
PHP_JSON_BIGINT_AS_STRING,  CONST_CS | CONST_PERSISTENT);
@@ -240,7 +231,7 @@ static void json_encode_array(smart_str *buf, zval **val, 
int options TSRMLS_DC)
}
 
if (myht  myht-nApplyCount  1) {
-   JSON_G(error_code) = PHP_JSON_ERROR_RECURSION;
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, recursion 
detected);
smart_str_appendl(buf, null, 4);
return;
}
@@ -382,7 +373,7 @@ static void json_escape_string(smart_str *buf, char *s, int 
len, int options TSR
smart_str_appendl(buf, tmp, l);
efree(tmp);
} else {
-   JSON_G(error_code) = 
PHP_JSON_ERROR_INF_OR_NAN;
+   

[PHP-CVS] com php-src: Fix accidential change of php_version.h: main/php_version.h

2012-07-01 Thread Nikita Popov
Commit:ff41bfc87882440cfde0ed5673bd6c3f2347c892
Author:Nikita Popov ni...@php.net Sun, 1 Jul 2012 17:05:19 +0200
Parents:   b7903f9778a57fda71867f9661505f635d602067
Branches:  PHP-5.4 master

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

Log:
Fix accidential change of php_version.h

For some reason the merge reverts changed the version :/

Changed paths:
  M  main/php_version.h


Diff:
diff --git a/main/php_version.h b/main/php_version.h
index 6b49f40..4b7709c 100644
--- a/main/php_version.h
+++ b/main/php_version.h
@@ -5,4 +5,4 @@
 #define PHP_RELEASE_VERSION 5
 #define PHP_EXTRA_VERSION -dev
 #define PHP_VERSION 5.4.5-dev
-#define PHP_VERSION_ID 50404
+#define PHP_VERSION_ID 50405


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



[PHP-CVS] com php-src: Fixed bug #62433 (Inconsistent behavior of RecursiveDirectoryIterator to dot files).: NEWS ext/spl/spl_directory.c ext/spl/tests/bug62433.phpt

2012-07-01 Thread Xinchen Hui
Commit:be4053cea0462c9de5396641f4e4fa2f56f5a675
Author:Xinchen Hui larue...@php.net Mon, 2 Jul 2012 11:33:38 +0800
Parents:   ff41bfc87882440cfde0ed5673bd6c3f2347c892
Branches:  PHP-5.4

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

Log:
Fixed bug #62433 (Inconsistent behavior of RecursiveDirectoryIterator to dot 
files).

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

Changed paths:
  M  NEWS
  M  ext/spl/spl_directory.c
  A  ext/spl/tests/bug62433.phpt


Diff:
diff --git a/NEWS b/NEWS
index 6dd1feb..70a8eb9 100644
--- a/NEWS
+++ b/NEWS
@@ -76,6 +76,8 @@ PHP   
 NEWS
   . Fixed bug #62025 (__ss_family was changed on AIX 5.3). (Felipe)
 
 - SPL:
+  . Fixed bug #62433 (Inconsistent behavior of RecursiveDirectoryIterator to
+dot files). (Laruence)
   . Fixed bug #62262 (RecursiveArrayIterator does not implement Countable).
 (Nikita Popov)
 
diff --git a/ext/spl/spl_directory.c b/ext/spl/spl_directory.c
index dbae3e2..0fcbd31 100755
--- a/ext/spl/spl_directory.c
+++ b/ext/spl/spl_directory.c
@@ -1432,6 +1432,7 @@ SPL_METHOD(FilesystemIterator, __construct)
 SPL_METHOD(FilesystemIterator, rewind)
 {
spl_filesystem_object *intern = 
(spl_filesystem_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
+   int skip_dots = SPL_HAS_FLAG(intern-flags, SPL_FILE_DIR_SKIPDOTS);
 
if (zend_parse_parameters_none() == FAILURE) {
return;
@@ -1443,7 +1444,7 @@ SPL_METHOD(FilesystemIterator, rewind)
}
do {
spl_filesystem_dir_read(intern TSRMLS_CC);
-   } while (spl_filesystem_is_dot(intern-u.dir.entry.d_name));
+   } while (skip_dots  
spl_filesystem_is_dot(intern-u.dir.entry.d_name));
 }
 /* }}} */
 
diff --git a/ext/spl/tests/bug62433.phpt b/ext/spl/tests/bug62433.phpt
new file mode 100644
index 000..86b5df8
--- /dev/null
+++ b/ext/spl/tests/bug62433.phpt
@@ -0,0 +1,18 @@
+--TEST--
+Bug #62433 Inconsistent behavior of RecursiveDirectoryIterator to dot files (. 
and ..)
+--FILE--
+?php
+$dots = array_keys(iterator_to_array(new RecursiveDirectoryIterator(__DIR__)));
+$ndots = array_keys(iterator_to_array(new RecursiveDirectoryIterator(__DIR__, 
FilesystemIterator::SKIP_DOTS)));
+
+var_dump(in_array(__DIR__ . '/.', $dots));
+var_dump(in_array(__DIR__ . '/..', $dots));
+
+var_dump(in_array(__DIR__ . '/.', $ndots));
+var_dump(in_array(__DIR__ . '/..', $ndots));
+?
+--EXPECT-- 
+bool(true)
+bool(true)
+bool(false)
+bool(false)


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



[PHP-CVS] com php-src: fix (signed) integer overflow (part of bug #52550: Zend/zend_hash.h

2012-07-01 Thread Nuno Lopes
Commit:f2bf98a589b63ea6e604036eb6ab02aba5fce5ef
Author:Nuno Lopes nlop...@php.net Mon, 2 Jul 2012 01:31:40 -0400
Parents:   8d81a03e434e5476c4c7832b8bcafcaa31fb474e
Branches:  master

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

Log:
fix (signed) integer overflow (part of bug #52550

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

Changed paths:
  M  Zend/zend_hash.h


Diff:
diff --git a/Zend/zend_hash.h b/Zend/zend_hash.h
index 84ca1de..5c3b1cd 100644
--- a/Zend/zend_hash.h
+++ b/Zend/zend_hash.h
@@ -330,7 +330,7 @@ END_EXTERN_C()
if (idx-1  LONG_MAX) { /* overflow */  
\
break;  
\
}   
\
-   idx = (ulong)(-(long)idx);  
\
+   idx = -idx; 
\
} else if (idx  LONG_MAX) { /* overflow */ 
\
break;  
\
}   
\


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



[PHP-CVS] com php-src: fix (signed) integer overflow (part of bug #52550: Zend/zend_hash.h

2012-07-01 Thread Nuno Lopes
Commit:d80ff391899f7aead3b9b9c6c084adba8a8203ba
Author:Nuno Lopes nlop...@php.net Mon, 2 Jul 2012 01:31:40 -0400
Parents:   250393f92523fffe643df06a1de2101fd50a327e
Branches:  PHP-5.3

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

Log:
fix (signed) integer overflow (part of bug #52550

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

Changed paths:
  M  Zend/zend_hash.h


Diff:
diff --git a/Zend/zend_hash.h b/Zend/zend_hash.h
index ad0f9f7..a763fc7 100644
--- a/Zend/zend_hash.h
+++ b/Zend/zend_hash.h
@@ -331,7 +331,7 @@ END_EXTERN_C()
if (idx-1  LONG_MAX) { /* overflow */  
\
break;  
\
}   
\
-   idx = (ulong)(-(long)idx);  
\
+   idx = -idx; 
\
} else if (idx  LONG_MAX) { /* overflow */ 
\
break;  
\
}   
\


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



[PHP-CVS] com php-src: fix (signed) integer overflow (part of bug #52550: Zend/zend_hash.h

2012-07-01 Thread Nuno Lopes
Commit:91ce8041a3e85594e81466a528f8d55cdc164c1f
Author:Nuno Lopes nlop...@php.net Mon, 2 Jul 2012 01:31:40 -0400
Parents:   be4053cea0462c9de5396641f4e4fa2f56f5a675
Branches:  PHP-5.4

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

Log:
fix (signed) integer overflow (part of bug #52550

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

Changed paths:
  M  Zend/zend_hash.h


Diff:
diff --git a/Zend/zend_hash.h b/Zend/zend_hash.h
index 84ca1de..5c3b1cd 100644
--- a/Zend/zend_hash.h
+++ b/Zend/zend_hash.h
@@ -330,7 +330,7 @@ END_EXTERN_C()
if (idx-1  LONG_MAX) { /* overflow */  
\
break;  
\
}   
\
-   idx = (ulong)(-(long)idx);  
\
+   idx = -idx; 
\
} else if (idx  LONG_MAX) { /* overflow */ 
\
break;  
\
}   
\


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