[PHP-CVS] com php-src: Use 'u...@example.com' rather than 'u...@company.com' in tests: ext/standard/tests/mail/bug51604.phpt ext/standard/tests/mail/mail_basic.phpt ext/standard/tests/mail/mail_basic2
Commit:32a4cc8353ff94d107611f00e7376e8e1baae926 Author:Sara Golemon poll...@php.net Wed, 4 Dec 2013 07:49:16 -0800 Parents: ceb1b7e20fdbbdb121a67242d0848ab923915e65 Branches: PHP-5.5 PHP-5.6 Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=32a4cc8353ff94d107611f00e7376e8e1baae926 Log: Use 'u...@example.com' rather than 'u...@company.com' in tests Using some arbitrary 3rd party's domain name is clowny, even if it never tries to send. Changed paths: M ext/standard/tests/mail/bug51604.phpt M ext/standard/tests/mail/mail_basic.phpt M ext/standard/tests/mail/mail_basic2.phpt M ext/standard/tests/mail/mail_basic3.phpt M ext/standard/tests/mail/mail_basic4.phpt M ext/standard/tests/mail/mail_basic5.phpt M ext/standard/tests/mail/mail_basic_alt1-win32.phpt M ext/standard/tests/mail/mail_basic_alt2-win32.phpt M ext/standard/tests/mail/mail_basic_alt3-win32.phpt M ext/standard/tests/mail/mail_basic_alt4-win32.phpt M ext/standard/tests/mail/mail_variation1.phpt M ext/standard/tests/mail/mail_variation2.phpt M ext/standard/tests/mail/mail_variation_alt1-win32.phpt M ext/standard/tests/mail/mail_variation_alt2-win32.phpt diff --git a/ext/standard/tests/mail/bug51604.phpt b/ext/standard/tests/mail/bug51604.phpt index a657021..988849c 100644 --- a/ext/standard/tests/mail/bug51604.phpt +++ b/ext/standard/tests/mail/bug51604.phpt @@ -11,7 +11,7 @@ if(substr(PHP_OS, 0, 3) == WIN) --FILE-- ?php // Initialise all required variables -$to = 'u...@company.com'; +$to = 'u...@example.com'; $subject = 'Test Subject'; $message = 'A Message'; $additional_headers = KHeaders\n\n\n\n\n; @@ -27,7 +27,7 @@ unlink($outFile); ===DONE=== --EXPECT-- bool(true) -To: u...@company.com +To: u...@example.com Subject: Test Subject KHeaders diff --git a/ext/standard/tests/mail/mail_basic.phpt b/ext/standard/tests/mail/mail_basic.phpt index fecb50f..70f32df 100644 --- a/ext/standard/tests/mail/mail_basic.phpt +++ b/ext/standard/tests/mail/mail_basic.phpt @@ -20,7 +20,7 @@ echo *** Testing mail() : basic functionality ***\n; // Initialise all required variables -$to = 'u...@company.com'; +$to = 'u...@example.com'; $subject = 'Test Subject'; $message = 'A Message'; $additional_headers = 'KHeaders'; @@ -45,7 +45,7 @@ unlink($outFile); *** Testing mail() : basic functionality *** -- All Mail Content Parameters -- bool(true) -To: u...@company.com +To: u...@example.com Subject: Test Subject KHeaders @@ -53,7 +53,7 @@ A Message -- Mandatory Parameters -- bool(true) -To: u...@company.com +To: u...@example.com Subject: Test Subject A Message diff --git a/ext/standard/tests/mail/mail_basic2.phpt b/ext/standard/tests/mail/mail_basic2.phpt index 8967d18..60ad009 100644 --- a/ext/standard/tests/mail/mail_basic2.phpt +++ b/ext/standard/tests/mail/mail_basic2.phpt @@ -20,7 +20,7 @@ echo *** Testing mail() : basic functionality ***\n; // Initialise all required variables -$to = 'u...@company.com'; +$to = 'u...@example.com'; $subject = 'Test Subject'; $message = 'A Message'; $additional_headers = 'KHeaders'; @@ -40,7 +40,7 @@ unlink($outFile); *** Testing mail() : basic functionality *** -- extra parameters -- bool(true) -%w1%wTo: u...@company.com +%w1%wTo: u...@example.com %w2%wSubject: Test Subject %w3%wKHeaders %w4%w diff --git a/ext/standard/tests/mail/mail_basic3.phpt b/ext/standard/tests/mail/mail_basic3.phpt index 58eae03..3e648e5 100644 --- a/ext/standard/tests/mail/mail_basic3.phpt +++ b/ext/standard/tests/mail/mail_basic3.phpt @@ -19,7 +19,7 @@ echo *** Testing mail() : basic functionality ***\n; // Initialise all required variables -$to = 'u...@company.com'; +$to = 'u...@example.com'; $subject = 'Test Subject'; $message = 'A Message'; diff --git a/ext/standard/tests/mail/mail_basic4.phpt b/ext/standard/tests/mail/mail_basic4.phpt index 9ecc886..de2407a 100644 --- a/ext/standard/tests/mail/mail_basic4.phpt +++ b/ext/standard/tests/mail/mail_basic4.phpt @@ -19,7 +19,7 @@ echo *** Testing mail() : basic functionality ***\n; // Initialise all required variables -$to = 'u...@company.com'; +$to = 'u...@example.com'; $subject = 'Test Subject'; $message = 'A Message'; diff --git a/ext/standard/tests/mail/mail_basic5.phpt b/ext/standard/tests/mail/mail_basic5.phpt index 7e42ccb..8d755eb 100644 --- a/ext/standard/tests/mail/mail_basic5.phpt +++ b/ext/standard/tests/mail/mail_basic5.phpt @@ -19,7 +19,7 @@ echo *** Testing mail() : basic functionality ***\n; // Initialise all required variables -$to = 'u...@company.com'; +$to = 'u...@example.com'; $subject = 'Test Subject'; $message = 'A Message'; diff --git a/ext/standard/tests/mail/mail_basic_alt1-win32.phpt b/ext/standard/tests/mail/mail_basic_alt1-win32.phpt index 3c4dd88..fc50498 100644 --- a/ext/standard/tests/mail/mail_basic_alt1-win32.phpt +++ b/ext/standard/tests/mail/mail_basic_alt1-win32.phpt @@ -22,7 +22,7 @@ max_execution_time = 120
[PHP-CVS] com php-src: Merge branch 'PHP-5.5' into PHP-5.6: main/main.c
Commit:df755deb451aa2787a8663fc78643de7642ace08 Author:Sara Golemon poll...@php.net Tue, 3 Dec 2013 18:21:12 -0800 Parents: 44697c115b3098db677e42e78c11a0cc9e0e0019 00a7b1ff7fed49df51d0392d47aa79f63bf1c66e Branches: PHP-5.6 master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=df755deb451aa2787a8663fc78643de7642ace08 Log: Merge branch 'PHP-5.5' into PHP-5.6 * PHP-5.5: Fix php_module_startup() when loading more than one additional module Changed paths: MM main/main.c Diff: -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] com php-src: fix missing change from 'tcp_socket' to the more common 'server': ext/standard/tests/file/fread_socket_variation1.phpt
Commit:361e984e462de5422bba5470d3961e67de327396 Author:ptarjan ptar...@fb.com Thu, 26 Sep 2013 01:06:36 -0700 Parents: ecbe4af0de94c629fa5ba8ab169654e00c958bad Branches: master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=361e984e462de5422bba5470d3961e67de327396 Log: fix missing change from 'tcp_socket' to the more common 'server' Changed paths: M ext/standard/tests/file/fread_socket_variation1.phpt Diff: diff --git a/ext/standard/tests/file/fread_socket_variation1.phpt b/ext/standard/tests/file/fread_socket_variation1.phpt index f5086ce..d65565d 100644 --- a/ext/standard/tests/file/fread_socket_variation1.phpt +++ b/ext/standard/tests/file/fread_socket_variation1.phpt @@ -12,11 +12,11 @@ for ($i=0; $i100; $i++) { } } -socket_set_timeout($tcp_socket, 0, 1000); +socket_set_timeout($server, 0, 1000); -var_dump(fread($tcp_socket, 1)); +var_dump(fread($server, 1)); -fclose($tcp_socket); +fclose($server); ? --EXPECT-- -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] com php-src: Add a couple more test cases to parse_url() tests: ext/standard/tests/url/parse_url_basic_001.phpt ext/standard/tests/url/parse_url_basic_002.phpt ext/standard/tests/url/parse_u
Commit:95017c0522a9a1b9527d7cc1d866fbc3b89df7ac Author:Sara Golemon poll...@php.net Wed, 10 Jul 2013 08:26:47 -0700 Parents: 914f8fd30446e971f2aa1f773d545f1492409038 Branches: master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=95017c0522a9a1b9527d7cc1d866fbc3b89df7ac Log: Add a couple more test cases to parse_url() tests http://::# (valid but silly) http://# (invalid) Changed paths: M ext/standard/tests/url/parse_url_basic_001.phpt M ext/standard/tests/url/parse_url_basic_002.phpt M ext/standard/tests/url/parse_url_basic_003.phpt M ext/standard/tests/url/parse_url_basic_004.phpt M ext/standard/tests/url/parse_url_basic_005.phpt M ext/standard/tests/url/parse_url_basic_006.phpt M ext/standard/tests/url/parse_url_basic_007.phpt M ext/standard/tests/url/parse_url_basic_008.phpt M ext/standard/tests/url/parse_url_basic_009.phpt M ext/standard/tests/url/urls.inc diff --git a/ext/standard/tests/url/parse_url_basic_001.phpt b/ext/standard/tests/url/parse_url_basic_001.phpt index 1edc32e..4c5b094 100644 --- a/ext/standard/tests/url/parse_url_basic_001.phpt +++ b/ext/standard/tests/url/parse_url_basic_001.phpt @@ -743,6 +743,13 @@ echo Done; string(1) : } +-- http://::#: array(2) { + [scheme]= + string(4) http + [host]= + string(1) : +} + -- x://::6.5: array(3) { [scheme]= string(1) x @@ -856,6 +863,8 @@ echo Done; -- http://?: bool(false) +-- http://#: bool(false) + -- http://?:: bool(false) -- http://:?: bool(false) @@ -863,4 +872,4 @@ echo Done; -- http://blah.com:123456: bool(false) -- http://blah.com:abcdef: bool(false) -Done \ No newline at end of file +Done diff --git a/ext/standard/tests/url/parse_url_basic_002.phpt b/ext/standard/tests/url/parse_url_basic_002.phpt index 464e977..ed0f08a 100644 --- a/ext/standard/tests/url/parse_url_basic_002.phpt +++ b/ext/standard/tests/url/parse_url_basic_002.phpt @@ -96,6 +96,7 @@ echo Done; -- x:/blah.com : string(1) x -- x://::abc/? : bool(false) -- http://::? : string(4) http +-- http://::# : string(4) http -- x://::6.5 : string(1) x -- http://?:/ : string(4) http -- http://@?:/ : string(4) http @@ -118,8 +119,9 @@ echo Done; -- http://@:/ : bool(false) -- http://:/ : bool(false) -- http://? : bool(false) +-- http://# : bool(false) -- http://?: : bool(false) -- http://:? : bool(false) -- http://blah.com:123456 : bool(false) -- http://blah.com:abcdef : bool(false) -Done \ No newline at end of file +Done diff --git a/ext/standard/tests/url/parse_url_basic_003.phpt b/ext/standard/tests/url/parse_url_basic_003.phpt index 57f182b..a2bbfa6 100644 --- a/ext/standard/tests/url/parse_url_basic_003.phpt +++ b/ext/standard/tests/url/parse_url_basic_003.phpt @@ -95,6 +95,7 @@ echo Done; -- x:/blah.com : NULL -- x://::abc/? : bool(false) -- http://::? : string(1) : +-- http://::# : string(1) : -- x://::6.5 : string(1) : -- http://?:/ : string(1) ? -- http://@?:/ : string(1) ? @@ -117,8 +118,9 @@ echo Done; -- http://@:/ : bool(false) -- http://:/ : bool(false) -- http://? : bool(false) +-- http://# : bool(false) -- http://?: : bool(false) -- http://:? : bool(false) -- http://blah.com:123456 : bool(false) -- http://blah.com:abcdef : bool(false) -Done \ No newline at end of file +Done diff --git a/ext/standard/tests/url/parse_url_basic_004.phpt b/ext/standard/tests/url/parse_url_basic_004.phpt index 6abf4ed..839ebee 100644 --- a/ext/standard/tests/url/parse_url_basic_004.phpt +++ b/ext/standard/tests/url/parse_url_basic_004.phpt @@ -95,6 +95,7 @@ echo Done; -- x:/blah.com : NULL -- x://::abc/? : bool(false) -- http://::? : NULL +-- http://::# : NULL -- x://::6.5 : int(6) -- http://?:/ : NULL -- http://@?:/ : NULL @@ -117,8 +118,9 @@ echo Done; -- http://@:/ : bool(false) -- http://:/ : bool(false) -- http://? : bool(false) +-- http://# : bool(false) -- http://?: : bool(false) -- http://:? : bool(false) -- http://blah.com:123456 : bool(false) -- http://blah.com:abcdef : bool(false) -Done \ No newline at end of file +Done diff --git a/ext/standard/tests/url/parse_url_basic_005.phpt b/ext/standard/tests/url/parse_url_basic_005.phpt index 3bcc891..c113461 100644 --- a/ext/standard/tests/url/parse_url_basic_005.phpt +++ b/ext/standard/tests/url/parse_url_basic_005.phpt @@ -95,6 +95,7 @@ echo Done; -- x:/blah.com : NULL -- x://::abc/? : bool(false) -- http://::? : NULL +-- http://::# : NULL -- x://::6.5 : NULL -- http://?:/ : NULL -- http://@?:/ : string(0) @@ -117,8 +118,9 @@ echo Done; -- http://@:/ : bool(false) -- http://:/ : bool(false) -- http://? : bool(false) +-- http://# : bool(false) -- http://?: : bool(false) -- http://:? : bool(false) -- http://blah.com:123456 : bool(false) -- http://blah.com:abcdef : bool(false) -Done \ No newline at end of file +Done diff --git a/ext/standard/tests/url
[PHP-CVS] com php-src: Don't double-quote name of namespaced function.: Zend/zend_API.h
Commit:2d5695cbc5a627cb278b3ab0b1f5eed2f8be1bee Author:Sara Golemon poll...@php.net Sun, 19 May 2013 13:32:17 -0700 Parents: 4828f7343b3f31d914f4d4a5545865b8a19f7fb6 Branches: PHP-5.3 PHP-5.4 PHP-5.5 master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=2d5695cbc5a627cb278b3ab0b1f5eed2f8be1bee Log: Don't double-quote name of namespaced function. ZEND_NS_NAMED_FE(ns, zend_name, name, arg_info) was resulting in a function declaration of: ns\zend_name() including the errant quotes. This diff corrects that. There are currently no uses of ZEND_NS_NAMED_FE in core and reason to believe that there are no uses in the wild either. Changed paths: M Zend/zend_API.h Diff: diff --git a/Zend/zend_API.h b/Zend/zend_API.h index f6f2c46..304715d 100644 --- a/Zend/zend_API.h +++ b/Zend/zend_API.h @@ -90,7 +90,7 @@ typedef struct _zend_fcall_info_cache { #define ZEND_NS_RAW_FENTRY(ns, zend_name, name, arg_info, flags) ZEND_RAW_FENTRY(ZEND_NS_NAME(ns, zend_name), name, arg_info, flags) #define ZEND_NS_RAW_NAMED_FE(ns, zend_name, name, arg_info) ZEND_NS_RAW_FENTRY(ns, #zend_name, name, arg_info, 0) -#define ZEND_NS_NAMED_FE(ns, zend_name, name, arg_info) ZEND_NS_FENTRY(ns, #zend_name, name, arg_info, 0) +#define ZEND_NS_NAMED_FE(ns, zend_name, name, arg_info) ZEND_NS_FENTRY(ns, zend_name, name, arg_info, 0) #define ZEND_NS_FE(ns, name, arg_info) ZEND_NS_FENTRY(ns, name, ZEND_FN(name), arg_info, 0) #define ZEND_NS_DEP_FE(ns, name, arg_info) ZEND_NS_FENTRY(ns, name, ZEND_FN(name), arg_info, ZEND_ACC_DEPRECATED) #define ZEND_NS_FALIAS(ns, name, alias, arg_info) ZEND_NS_FENTRY(ns, name, ZEND_FN(alias), arg_info, 0) -- 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.3' into PHP-5.4: Zend/zend_API.h
Commit:2d7415a4af66e0771b36a10534e304fe7af4a855 Author:Sara Golemon poll...@php.net Sun, 19 May 2013 13:34:57 -0700 Parents: 646ebc2cb9148404ffbccf14413b794f3a1e0688 2d5695cbc5a627cb278b3ab0b1f5eed2f8be1bee Branches: PHP-5.4 PHP-5.5 master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=2d7415a4af66e0771b36a10534e304fe7af4a855 Log: Merge branch 'PHP-5.3' into PHP-5.4 * PHP-5.3: Don't double-quote name of namespaced function. Changed paths: MM Zend/zend_API.h 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: Zend/zend_API.h
Commit:4f46a40b9df80ef3faf498262c7a06a77ee98041 Author:Sara Golemon poll...@php.net Sun, 19 May 2013 13:35:03 -0700 Parents: 4840ff0f05876ee614d17804d2340f2233eb4111 2d7415a4af66e0771b36a10534e304fe7af4a855 Branches: PHP-5.5 master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=4f46a40b9df80ef3faf498262c7a06a77ee98041 Log: Merge branch 'PHP-5.4' into PHP-5.5 * PHP-5.4: Don't double-quote name of namespaced function. Changed paths: MM Zend/zend_API.h 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 second arg to unserialize(): ext/standard/basic_functions.c ext/standard/tests/serialize/serialization_error_001.phpt ext/standard/tests/serialize/unserialize_consu
Commit:cfd104582220d578ab1b78a5991065d038e1f931 Author:Sara Golemon poll...@php.net Thu, 16 May 2013 14:37:36 -0700 Parents: bc656cde0453aa6de50812ba9edfc6f74c61ce37 Branches: master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=cfd104582220d578ab1b78a5991065d038e1f931 Log: Add optional second arg to unserialize() Returns the number of bytes consumed by reference for streaming unserialization. Actual unserialization behavior is not modified at all. The need for this came up while trying to parse SplDoublyLinkedList's serialization format which uses a non-standard stream of serialized values. Changed paths: M ext/standard/basic_functions.c M ext/standard/tests/serialize/serialization_error_001.phpt A ext/standard/tests/serialize/unserialize_consumed.phpt M ext/standard/var.c Diff: diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c index 9c91404..1379117 100644 --- a/ext/standard/basic_functions.c +++ b/ext/standard/basic_functions.c @@ -2679,6 +2679,7 @@ ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO(arginfo_unserialize, 0) ZEND_ARG_INFO(0, variable_representation) + ZEND_ARG_INFO(1, consumed) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(arginfo_memory_get_usage, 0, 0, 0) diff --git a/ext/standard/tests/serialize/serialization_error_001.phpt b/ext/standard/tests/serialize/serialization_error_001.phpt index da6f50c..c6c1751 100644 --- a/ext/standard/tests/serialize/serialization_error_001.phpt +++ b/ext/standard/tests/serialize/serialization_error_001.phpt @@ -21,7 +21,7 @@ var_dump( unserialize() ); //Test serialize with one more than the expected number of arguments var_dump( serialize(1,2) ); -var_dump( unserialize(1,2) ); +var_dump( unserialize(1,$x,2) ); echo Done; ? @@ -31,12 +31,12 @@ echo Done; Warning: serialize() expects exactly 1 parameter, 0 given in %s on line 16 NULL -Warning: unserialize() expects exactly 1 parameter, 0 given in %s on line 17 +Warning: unserialize() expects at least 1 parameter, 0 given in %s on line 17 bool(false) Warning: serialize() expects exactly 1 parameter, 2 given in %s on line 20 NULL -Warning: unserialize() expects exactly 1 parameter, 2 given in %s on line 21 +Warning: unserialize() expects at most 2 parameters, 3 given in %s on line 21 bool(false) Done diff --git a/ext/standard/tests/serialize/unserialize_consumed.phpt b/ext/standard/tests/serialize/unserialize_consumed.phpt new file mode 100644 index 000..6cc11e2 --- /dev/null +++ b/ext/standard/tests/serialize/unserialize_consumed.phpt @@ -0,0 +1,27 @@ +--TEST-- +Unserialization of partial strings +--FILE-- +?php +$data = [123,4.56,true]; +$ser = serialize($data); +$serlen = strlen($ser); + +$unser = unserialize($ser, $consumed); +echo Consume full string: ; +var_dump($serlen == $consumed); +echo Return original data: ; +var_dump($unser === $data); + +$ser .= junk\x01data; +$unser = unserialize($ser, $consumed); +echo Consume full string(junk): ; +var_dump($serlen == $consumed); +echo Return original data(junk): ; +var_dump($unser === $data); + +--EXPECT-- +Consume full string: bool(true) +Return original data: bool(true) +Consume full string(junk): bool(true) +Return original data(junk): bool(true) + diff --git a/ext/standard/var.c b/ext/standard/var.c index f76a14c..4acc6f5 100644 --- a/ext/standard/var.c +++ b/ext/standard/var.c @@ -945,7 +945,7 @@ PHP_FUNCTION(serialize) } /* }}} */ -/* {{{ proto mixed unserialize(string variable_representation) +/* {{{ proto mixed unserialize(string variable_representation[, int consumed]) Takes a string representation of variable and recreates it */ PHP_FUNCTION(unserialize) { @@ -953,8 +953,9 @@ PHP_FUNCTION(unserialize) int buf_len; const unsigned char *p; php_unserialize_data_t var_hash; + zval *consumed = NULL; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, s, buf, buf_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, s|z, buf, buf_len, consumed) == FAILURE) { RETURN_FALSE; } @@ -973,6 +974,11 @@ PHP_FUNCTION(unserialize) RETURN_FALSE; } PHP_VAR_UNSERIALIZE_DESTROY(var_hash); + + if (consumed) { + zval_dtor(consumed); + ZVAL_LONG(consumed, ((char*)p) - buf); + } } /* }}} */ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] com php-src: Fix race condition when ext/hash/tests run in parallel: ext/hash/tests/hash_file_basic.phpt ext/hash/tests/hash_file_error.phpt
Commit:6aefaad46e98f8d434244c99cc7bd254330b1dc9 Author:Sara Golemon poll...@php.net Tue, 30 Apr 2013 16:28:37 -0700 Parents: 734cb61f819c3fd15f993a54e209d8375ade3982 Branches: master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=6aefaad46e98f8d434244c99cc7bd254330b1dc9 Log: Fix race condition when ext/hash/tests run in parallel Changed paths: M ext/hash/tests/hash_file_basic.phpt M ext/hash/tests/hash_file_error.phpt Diff: diff --git a/ext/hash/tests/hash_file_basic.phpt b/ext/hash/tests/hash_file_basic.phpt index 9851c14..b16927d 100644 --- a/ext/hash/tests/hash_file_basic.phpt +++ b/ext/hash/tests/hash_file_basic.phpt @@ -15,7 +15,7 @@ Felix De Vliegher felix.devlieg...@gmail.com echo *** Testing hash_file() : basic functionality ***\n; // Set up file -$filename = 'hash_file_example.txt'; +$filename = 'hash_file_basic_example.txt'; file_put_contents( $filename, 'The quick brown fox jumped over the lazy dog.' ); var_dump( hash_file( 'md5', $filename ) ); @@ -30,7 +30,7 @@ var_dump( base64_encode( hash_file( 'md5', $filename, true ) ) ); --CLEAN-- ?php -$filename = 'hash_file_example.txt'; +$filename = 'hash_file_basic_example.txt'; unlink( $filename ); ? diff --git a/ext/hash/tests/hash_file_error.phpt b/ext/hash/tests/hash_file_error.phpt index 326fbd5..e138030 100644 --- a/ext/hash/tests/hash_file_error.phpt +++ b/ext/hash/tests/hash_file_error.phpt @@ -15,7 +15,7 @@ Felix De Vliegher felix.devlieg...@gmail.com echo *** Testing hash_file() : error conditions ***\n; // Set up file -$filename = 'hash_file_example.txt'; +$filename = 'hash_file_error_example.txt'; file_put_contents( $filename, 'The quick brown fox jumped over the lazy dog.' ); @@ -38,7 +38,7 @@ var_dump( hash_file( 'md5', $filename, false, $extra_arg ) ); --CLEAN-- ?php -$filename = 'hash_file_example.txt'; +$filename = 'hash_file_error_example.txt'; unlink( $filename ); ? -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] com php-src: Harden loopback tests: ext/sockets/tests/ipv4loop.phpt ext/sockets/tests/ipv6loop.phpt ext/sockets/tests/socket_getpeername_ipv4loop.phpt ext/sockets/tests/socket_getpeername_ip
Commit:e217db8e6921446da93d656c9b22efed5a671581 Author:Sara Golemon poll...@php.net Tue, 30 Apr 2013 19:30:55 -0700 Parents: 6aefaad46e98f8d434244c99cc7bd254330b1dc9 Branches: master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=e217db8e6921446da93d656c9b22efed5a671581 Log: Harden loopback tests These tests depend on being able to bind port 31337. Try a range of ports until one binds or we give up trying. Changed paths: M ext/sockets/tests/ipv4loop.phpt M ext/sockets/tests/ipv6loop.phpt M ext/sockets/tests/socket_getpeername_ipv4loop.phpt M ext/sockets/tests/socket_getpeername_ipv6loop.phpt Diff: diff --git a/ext/sockets/tests/ipv4loop.phpt b/ext/sockets/tests/ipv4loop.phpt index 9fdcc17..920b27b 100644 --- a/ext/sockets/tests/ipv4loop.phpt +++ b/ext/sockets/tests/ipv4loop.phpt @@ -13,8 +13,15 @@ IPv4 Loopback test if (!$server) { die('Unable to create AF_INET socket [server]'); } - if (!socket_bind($server, '127.0.0.1', 31337)) { - die('Unable to bind to 127.0.0.1:31337'); + $bound = false; + for($port = 31337; $port 31357; ++$port) { + if (socket_bind($server, '127.0.0.1', $port)) { + $bound = true; + break; + } + } + if (!$bound) { + die(Unable to bind to 127.0.0.1); } if (!socket_listen($server, 2)) { die('Unable to listen on socket'); @@ -25,7 +32,7 @@ IPv4 Loopback test if (!$client) { die('Unable to create AF_INET socket [client]'); } - if (!socket_connect($client, '127.0.0.1', 31337)) { + if (!socket_connect($client, '127.0.0.1', $port)) { die('Unable to connect to server socket'); } diff --git a/ext/sockets/tests/ipv6loop.phpt b/ext/sockets/tests/ipv6loop.phpt index 6967605..0d51bb0 100644 --- a/ext/sockets/tests/ipv6loop.phpt +++ b/ext/sockets/tests/ipv6loop.phpt @@ -14,8 +14,15 @@ IPv6 Loopback test if (!$server) { die('Unable to create AF_INET6 socket [server]'); } - if (!socket_bind($server, '::1', 31337)) { - die('Unable to bind to [::1]:31337'); + $bound = false; + for($port = 31337; $port 31357; ++$port) { + if (socket_bind($server, '::1', $port)) { + $bound = true; + break; + } + } + if (!$bound) + die(Unable to bind to [::1]:$port); } if (!socket_listen($server, 2)) { die('Unable to listen on socket'); @@ -26,7 +33,7 @@ IPv6 Loopback test if (!$client) { die('Unable to create AF_INET6 socket [client]'); } - if (!socket_connect($client, '::1', 31337)) { + if (!socket_connect($client, '::1', $port)) { die('Unable to connect to server socket'); } diff --git a/ext/sockets/tests/socket_getpeername_ipv4loop.phpt b/ext/sockets/tests/socket_getpeername_ipv4loop.phpt index aa59abb..b948e0e 100644 --- a/ext/sockets/tests/socket_getpeername_ipv4loop.phpt +++ b/ext/sockets/tests/socket_getpeername_ipv4loop.phpt @@ -14,17 +14,23 @@ ext/sockets - socket_getpeername_ipv4loop - basic test /* Bind and connect sockets to localhost */ $localhost = '127.0.0.1'; - /* Hold the port associated to address */ - $port = 31337; - /* Setup socket server */ $server = socket_create(AF_INET, SOCK_STREAM, getprotobyname('tcp')); if (!$server) { die('Unable to create AF_INET socket [server]'); } - -if (!socket_bind($server, $localhost, $port)) { -die('Unable to bind to '.$localhost.':'.$port); + + $minport = 31337; + $maxport = 31356; + $bound = false; + for($port = $minport; $port = $maxport; ++$port) { + if (socket_bind($server, $localhost, $port)) { + $bound = true; + break; + } + } + if (!$bound) { +die('Unable to bind to '.$localhost); } if (!socket_listen($server, 2)) { die('Unable to listen on socket'); @@ -45,10 +51,10 @@ ext/sockets - socket_getpeername_ipv4loop - basic test die('Unable to accept connection'); } - if (!socket_getpeername($client, $address, $port)) { + if (!socket_getpeername($client, $address, $peerport)) { die('Unable to retrieve peer name'); } -var_dump($address, $port); +var_dump($address, $port === $peerport); socket_close($client); socket_close($socket); @@ -56,4 +62,4 @@ ext/sockets - socket_getpeername_ipv4loop - basic test ? --EXPECT-- string(9) 127.0.0.1 -int(31337) +bool(true) diff --git a/ext/sockets/tests/socket_getpeername_ipv6loop.phpt
[PHP-CVS] com php-src: Oops: ext/sockets/tests/ipv6loop.phpt
Commit:e836f8e38fb188e67eee0dce810cbe1f076e519b Author:Sara Golemon poll...@php.net Tue, 30 Apr 2013 19:43:52 -0700 Parents: e217db8e6921446da93d656c9b22efed5a671581 Branches: master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=e836f8e38fb188e67eee0dce810cbe1f076e519b Log: Oops Changed paths: M ext/sockets/tests/ipv6loop.phpt Diff: diff --git a/ext/sockets/tests/ipv6loop.phpt b/ext/sockets/tests/ipv6loop.phpt index 0d51bb0..4720cb4 100644 --- a/ext/sockets/tests/ipv6loop.phpt +++ b/ext/sockets/tests/ipv6loop.phpt @@ -21,7 +21,7 @@ IPv6 Loopback test break; } } - if (!$bound) + if (!$bound) { die(Unable to bind to [::1]:$port); } if (!socket_listen($server, 2)) { -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] com php-src: Fix zlib/tests/gzseek to create unique temporary files: ext/zlib/tests/gzseek_basic2.phpt ext/zlib/tests/gzseek_variation1.phpt ext/zlib/tests/gzseek_variation4.phpt ext/zlib/te
Commit:22f6b6dbec4772febe0e3c31bceeb31eecf806ab Author:ptarjan ptar...@fb.com Thu, 25 Apr 2013 00:13:30 -0700 Committer: Sara Golemon poll...@php.net Wed, 24 Apr 2013 01:06:55 -0700 Parents: 4c0746228d51e58b47a661f9501503e29b1756f8 Branches: master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=22f6b6dbec4772febe0e3c31bceeb31eecf806ab Log: Fix zlib/tests/gzseek to create unique temporary files When running tests in parallel these create a race condition. Race conditions are bad. Changed paths: M ext/zlib/tests/gzseek_basic2.phpt M ext/zlib/tests/gzseek_variation1.phpt M ext/zlib/tests/gzseek_variation4.phpt M ext/zlib/tests/gzseek_variation5.phpt M ext/zlib/tests/gzseek_variation7.phpt Diff: diff --git a/ext/zlib/tests/gzseek_basic2.phpt b/ext/zlib/tests/gzseek_basic2.phpt index a815b8f..82d305d 100644 --- a/ext/zlib/tests/gzseek_basic2.phpt +++ b/ext/zlib/tests/gzseek_basic2.phpt @@ -8,7 +8,7 @@ if (!extension_loaded(zlib)) { ? --FILE-- ?php -$f = temp3.txt.gz; +$f = gzseek_basic2.gz; $h = gzopen($f, 'w'); $str1 = This is the first line.; $str2 = This is the second line.; @@ -39,4 +39,4 @@ reading the output file This is the first line. string(40) This is the second line. -===DONE=== \ No newline at end of file +===DONE=== diff --git a/ext/zlib/tests/gzseek_variation1.phpt b/ext/zlib/tests/gzseek_variation1.phpt index 301b57d..b260783 100644 --- a/ext/zlib/tests/gzseek_variation1.phpt +++ b/ext/zlib/tests/gzseek_variation1.phpt @@ -8,7 +8,7 @@ if (!extension_loaded(zlib)) { ? --FILE-- ?php -$f = temp3.txt.gz; +$f = gzseek_variation1.gz; $h = gzopen($f, 'w'); $str1 = This is the first line.; $str2 = This is the second line.; @@ -30,4 +30,4 @@ unlink($f); This is the first line. string(40) This is the second line. -===DONE=== \ No newline at end of file +===DONE=== diff --git a/ext/zlib/tests/gzseek_variation4.phpt b/ext/zlib/tests/gzseek_variation4.phpt index fc641f6..3d0cf67 100644 --- a/ext/zlib/tests/gzseek_variation4.phpt +++ b/ext/zlib/tests/gzseek_variation4.phpt @@ -8,7 +8,7 @@ if (!extension_loaded(zlib)) { ? --FILE-- ?php -$f = temp3.txt.gz; +$f = gzseek_variation5.gz; $h = gzopen($f, 'w'); $str1 = This is the first line.; $str2 = This is the second line.; @@ -39,4 +39,4 @@ reading the output file This is the first line. string(40) This is the second line. -===DONE=== \ No newline at end of file +===DONE=== diff --git a/ext/zlib/tests/gzseek_variation5.phpt b/ext/zlib/tests/gzseek_variation5.phpt index 0167e20..93fb19f 100644 --- a/ext/zlib/tests/gzseek_variation5.phpt +++ b/ext/zlib/tests/gzseek_variation5.phpt @@ -8,7 +8,7 @@ if (!extension_loaded(zlib)) { ? --FILE-- ?php -$f = temp3.txt.gz; +$f = gzseek_variation5.gz; $h = gzopen($f, 'w'); $str1 = This is the first line.; $str2 = This is the second line.; @@ -39,4 +39,4 @@ reading the output file This is the first line. string(40) This is the second line. -===DONE=== \ No newline at end of file +===DONE=== diff --git a/ext/zlib/tests/gzseek_variation7.phpt b/ext/zlib/tests/gzseek_variation7.phpt index aab0834..a365272 100644 --- a/ext/zlib/tests/gzseek_variation7.phpt +++ b/ext/zlib/tests/gzseek_variation7.phpt @@ -8,7 +8,7 @@ if (!extension_loaded(zlib)) { ? --FILE-- ?php -$f = temp3.txt.gz; +$f = gzseek_variation7.gz; $h = gzopen($f, 'w'); $str1 = This is the first line.; $str2 = This is the second line.; @@ -44,4 +44,4 @@ tell=int(47) reading the output file This is the first line.This is the second line. -===DONE=== \ No newline at end of file +===DONE=== -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] com php-src: Fix handling of double keys in array_column: ext/standard/array.c ext/standard/tests/array/array_column_basic.phpt ext/standard/tests/array/array_column_error.phpt
Commit:7b34324f846505a0af6bed83556b840b50a1ef30 Author:Sara Golemon poll...@php.net Sun, 21 Apr 2013 22:21:40 -0700 Parents: b119836765a72700a07b004b95c92beffa3daf95 Branches: PHP-5.5 master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=7b34324f846505a0af6bed83556b840b50a1ef30 Log: Fix handling of double keys in array_column Also fix resource test to not localize __FILE__ to cwd. Changed paths: M ext/standard/array.c M ext/standard/tests/array/array_column_basic.phpt M ext/standard/tests/array/array_column_error.phpt Diff: diff --git a/ext/standard/array.c b/ext/standard/array.c index 9a64cf4..425d53e 100644 --- a/ext/standard/array.c +++ b/ext/standard/array.c @@ -2547,6 +2547,9 @@ PHP_FUNCTION(array_column) case IS_LONG: column_idx = Z_LVAL_PP(zcolumn); break; + case IS_DOUBLE: + column_idx = (long)Z_DVAL_PP(zcolumn); + break; case IS_STRING: column = Z_STRVAL_PP(zcolumn); column_len = Z_STRLEN_PP(zcolumn); @@ -2569,6 +2572,9 @@ PHP_FUNCTION(array_column) case IS_LONG: key_idx = Z_LVAL_PP(zkey); break; + case IS_DOUBLE: + key_idx = (long)Z_DVAL_PP(zkey); + break; case IS_STRING: key = Z_STRVAL_PP(zkey); key_len = Z_STRLEN_PP(zkey); diff --git a/ext/standard/tests/array/array_column_basic.phpt b/ext/standard/tests/array/array_column_basic.phpt index 70ce213..8c49910 100644 --- a/ext/standard/tests/array/array_column_basic.phpt +++ b/ext/standard/tests/array/array_column_basic.phpt @@ -42,8 +42,7 @@ echo -- last_name column from recordset, keyed by value from first_name column var_dump(array_column($records, 'last_name', 'first_name')); echo \n*** Testing multiple data types ***\n; -$file = basename(__FILE__); -$fh = fopen($file, 'r', true); +$fh = fopen(__FILE__, 'r', true); $values = array( array( 'id' = 1, @@ -89,11 +88,13 @@ $numericCols = array( ); var_dump(array_column($numericCols, 1)); var_dump(array_column($numericCols, 1, 0)); +var_dump(array_column($numericCols, 1, 0.123)); echo \n*** Testing failure to find specified column ***\n; var_dump(array_column($numericCols, 2)); var_dump(array_column($numericCols, 'foo')); var_dump(array_column($numericCols, 0, 'foo')); +var_dump(array_column($numericCols, 3.14)); echo \n*** Testing single dimensional array ***\n; $singleDimension = array('foo', 'bar', 'baz'); @@ -230,6 +231,14 @@ array(3) { [ccc]= string(3) 333 } +array(3) { + [aaa]= + string(3) 111 + [bbb]= + string(3) 222 + [ccc]= + string(3) 333 +} *** Testing failure to find specified column *** array(0) { @@ -244,6 +253,8 @@ array(3) { [2]= string(3) ccc } +array(0) { +} *** Testing single dimensional array *** array(0) { diff --git a/ext/standard/tests/array/array_column_error.phpt b/ext/standard/tests/array/array_column_error.phpt index 1aec1ac..bdcbec0 100644 --- a/ext/standard/tests/array/array_column_error.phpt +++ b/ext/standard/tests/array/array_column_error.phpt @@ -26,18 +26,12 @@ var_dump(array_column(1, 'foo')); echo \n-- Testing array_column() column key parameter should be a string or an integer (testing bool) --\n; var_dump(array_column(array(), true)); -echo \n-- Testing array_column() column key parameter should be a string or integer (testing float) --\n; -var_dump(array_column(array(), 2.3)); - echo \n-- Testing array_column() column key parameter should be a string or integer (testing array) --\n; var_dump(array_column(array(), array())); echo \n-- Testing array_column() index key parameter should be a string or an integer (testing bool) --\n; var_dump(array_column(array(), 'foo', true)); -echo \n-- Testing array_column() index key parameter should be a string or integer (testing float) --\n; -var_dump(array_column(array(), 'foo', 2.3)); - echo \n-- Testing array_column() index key parameter should be a string or integer (testing array) --\n; var_dump(array_column(array(), 'foo', array())); @@ -71,11 +65,6 @@ NULL Warning: array_column(): The column key should be either a string or an integer in %s on line %d bool(false) --- Testing array_column() column key parameter should be a string or integer (testing float) -- - -Warning: array_column(): The column key should be either a string or an integer in %s on line %d -bool(false) - -- Testing array_column() column key parameter should be a string or integer (testing array) -- Warning: array_column(): The column key should be either a string or an integer in %s on line %d @@ -86,11 +75,6 @@ bool(false) Warning: array_column(): The index
[PHP-CVS] com php-src: Harden array_column_basic.phpt against resource renumbering.: ext/standard/tests/array/array_column_basic.phpt
Commit:f63db963c48775e89e7d5f63235733098c2f653d Author:Sara Golemon poll...@php.net Mon, 22 Apr 2013 13:36:40 -0700 Parents: 7b34324f846505a0af6bed83556b840b50a1ef30 Branches: PHP-5.5 master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=f63db963c48775e89e7d5f63235733098c2f653d Log: Harden array_column_basic.phpt against resource renumbering. We don't care what resource number it is, so long as there's a stream resource returned. Changed paths: M ext/standard/tests/array/array_column_basic.phpt Diff: diff --git a/ext/standard/tests/array/array_column_basic.phpt b/ext/standard/tests/array/array_column_basic.phpt index 8c49910..eb267da 100644 --- a/ext/standard/tests/array/array_column_basic.phpt +++ b/ext/standard/tests/array/array_column_basic.phpt @@ -192,7 +192,7 @@ array(8) { [6]= string(3) Foo [7]= - resource(5) of type (stream) + resource(%d) of type (stream) } array(8) { [1]= @@ -211,7 +211,7 @@ array(8) { [7]= string(3) Foo [8]= - resource(5) of type (stream) + resource(%d) of type (stream) } *** Testing numeric column keys *** -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] com php-src: Allow array_column() to take -1 as a valid value in third param: ext/standard/array.c ext/standard/tests/array/array_column_basic.phpt
Commit:1a03bd5dee97a0f8b9e74b7f8db5231abd8cc7e4 Author:Sara Golemon poll...@php.net Mon, 22 Apr 2013 14:57:05 -0700 Parents: f63db963c48775e89e7d5f63235733098c2f653d Branches: PHP-5.5 master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=1a03bd5dee97a0f8b9e74b7f8db5231abd8cc7e4 Log: Allow array_column() to take -1 as a valid value in third param Also do some cleanup and simplification to make this code more readable in the long term. Changed paths: M ext/standard/array.c M ext/standard/tests/array/array_column_basic.phpt Diff: diff --git a/ext/standard/array.c b/ext/standard/array.c index 425d53e..6f769da 100644 --- a/ext/standard/array.c +++ b/ext/standard/array.c @@ -2524,132 +2524,95 @@ PHP_FUNCTION(array_count_values) } /* }}} */ +/* {{{ array_column_param_helper + * Specialized conversion rules for array_column() function + */ +static inline +zend_bool array_column_param_helper(zval **param, +const char *name TSRMLS_DC) { + switch (Z_TYPE_PP(param)) { + case IS_NULL: + case IS_DOUBLE: + convert_to_long_ex(param); + /* fallthrough */ + case IS_LONG: + return 1; + + case IS_OBJECT: + convert_to_string_ex(param); + /* fallthrough */ + case IS_STRING: + return 1; + + default: + php_error_docref(NULL TSRMLS_CC, E_WARNING, The %s key should be either a string or an integer, name); + return 0; + } +} + /* {{{ proto array array_column(array input, mixed column_key[, mixed index_key]) Return the values from a single column in the input array, identified by the value_key and optionally indexed by the index_key */ PHP_FUNCTION(array_column) { - zval *zarray, **zcolumn, **zkey = NULL, **data, **zcolval, **zkeyval; + zval **zcolumn, **zkey = NULL, **data; HashTable *arr_hash; HashPosition pointer; - ulong column_idx = 0, key_idx = 0; - char *column = NULL, *key = NULL, *keyval = NULL; - int column_len = 0, key_len = 0, keyval_idx = -1; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, aZ|Z, zarray, zcolumn, zkey) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, hZ|Z!, arr_hash, zcolumn, zkey) == FAILURE) { return; } - switch (Z_TYPE_PP(zcolumn)) { - case IS_NULL: - column_idx = 0; - break; - case IS_LONG: - column_idx = Z_LVAL_PP(zcolumn); - break; - case IS_DOUBLE: - column_idx = (long)Z_DVAL_PP(zcolumn); - break; - case IS_STRING: - column = Z_STRVAL_PP(zcolumn); - column_len = Z_STRLEN_PP(zcolumn); - break; - case IS_OBJECT: - convert_to_string_ex(zcolumn); - column = Z_STRVAL_PP(zcolumn); - column_len = Z_STRLEN_PP(zcolumn); - break; - default: - php_error_docref(NULL TSRMLS_CC, E_WARNING, The column key should be either a string or an integer); - RETURN_FALSE; - } - - if (zkey) { - switch (Z_TYPE_PP(zkey)) { - case IS_NULL: - key_idx = 0; - break; - case IS_LONG: - key_idx = Z_LVAL_PP(zkey); - break; - case IS_DOUBLE: - key_idx = (long)Z_DVAL_PP(zkey); - break; - case IS_STRING: - key = Z_STRVAL_PP(zkey); - key_len = Z_STRLEN_PP(zkey); - break; - case IS_OBJECT: - convert_to_string_ex(zkey); - key = Z_STRVAL_PP(zkey); - key_len = Z_STRLEN_PP(zkey); - break; - default: - php_error_docref(NULL TSRMLS_CC, E_WARNING, The index key should be either a string or an integer); - RETURN_FALSE; - } + if (!array_column_param_helper(zcolumn, column TSRMLS_CC) || + (zkey !array_column_param_helper(zkey, index TSRMLS_CC))) { + RETURN_FALSE; } - arr_hash = Z_ARRVAL_P(zarray); array_init(return_value); - for (zend_hash_internal_pointer_reset_ex(arr_hash, pointer
[PHP-CVS] com php-src: array_column() - Use entire subject array when NULL passed for second param.: ext/standard/array.c ext/standard/tests/array/array_column_variant.phpt
Commit:734e165d4e427feca9a736b62832a2ff287a22c9 Author:Sara Golemon poll...@php.net Mon, 22 Apr 2013 16:19:21 -0700 Parents: 1a03bd5dee97a0f8b9e74b7f8db5231abd8cc7e4 Branches: PHP-5.5 master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=734e165d4e427feca9a736b62832a2ff287a22c9 Log: array_column() - Use entire subject array when NULL passed for second param. This starts to look like array_values(), except that you can reindex the arrays using the third parameter. Changed paths: M ext/standard/array.c A ext/standard/tests/array/array_column_variant.phpt Diff: diff --git a/ext/standard/array.c b/ext/standard/array.c index 6f769da..cfe9be8 100644 --- a/ext/standard/array.c +++ b/ext/standard/array.c @@ -2531,7 +2531,6 @@ static inline zend_bool array_column_param_helper(zval **param, const char *name TSRMLS_DC) { switch (Z_TYPE_PP(param)) { - case IS_NULL: case IS_DOUBLE: convert_to_long_ex(param); /* fallthrough */ @@ -2555,15 +2554,15 @@ zend_bool array_column_param_helper(zval **param, value_key and optionally indexed by the index_key */ PHP_FUNCTION(array_column) { - zval **zcolumn, **zkey = NULL, **data; + zval **zcolumn = NULL, **zkey = NULL, **data; HashTable *arr_hash; HashPosition pointer; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, hZ|Z!, arr_hash, zcolumn, zkey) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, hZ!|Z!, arr_hash, zcolumn, zkey) == FAILURE) { return; } - if (!array_column_param_helper(zcolumn, column TSRMLS_CC) || + if ((zcolumn !array_column_param_helper(zcolumn, column TSRMLS_CC)) || (zkey !array_column_param_helper(zkey, index TSRMLS_CC))) { RETURN_FALSE; } @@ -2581,8 +2580,12 @@ PHP_FUNCTION(array_column) } ht = Z_ARRVAL_PP(data); - /* Skip if the value doesn't exist in our subarray */ - if ((Z_TYPE_PP(zcolumn) == IS_STRING) + if (!zcolumn) { + /* NULL column ID means use entire subarray as data */ + zcolval = data; + + /* Otherwise, skip if the value doesn't exist in our subarray */ + } else if ((Z_TYPE_PP(zcolumn) == IS_STRING) (zend_hash_find(ht, Z_STRVAL_PP(zcolumn), Z_STRLEN_PP(zcolumn) + 1, (void**)zcolval) == FAILURE)) { continue; } else if ((Z_TYPE_PP(zcolumn) == IS_LONG) diff --git a/ext/standard/tests/array/array_column_variant.phpt b/ext/standard/tests/array/array_column_variant.phpt new file mode 100644 index 000..0af0869 --- /dev/null +++ b/ext/standard/tests/array/array_column_variant.phpt @@ -0,0 +1,85 @@ +--TEST-- +Test array_column() function: variant functionality +--FILE-- +?php +/* Array from Bug Request #64493 test script */ +$rows = array( + 456 = array('id' = '3', 'title' = 'Foo', 'date' = '2013-03-25'), + 457 = array('id' = '5', 'title' = 'Bar', 'date' = '2012-05-20'), +); + +echo -- pass null as second parameter to get back all columns indexed by third parameter --\n; +var_dump(array_column($rows, null, 'id')); + +echo -- pass null as second parameter and bogus third param to get back zero-indexed array of all columns --\n; +var_dump(array_column($rows, null, 'foo')); + +echo -- pass null as second parameter and no third param to get back array_values(input) --\n; +var_dump(array_column($rows, null)); + +echo Done\n; +--EXPECTF-- +-- pass null as second parameter to get back all columns indexed by third parameter -- +array(2) { + [3]= + array(3) { +[id]= +string(1) 3 +[title]= +string(3) Foo +[date]= +string(10) 2013-03-25 + } + [5]= + array(3) { +[id]= +string(1) 5 +[title]= +string(3) Bar +[date]= +string(10) 2012-05-20 + } +} +-- pass null as second parameter and bogus third param to get back zero-indexed array of all columns -- +array(2) { + [0]= + array(3) { +[id]= +string(1) 3 +[title]= +string(3) Foo +[date]= +string(10) 2013-03-25 + } + [1]= + array(3) { +[id]= +string(1) 5 +[title]= +string(3) Bar +[date]= +string(10) 2012-05-20 + } +} +-- pass null as second parameter and no third param to get back array_values(input) -- +array(2) { + [0]= + array(3) { +[id]= +string(1) 3 +[title]= +string(3) Foo +[date]= +string(10) 2013-03-25 + } + [1]= + array(3) { +[id]= +string(1) 5 +[title]= +string(3) Bar +[date]= +string(10) 2012-05-20 + } +} +Done -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] com php-src: http-stream test requires network connectivity: ext/standard/tests/network/http-stream.phpt
Commit:bc55a8eb9f1cf5e77b96a4eb2a1920ba0037e128 Author:Sara Golemon poll...@php.net Thu, 21 Feb 2013 03:21:23 -0800 Parents: 81e9aa6c8d492282ac2a7ca2b0d555bc137d25fc Branches: PHP-5.3 PHP-5.4 PHP-5.5 master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=bc55a8eb9f1cf5e77b96a4eb2a1920ba0037e128 Log: http-stream test requires network connectivity Changed paths: M ext/standard/tests/network/http-stream.phpt Diff: diff --git a/ext/standard/tests/network/http-stream.phpt b/ext/standard/tests/network/http-stream.phpt index 6ee035a..99245f7 100644 --- a/ext/standard/tests/network/http-stream.phpt +++ b/ext/standard/tests/network/http-stream.phpt @@ -3,6 +3,7 @@ http-stream test --SKIPIF-- ?php if (getenv(SKIP_SLOW_TESTS)) die(skip slow test); +if (getenv(SKIP_ONLINE_TESTS)) die(skip online test); if (!extension_loaded(dom)) die(skip dom extension is not present); ? --INI-- -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] svn: /php/php-src/trunk/ NEWS ext/json/JSON_parser.c ext/json/JSON_parser.h ext/json/json.c ext/json/php_json.h ext/json/tests/008.phpt ext/json/tests/json_decode_error.phpt
pollita Fri, 21 May 2010 22:59:58 + Revision: http://svn.php.net/viewvc?view=revisionrevision=299605 Log: Add JSON_BIGINT_AS_STRING for json_decode() to parse large numbers as strings rather than casting to double and loosing precision. Changed paths: U php/php-src/trunk/NEWS U php/php-src/trunk/ext/json/JSON_parser.c U php/php-src/trunk/ext/json/JSON_parser.h U php/php-src/trunk/ext/json/json.c U php/php-src/trunk/ext/json/php_json.h A php/php-src/trunk/ext/json/tests/008.phpt U php/php-src/trunk/ext/json/tests/json_decode_error.phpt Modified: php/php-src/trunk/NEWS === --- php/php-src/trunk/NEWS 2010-05-21 22:55:18 UTC (rev 299604) +++ php/php-src/trunk/NEWS 2010-05-21 22:59:58 UTC (rev 299605) @@ -31,6 +31,7 @@ - Added closure $this support back. (Stas) - Added SplObjectStorage::getHash() hook. (Etienne) - Added JsonSerializable interface (Sara) +- Added JSON_BIGINT_AS_STRING, extended json_decode() sig with $options. (Sara) - Added support for storing upload progress feedback in session data. (Arnaud) - Added support for CURLOPT_MAX_RECV_SPEED_LARGE and CURLOPT_MAX_SEND_SPEED_LARGE. FR #51815. (Pierrick) Modified: php/php-src/trunk/ext/json/JSON_parser.c === --- php/php-src/trunk/ext/json/JSON_parser.c 2010-05-21 22:55:18 UTC (rev 299604) +++ php/php-src/trunk/ext/json/JSON_parser.c 2010-05-21 22:59:58 UTC (rev 299605) @@ -291,12 +291,14 @@ } -static void json_create_zval(zval **z, smart_str *buf, int type) +static void json_create_zval(zval **z, smart_str *buf, int type, int options) { ALLOC_INIT_ZVAL(*z); if (type == IS_LONG) { + zend_bool bigint = 0; + if (buf-c[0] == '-') { buf-len--; } @@ -306,9 +308,22 @@ int cmp = strcmp(buf-c + (buf-c[0] == '-'), long_min_digits); if (!(cmp 0 || (cmp == 0 buf-c[0] == '-'))) { - goto use_double; + bigint = 1; } } else { +bigint = 1; + } + } + + if (bigint) { + /* value too large to represent as a long */ + if (options PHP_JSON_BIGINT_AS_STRING) { +if (buf-c[0] == '-') { + /* Restore last char consumed above */ + buf-len++; +} +goto use_string; + } else { goto use_double; } } @@ -322,6 +337,7 @@ } else if (type == IS_STRING) { +use_string: ZVAL_STRINGL(*z, buf-c, buf-len, 1); } else if (type == IS_BOOL) @@ -420,12 +436,13 @@ machine with a stack. */ int -parse_JSON(JSON_parser jp, zval *z, unsigned short utf16_json[], int length, int assoc TSRMLS_DC) +parse_JSON_ex(JSON_parser jp, zval *z, unsigned short utf16_json[], int length, int options TSRMLS_DC) { int next_char; /* the next character */ int next_class; /* the next character class */ int next_state; /* the next state */ int the_index; +int assoc = options PHP_JSON_OBJECT_AS_ARRAY; smart_str buf = {0}; smart_str key = {0}; @@ -530,7 +547,7 @@ zval *mval; smart_str_0(buf); -json_create_zval(mval, buf, type); +json_create_zval(mval, buf, type, options); if (!assoc) { add_property_zval_ex(jp-the_zstack[jp-top], (key.len ? key.c : _empty_), (key.len ? (key.len + 1) : sizeof(_empty_)), mval TSRMLS_CC); @@ -558,7 +575,7 @@ zval *mval; smart_str_0(buf); -json_create_zval(mval, buf, type); +json_create_zval(mval, buf, type, options); add_next_index_zval(jp-the_zstack[jp-top], mval); buf.len = 0; JSON_RESET_TYPE(); @@ -669,7 +686,7 @@ jp-stack[jp-top] == MODE_ARRAY)) { smart_str_0(buf); -json_create_zval(mval, buf, type); +json_create_zval(mval, buf, type, options); } switch (jp-stack[jp-top]) { Modified: php/php-src/trunk/ext/json/JSON_parser.h === --- php/php-src/trunk/ext/json/JSON_parser.h 2010-05-21 22:55:18 UTC (rev 299604) +++ php/php-src/trunk/ext/json/JSON_parser.h 2010-05-21 22:59:58 UTC (rev 299605) @@ -5,6 +5,7 @@ #include php.h #include ext/standard/php_smart_str.h +#include php_json.h #define JSON_PARSER_DEFAULT_DEPTH 512 @@ -28,6 +29,12 @@ }; extern JSON_parser new_JSON_parser(int depth); -extern int parse_JSON(JSON_parser jp, zval *z, unsigned short utf16_json[], int length, int assoc TSRMLS_DC); +extern int parse_JSON_ex(JSON_parser jp, zval *z, unsigned short utf16_json[], int length, int options TSRMLS_DC); extern int free_JSON_parser(JSON_parser jp); + +static inline int parse_JSON(JSON_parser jp, zval *z, unsigned
[PHP-CVS] svn: /php/php-src/trunk/ext/json/ JSON_parser.h php_json.h
pollita Fri, 21 May 2010 23:29:34 + Revision: http://svn.php.net/viewvc?view=revisionrevision=299606 Log: Ooops, return values... Changed paths: U php/php-src/trunk/ext/json/JSON_parser.h U php/php-src/trunk/ext/json/php_json.h Modified: php/php-src/trunk/ext/json/JSON_parser.h === --- php/php-src/trunk/ext/json/JSON_parser.h2010-05-21 22:59:58 UTC (rev 299605) +++ php/php-src/trunk/ext/json/JSON_parser.h2010-05-21 23:29:34 UTC (rev 299606) @@ -34,7 +34,7 @@ static inline int parse_JSON(JSON_parser jp, zval *z, unsigned short utf16_json[], int length, int assoc TSRMLS_DC) { - parse_JSON_ex(jp, z, utf16_json, length, assoc ? PHP_JSON_OBJECT_AS_ARRAY : 0 TSRMLS_CC); + return parse_JSON_ex(jp, z, utf16_json, length, assoc ? PHP_JSON_OBJECT_AS_ARRAY : 0 TSRMLS_CC); } #endif Modified: php/php-src/trunk/ext/json/php_json.h === --- php/php-src/trunk/ext/json/php_json.h 2010-05-21 22:59:58 UTC (rev 299605) +++ php/php-src/trunk/ext/json/php_json.h 2010-05-21 23:29:34 UTC (rev 299606) @@ -68,7 +68,7 @@ #define PHP_JSON_OBJECT_AS_ARRAY (10) #define PHP_JSON_BIGINT_AS_STRING (11) -static inline php_json_decode(zval *return_value, char *str, int str_len, zend_bool assoc, long depth TSRMLS_DC) +static inline void php_json_decode(zval *return_value, char *str, int str_len, zend_bool assoc, long depth TSRMLS_DC) { php_json_decode_ex(return_value, str, str_len, assoc ? PHP_JSON_OBJECT_AS_ARRAY : 0, depth TSRMLS_CC); } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] svn: /php/php-src/trunk/ext/openssl/ openssl.c tests/011.phpt tests/openssl_decrypt_error.phpt
pollita Wed, 19 May 2010 20:05:09 + Revision: http://svn.php.net/viewvc?view=revisionrevision=299508 Log: Add parameter to openssl_(en|de)crypt Changed paths: U php/php-src/trunk/ext/openssl/openssl.c U php/php-src/trunk/ext/openssl/tests/011.phpt U php/php-src/trunk/ext/openssl/tests/openssl_decrypt_error.phpt Modified: php/php-src/trunk/ext/openssl/openssl.c === --- php/php-src/trunk/ext/openssl/openssl.c 2010-05-19 19:34:58 UTC (rev 299507) +++ php/php-src/trunk/ext/openssl/openssl.c 2010-05-19 20:05:09 UTC (rev 299508) @@ -99,6 +99,7 @@ PHP_FUNCTION(openssl_digest); PHP_FUNCTION(openssl_encrypt); PHP_FUNCTION(openssl_decrypt); +PHP_FUNCTION(openssl_cipher_iv_length); PHP_FUNCTION(openssl_dh_compute_key); PHP_FUNCTION(openssl_random_pseudo_bytes); @@ -347,6 +348,7 @@ ZEND_ARG_INFO(0, method) ZEND_ARG_INFO(0, password) ZEND_ARG_INFO(0, raw_output) +ZEND_ARG_INFO(0, iv) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(arginfo_openssl_decrypt, 0, 0, 3) @@ -354,8 +356,13 @@ ZEND_ARG_INFO(0, method) ZEND_ARG_INFO(0, password) ZEND_ARG_INFO(0, raw_input) +ZEND_ARG_INFO(0, iv) ZEND_END_ARG_INFO() +ZEND_BEGIN_ARG_INFO(arginfo_openssl_cipher_iv_length, 0) +ZEND_ARG_INFO(0, method) +ZEND_END_ARG_INFO() + ZEND_BEGIN_ARG_INFO(arginfo_openssl_dh_compute_key, 0) ZEND_ARG_INFO(0, pub_key) ZEND_ARG_INFO(0, dh_key) @@ -408,6 +415,7 @@ PHP_FE(openssl_digest,arginfo_openssl_digest) PHP_FE(openssl_encrypt,arginfo_openssl_encrypt) PHP_FE(openssl_decrypt,arginfo_openssl_decrypt) + PHP_FE(openssl_cipher_iv_length, arginfo_openssl_cipher_iv_length) PHP_FE(openssl_sign,arginfo_openssl_sign) PHP_FE(openssl_verify,arginfo_openssl_verify) PHP_FE(openssl_seal,arginfo_openssl_seal) @@ -4585,19 +4593,54 @@ } /* }}} */ -/* {{{ proto string openssl_encrypt(string data, string method, string password [, bool raw_output=false]) +static zend_bool php_openssl_validate_iv(char **piv, int *piv_len, int iv_required_len) +{ + char *iv_new; + + /* Best case scenario, user behaved */ + if (*piv_len == iv_required_len) { + return 0; + } + + iv_new = ecalloc(1, iv_required_len + 1); + + if (*piv_len = 0) { + /* BC behavior */ + *piv_len = iv_required_len; + *piv = iv_new; + return 1; + } + + if (*piv_len iv_required_len) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, IV passed is only %d bytes long, cipher expects an IV of precisely %d bytes, padding with \\0, *piv_len, iv_required_len); + memcpy(iv_new, *piv, *piv_len); + *piv_len = iv_required_len; + *piv = iv_new; + return 1; + } + + php_error_docref(NULL TSRMLS_CC, E_WARNING, IV passed is %d bytes long which is longer than the %d expected by selected cipher, truncating, *piv_len, iv_required_len); + memcpy(iv_new, *piv, iv_required_len); + *piv_len = iv_required_len; + *piv = iv_new; + return 1; + +} + +/* {{{ proto string openssl_encrypt(string data, string method, string password [, bool raw_output=false [, string $iv='']]) Encrypts given data with given method and key, returns raw or base64 encoded string */ PHP_FUNCTION(openssl_encrypt) { zend_bool raw_output = 0; - char *data, *method, *password; - int data_len, method_len, password_len; + char *data, *method, *password, *iv = ; + int data_len, method_len, password_len, iv_len = 0; const EVP_CIPHER *cipher_type; EVP_CIPHER_CTX cipher_ctx; - int i, outlen, keylen, ivlen; - unsigned char *outbuf, *key, *iv; + int i, outlen, keylen; + unsigned char *outbuf, *key; + zend_bool free_iv; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, sss|b, data, data_len, method, method_len, password, password_len, raw_output) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, sss|bs, data, data_len, method, method_len, password, password_len, raw_output, iv, iv_len) == FAILURE) { return; } cipher_type = EVP_get_cipherbyname(method); @@ -4615,14 +4658,15 @@ key = (unsigned char*)password; } - ivlen = EVP_CIPHER_iv_length(cipher_type); - iv = emalloc(ivlen); - memset(iv, 0, ivlen); + if (iv_len = 0) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, Using an empty Initialization Vector (iv) is potentially insecure and not recommended); + } + free_iv = php_openssl_validate_iv(iv, iv_len, EVP_CIPHER_iv_length(cipher_type)); outlen = data_len + EVP_CIPHER_block_size(cipher_type); outbuf = emalloc(outlen + 1); - EVP_EncryptInit(cipher_ctx, cipher_type, key, iv); + EVP_EncryptInit(cipher_ctx, cipher_type, key, (unsigned char *)iv); EVP_EncryptUpdate(cipher_ctx, outbuf, i, (unsigned char *)data, data_len); outlen = i; if (EVP_EncryptFinal(cipher_ctx, (unsigned char *)outbuf + i, i)) { @@ -4645,25 +4689,28 @@ if (key != (unsigned char*)password) { efree(key); } - efree(iv); + if (free_iv) { + efree(iv); + } } /* }}} */ -/* {{{ proto string
[PHP-CVS] svn: /php/php-src/trunk/ NEWS ext/json/json.c ext/json/tests/serialize.phpt
pollita Wed, 12 May 2010 16:42:48 + Revision: http://svn.php.net/viewvc?view=revisionrevision=299298 Log: Rename JSON_Serializable to JsonSerializable per ML discussion Changed paths: U php/php-src/trunk/NEWS U php/php-src/trunk/ext/json/json.c U php/php-src/trunk/ext/json/tests/serialize.phpt Modified: php/php-src/trunk/NEWS === --- php/php-src/trunk/NEWS 2010-05-12 16:38:05 UTC (rev 299297) +++ php/php-src/trunk/NEWS 2010-05-12 16:42:48 UTC (rev 299298) @@ -30,7 +30,7 @@ - Added command line option --rz to CLI. (Johannes) - Added closure $this support back. (Stas) - Added SplObjectStorage::getHash() hook. (Etienne) -- Added JSON_Serializable interface (Sara) +- Added JsonSerializable interface (Sara) - Added support for storing upload progress feedback in session data. (Arnaud) - default_charset if not specified is now UTF-8 instead of ISO-8859-1. (Rasmus) Modified: php/php-src/trunk/ext/json/json.c === --- php/php-src/trunk/ext/json/json.c 2010-05-12 16:38:05 UTC (rev 299297) +++ php/php-src/trunk/ext/json/json.c 2010-05-12 16:42:48 UTC (rev 299298) @@ -76,13 +76,13 @@ }; /* }}} */ -/* {{{ JSON_Serializable methods */ +/* {{{ JsonSerializable methods */ ZEND_BEGIN_ARG_INFO(json_serialize_arginfo, 0) /* No arguments */ ZEND_END_ARG_INFO(); static const zend_function_entry json_serializable_interface[] = { - PHP_ABSTRACT_ME(JSON_Serializable, jsonSerialize, json_serialize_arginfo) + PHP_ABSTRACT_ME(JsonSerializable, jsonSerialize, json_serialize_arginfo) { NULL, NULL, NULL } }; @@ -91,9 +91,8 @@ { zend_class_entry ce; - INIT_CLASS_ENTRY(ce, JSON_Serializable, json_serializable_interface); + INIT_CLASS_ENTRY(ce, JsonSerializable, json_serializable_interface); php_json_serializable_ce = zend_register_internal_interface(ce TSRMLS_CC); - /* Note: Consider adding: interface JSON\Serializable extends JSON_Serializable {} for futureproofing... */ REGISTER_LONG_CONSTANT(JSON_HEX_TAG, PHP_JSON_HEX_TAG, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT(JSON_HEX_AMP, PHP_JSON_HEX_AMP, CONST_CS | CONST_PERSISTENT); Modified: php/php-src/trunk/ext/json/tests/serialize.phpt === --- php/php-src/trunk/ext/json/tests/serialize.phpt 2010-05-12 16:38:05 UTC (rev 299297) +++ php/php-src/trunk/ext/json/tests/serialize.phpt 2010-05-12 16:42:48 UTC (rev 299298) @@ -15,7 +15,7 @@ } } -class SerializingTest extends NonSerializingTest implements JSON_Serializable +class SerializingTest extends NonSerializingTest implements JsonSerializable { public function jsonSerialize() { -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] svn: /php/php-src/trunk/ NEWS ext/json/json.c ext/json/php_json.h ext/json/tests/serialize.phpt
pollita Wed, 05 May 2010 22:48:14 + Revision: http://svn.php.net/viewvc?view=revisionrevision=299037 Log: Add JSON_Serializable interface Objects implementing JSON_Serializable will have their -jsonSerialize() method called Similar to serialize() and __sleep() Changed paths: U php/php-src/trunk/NEWS U php/php-src/trunk/ext/json/json.c U php/php-src/trunk/ext/json/php_json.h A php/php-src/trunk/ext/json/tests/serialize.phpt Modified: php/php-src/trunk/NEWS === --- php/php-src/trunk/NEWS 2010-05-05 22:08:27 UTC (rev 299036) +++ php/php-src/trunk/NEWS 2010-05-05 22:48:14 UTC (rev 299037) @@ -27,6 +27,7 @@ - Added command line option --rz to CLI. (Johannes) - Added closure $this support back. (Stas) - Added SplObjectStorage::getHash() hook. (Etienne) +- Added JSON_Serializable interface (json_encode() calls $obj-jsonSerialize()). (Sara) - default_charset if not specified is now UTF-8 instead of ISO-8859-1. (Rasmus) Modified: php/php-src/trunk/ext/json/json.c === --- php/php-src/trunk/ext/json/json.c 2010-05-05 22:08:27 UTC (rev 299036) +++ php/php-src/trunk/ext/json/json.c 2010-05-05 22:48:14 UTC (rev 299037) @@ -37,6 +37,8 @@ static const char digits[] = 0123456789abcdef; +zend_class_entry *php_json_serializable_ce; + #define PHP_JSON_HEX_TAG (10) #define PHP_JSON_HEX_AMP (11) #define PHP_JSON_HEX_APOS (12) @@ -73,9 +75,25 @@ }; /* }}} */ +/* {{{ JSON_Serializable methods */ +ZEND_BEGIN_ARG_INFO(json_serialize_arginfo, 0) + /* No arguments */ +ZEND_END_ARG_INFO(); + +static const zend_function_entry json_serializable_interface[] = { + PHP_ABSTRACT_ME(JSON_Serializable, jsonSerialize, json_serialize_arginfo) + { NULL, NULL, NULL } +}; + /* {{{ MINIT */ static PHP_MINIT_FUNCTION(json) { + zend_class_entry ce; + + INIT_CLASS_ENTRY(ce, JSON_Serializable, json_serializable_interface); + php_json_serializable_ce = zend_register_internal_interface(ce TSRMLS_CC); + /* Note: Consider adding: interface JSON\Serializable extends JSON_Serializable {} for futureproofing... */ + REGISTER_LONG_CONSTANT(JSON_HEX_TAG, PHP_JSON_HEX_TAG, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT(JSON_HEX_AMP, PHP_JSON_HEX_AMP, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT(JSON_HEX_APOS, PHP_JSON_HEX_APOS, CONST_CS | CONST_PERSISTENT); @@ -413,6 +431,39 @@ } /* }}} */ + +static void json_encode_serializable_object(smart_str *buf, zval *val, int options TSRMLS_DC) +{ + zend_class_entry *ce = Z_OBJCE_P(val); + zval *retval = NULL, fname; + + ZVAL_STRING(fname, jsonSerialize, 0); + + if (FAILURE == call_user_function_ex(EG(function_table), val, fname, retval, 0, NULL, 1, NULL TSRMLS_CC) || !retval) { + zend_throw_exception_ex(NULL, 0 TSRMLS_CC, Failed calling %s::serialize(), ce-name); + smart_str_appendl(buf, null, sizeof(null) - 1); + return; +} + + if (EG(exception)) { + /* Error already raised */ + zval_ptr_dtor(retval); + smart_str_appendl(buf, null, sizeof(null) - 1); + return; + } + + if ((Z_TYPE_P(retval) == IS_OBJECT) + (Z_OBJ_HANDLE_P(retval) == Z_OBJ_HANDLE_P(val))) { + /* Handle the case where jsonSerialize does: return $this; by going straight to encode array */ + json_encode_array(buf, retval, options TSRMLS_CC); + } else { + /* All other types, encode as normal */ + php_json_encode(buf, retval, options TSRMLS_CC); + } + + zval_ptr_dtor(retval); +} + PHP_JSON_API void php_json_encode(smart_str *buf, zval *val, int options TSRMLS_DC) /* {{{ */ { JSON_G(error_code) = PHP_JSON_ERROR_NONE; @@ -455,8 +506,13 @@ json_escape_string(buf, Z_STRVAL_P(val), Z_STRLEN_P(val), options TSRMLS_CC); break; + case IS_OBJECT: + if (instanceof_function(Z_OBJCE_P(val), php_json_serializable_ce TSRMLS_CC)) { + json_encode_serializable_object(buf, val, options TSRMLS_CC); + break; + } + /* fallthrough -- Non-serializable object */ case IS_ARRAY: - case IS_OBJECT: json_encode_array(buf, val, options TSRMLS_CC); break; Modified: php/php-src/trunk/ext/json/php_json.h === --- php/php-src/trunk/ext/json/php_json.h 2010-05-05 22:08:27 UTC (rev 299036) +++ php/php-src/trunk/ext/json/php_json.h 2010-05-05 22:48:14 UTC (rev 299037) @@ -49,6
[PHP-CVS] cvs: php-src /ext/dbase dbase.c
pollita Thu Jan 24 10:27:59 2008 UTC Modified files: /php-src/ext/dbase dbase.c Log: Fix potential crash when non-array is used optimisticly http://cvs.php.net/viewvc.cgi/php-src/ext/dbase/dbase.c?r1=1.90r2=1.91diff_format=u Index: php-src/ext/dbase/dbase.c diff -u php-src/ext/dbase/dbase.c:1.90 php-src/ext/dbase/dbase.c:1.91 --- php-src/ext/dbase/dbase.c:1.90 Mon Dec 31 07:12:08 2007 +++ php-src/ext/dbase/dbase.c Thu Jan 24 10:27:59 2008 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: dbase.c,v 1.90 2007/12/31 07:12:08 sebastian Exp $ */ +/* $Id: dbase.c,v 1.91 2008/01/24 10:27:59 pollita Exp $ */ #ifdef HAVE_CONFIG_H #include config.h @@ -270,6 +270,11 @@ } convert_to_long_ex(dbh_id); + if (Z_TYPE_PP(fields) != IS_ARRAY) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, Argument two must be of type 'Array'); + RETURN_FALSE; + } + dbh = zend_list_find(Z_LVAL_PP(dbh_id), dbh_type); if (!dbh || dbh_type != DBase_GLOBAL(le_dbhead)) { php_error_docref(NULL TSRMLS_CC, E_WARNING, Unable to find database for identifier %ld, Z_LVAL_PP(dbh_id)); @@ -337,6 +342,11 @@ convert_to_long_ex(dbh_id); convert_to_long_ex(recnum); + if (Z_TYPE_PP(fields) != IS_ARRAY) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, Argument two must be of type 'Array'); + RETURN_FALSE; + } + dbh = zend_list_find(Z_LVAL_PP(dbh_id), dbh_type); if (!dbh || dbh_type != DBase_GLOBAL(le_dbhead)) { php_error_docref(NULL TSRMLS_CC, E_WARNING, Unable to find database for identifier %ld, Z_LVAL_PP(dbh_id)); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/ctype ctype.c
pollita Mon Jan 21 08:10:21 2008 UTC Modified files: /php-src/ext/ctype ctype.c Log: Unicode migration for ext/ctype http://cvs.php.net/viewvc.cgi/php-src/ext/ctype/ctype.c?r1=1.46r2=1.47diff_format=u Index: php-src/ext/ctype/ctype.c diff -u php-src/ext/ctype/ctype.c:1.46 php-src/ext/ctype/ctype.c:1.47 --- php-src/ext/ctype/ctype.c:1.46 Mon Dec 31 07:12:08 2007 +++ php-src/ext/ctype/ctype.c Mon Jan 21 08:10:21 2008 @@ -159,17 +159,22 @@ return; \ switch (Z_TYPE_P(c)) { \ case IS_LONG: \ - if (Z_LVAL_P(c) = 255 Z_LVAL_P(c) = 0) { \ - RETURN_BOOL(iswhat(Z_LVAL_P(c))); \ - } else if (Z_LVAL_P(c) = -128 Z_LVAL_P(c) 0) { \ - RETURN_BOOL(iswhat(Z_LVAL_P(c) + 256)); \ + RETURN_BOOL(u_##iswhat(Z_LVAL_P(c))); \ + break; \ + case IS_UNICODE: \ + { \ + int ofs = 0; \ + while (ofs Z_USTRLEN_P(c)) { \ + UChar32 ch; \ + U16_GET(Z_USTRVAL_P(c), 0, ofs, Z_USTRLEN_P(c), ch); \ + if (!u_##iswhat(ch)) { \ + RETURN_FALSE; \ + } \ + U16_FWD_1(Z_USTRVAL_P(c), ofs, Z_USTRLEN_P(c)); \ + } \ + RETURN_TRUE; \ } \ - tmp = *c; \ - zval_copy_ctor(tmp); \ - convert_to_string(tmp); \ - c = tmp; \ case IS_STRING: \ -string:\ { \ char *p = Z_STRVAL_P(c), *e = Z_STRVAL_P(c) + Z_STRLEN_P(c); \ if (e == p) { \ @@ -185,12 +190,6 @@ if (c == tmp) zval_dtor(tmp); \ RETURN_TRUE; \ } \ - case IS_UNICODE: \ - tmp = *c; \ - zval_copy_ctor(tmp); \ - convert_to_string(tmp); \ - c = tmp; \ - goto string; \ default: \ break; \ } \ @@ -198,7 +197,7 @@ /* }}} */ -/* {{{ proto bool ctype_alnum(mixed c) +/* {{{ proto bool ctype_alnum(mixed c) U Checks for alphanumeric character(s) */ static PHP_FUNCTION(ctype_alnum) { @@ -206,7 +205,7 @@ } /* }}} */ -/* {{{ proto bool ctype_alpha(mixed c) +/* {{{ proto bool ctype_alpha(mixed c) U Checks for alphabetic character(s) */ static PHP_FUNCTION(ctype_alpha) { @@ -214,7 +213,7 @@ } /* }}} */ -/* {{{ proto bool ctype_cntrl(mixed c) +/* {{{ proto bool ctype_cntrl(mixed c) U Checks for control character(s) */ static PHP_FUNCTION(ctype_cntrl) { @@ -222,7 +221,7 @@ } /* }}} */ -/* {{{ proto bool ctype_digit(mixed c) +/* {{{ proto bool ctype_digit(mixed c) U Checks for numeric character(s) */ static PHP_FUNCTION(ctype_digit) { @@ -230,7 +229,7 @@ } /* }}} */ -/* {{{ proto bool ctype_lower(mixed c) +/* {{{ proto bool ctype_lower(mixed c) U Checks for lowercase character(s) */ static PHP_FUNCTION(ctype_lower) { @@ -238,7 +237,7 @@ } /* }}} */ -/* {{{ proto bool ctype_graph(mixed c) +/* {{{ proto bool ctype_graph(mixed c) U Checks for any printable character(s) except space */ static PHP_FUNCTION(ctype_graph) { @@ -246,7 +245,7 @@ } /* }}} */ -/* {{{ proto bool ctype_print(mixed c) +/* {{{ proto bool ctype_print(mixed c) U Checks for printable character(s) */ static PHP_FUNCTION(ctype_print) { @@ -254,7 +253,7 @@ } /* }}} */ -/* {{{ proto bool ctype_punct(mixed c) +/* {{{ proto bool ctype_punct(mixed c) U Checks for any printable character which is not whitespace or an alphanumeric character */ static PHP_FUNCTION(ctype_punct) { @@ -262,7 +261,7 @@ } /* }}} */ -/* {{{ proto bool ctype_space(mixed c) +/* {{{ proto bool ctype_space(mixed c) U Checks for whitespace character(s)*/ static PHP_FUNCTION(ctype_space) { @@ -270,7 +269,7 @@ } /* }}} */ -/* {{{ proto bool ctype_upper(mixed c) +/* {{{ proto bool ctype_upper(mixed c) U Checks for uppercase character(s) */ static PHP_FUNCTION(ctype_upper) { @@ -278,7 +277,7 @@ } /* }}} */ -/* {{{ proto bool ctype_xdigit(mixed c) +/* {{{ proto bool ctype_xdigit(mixed c) U Checks for character(s) representing a hexadecimal digit */ static PHP_FUNCTION(ctype_xdigit) { -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/iconv iconv.c
pollita Mon Jan 21 07:30:49 2008 UTC Modified files: /php-src/ext/iconv iconv.c Log: Some unicode upgrades... http://cvs.php.net/viewvc.cgi/php-src/ext/iconv/iconv.c?r1=1.163r2=1.164diff_format=u Index: php-src/ext/iconv/iconv.c diff -u php-src/ext/iconv/iconv.c:1.163 php-src/ext/iconv/iconv.c:1.164 --- php-src/ext/iconv/iconv.c:1.163 Mon Dec 31 07:12:10 2007 +++ php-src/ext/iconv/iconv.c Mon Jan 21 07:30:49 2008 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: iconv.c,v 1.163 2007/12/31 07:12:10 sebastian Exp $ */ +/* $Id: iconv.c,v 1.164 2008/01/21 07:30:49 pollita Exp $ */ #ifdef HAVE_CONFIG_H #include config.h @@ -1932,14 +1932,15 @@ } /* }}} */ -/* {{{ proto int iconv_strlen(string str [, string charset]) +/* {{{ proto int iconv_strlen(string str [, string charset]) U Returns the character count of str */ PHP_FUNCTION(iconv_strlen) { char *charset; int charset_len = 0; - char *str; - int str_len; + zstr str; + int str_len, argc = ZEND_NUM_ARGS(); + zend_uchar str_type; php_iconv_err_t err; @@ -1947,17 +1948,21 @@ charset = ICONVG(internal_encoding); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, s|s, - str, str_len, charset, charset_len) == FAILURE) { + if (zend_parse_parameters(argc TSRMLS_CC, t|s, + str, str_len, str_type, charset, charset_len) == FAILURE) { RETURN_FALSE; } + if (str_type == IS_UNICODE) { + RETURN_LONG(u_countChar32(str.u, str_len)); + } + if (charset_len = ICONV_CSNMAXLEN) { php_error_docref(NULL TSRMLS_CC, E_WARNING, Charset parameter exceeds the maximum allowed length of %d characters, ICONV_CSNMAXLEN); RETURN_FALSE; } - err = _php_iconv_strlen(retval, str, str_len, charset); + err = _php_iconv_strlen(retval, str.s, str_len, charset); _php_iconv_show_error(err, GENERIC_SUPERSET_NAME, charset TSRMLS_CC); if (err == PHP_ICONV_ERR_SUCCESS) { RETVAL_LONG(retval); @@ -1967,14 +1972,15 @@ } /* }}} */ -/* {{{ proto string iconv_substr(string str, int offset, [int length, string charset]) +/* {{{ proto string iconv_substr(string str, int offset, [int length, string charset]) U Returns specified part of a string */ PHP_FUNCTION(iconv_substr) { char *charset; int charset_len = 0; - char *str; + zstr str; int str_len; + zend_uchar str_type; long offset, length; php_iconv_err_t err; @@ -1983,8 +1989,8 @@ charset = ICONVG(internal_encoding); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, sl|ls, - str, str_len, offset, length, + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, tl|ls, + str, str_len, str_type, offset, length, charset, charset_len) == FAILURE) { RETURN_FALSE; } @@ -1998,10 +2004,38 @@ length = str_len; } - err = _php_iconv_substr(retval, str, str_len, offset, length, charset); + if (str_type == IS_UNICODE) { + int start, end; + + if (offset = 0) { + start = 0; + U16_FWD_N(str.u, start, str_len, offset); + } else { + start = str_len; + U16_BACK_N(str.u, start, str_len, -offset); + } + + if (length 0) { + length += u_countChar32(str.u, str_len); + } + + end = start; + U16_FWD_N(str.u, end, str_len, length); + + if (start str_len) { start = str_len; } + if (endstr_len) { end = str_len; } + + if (end start) { + RETURN_UNICODEL(str.u + start, end - start, ZSTR_DUPLICATE); + } else { + RETURN_EMPTY_UNICODE(); + } + } + + err = _php_iconv_substr(retval, str.s, str_len, offset, length, charset); _php_iconv_show_error(err, GENERIC_SUPERSET_NAME, charset TSRMLS_CC); - if (err == PHP_ICONV_ERR_SUCCESS str != NULL) { + if (err == PHP_ICONV_ERR_SUCCESS str.s != NULL) { if (retval.c != NULL) { RETVAL_STRINGL(retval.c, retval.len, 0); } else { @@ -2014,16 +2048,18 @@ } /* }}} */ -/* {{{ proto int iconv_strpos(string haystack, string needle [, int offset [, string charset]]) +/* {{{ proto int iconv_strpos(string haystack, string needle [, int offset [, string charset]]) U Finds position of first occurrence of needle within part of haystack beginning with offset */ PHP_FUNCTION(iconv_strpos) { char *charset; int charset_len = 0; -
[PHP-CVS] cvs: php-src /ext/standard filestat.c
pollita Mon Dec 17 05:16:40 2007 UTC Modified files: /php-src/ext/standard filestat.c Log: Add scoping braces for variable declaration http://cvs.php.net/viewvc.cgi/php-src/ext/standard/filestat.c?r1=1.170r2=1.171diff_format=u Index: php-src/ext/standard/filestat.c diff -u php-src/ext/standard/filestat.c:1.170 php-src/ext/standard/filestat.c:1.171 --- php-src/ext/standard/filestat.c:1.170 Wed Nov 21 11:28:26 2007 +++ php-src/ext/standard/filestat.c Mon Dec 17 05:16:40 2007 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: filestat.c,v 1.170 2007/11/21 11:28:26 jani Exp $ */ +/* $Id: filestat.c,v 1.171 2007/12/17 05:16:40 pollita Exp $ */ #include php.h #include fopen_wrappers.h @@ -458,6 +458,7 @@ efree(grbuf); gid = gr.gr_gid; #else +{ struct group *gr = getgrnam(Z_STRVAL_P(group)); if (!gr) { @@ -465,6 +466,7 @@ RETURN_FALSE; } gid = gr-gr_gid; +} #endif } else { php_error_docref(NULL TSRMLS_CC, E_WARNING, parameter 2 should be string or integer, %s given, zend_zval_type_name(group)); @@ -575,6 +577,7 @@ efree(pwbuf); uid = pw.pw_uid; #else +{ struct passwd *pw = getpwnam(Z_STRVAL_P(user)); if (!pw) { @@ -582,6 +585,7 @@ RETURN_FALSE; } uid = pw-pw_uid; +} #endif } else { php_error_docref(NULL TSRMLS_CC, E_WARNING, parameter 2 should be string or integer, %s given, zend_zval_type_name(user)); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/json json.c /ext/json/tests 006.phpt
pollita Mon Dec 17 07:48:21 2007 UTC Added files: /php-src/ext/json/tests 006.phpt Modified files: /php-src/ext/json json.c Log: Add support for encoding options http://cvs.php.net/viewvc.cgi/php-src/ext/json/json.c?r1=1.31r2=1.32diff_format=u Index: php-src/ext/json/json.c diff -u php-src/ext/json/json.c:1.31 php-src/ext/json/json.c:1.32 --- php-src/ext/json/json.c:1.31Mon Oct 1 15:25:01 2007 +++ php-src/ext/json/json.c Mon Dec 17 07:48:21 2007 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: json.c,v 1.31 2007/10/01 15:25:01 iliaa Exp $ */ +/* $Id: json.c,v 1.32 2007/12/17 07:48:21 pollita Exp $ */ #ifdef HAVE_CONFIG_H #include config.h @@ -32,6 +32,11 @@ static const char digits[] = 0123456789abcdef; +#define PHP_JSON_HEX_TAG (10) +#define PHP_JSON_HEX_AMP (11) +#define PHP_JSON_HEX_APOS (12) +#define PHP_JSON_HEX_QUOT (13) + /* {{{ json_functions[] * * Every user visible function must have an entry in json_functions[]. @@ -43,6 +48,19 @@ }; /* }}} */ +/* {{{ MINIT */ +static PHP_MINIT_FUNCTION(json) +{ + REGISTER_LONG_CONSTANT(JSON_HEX_TAG, PHP_JSON_HEX_TAG, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT(JSON_HEX_AMP, PHP_JSON_HEX_AMP, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT(JSON_HEX_APOS, PHP_JSON_HEX_APOS, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT(JSON_HEX_QUOT, PHP_JSON_HEX_QUOT, CONST_CS | CONST_PERSISTENT); + + return SUCCESS; +} +/* }}} */ + + /* {{{ json_module_entry */ zend_module_entry json_module_entry = { @@ -51,7 +69,7 @@ #endif json, json_functions, - NULL, + PHP_MINIT(json), NULL, NULL, NULL, @@ -78,8 +96,8 @@ } /* }}} */ -static void json_encode_r(smart_str *buf, zval *val TSRMLS_DC); -static void json_escape_string(smart_str *buf, zstr s, int len, zend_uchar type); +static void json_encode_r(smart_str *buf, zval *val, int options TSRMLS_DC); +static void json_escape_string(smart_str *buf, zstr s, int len, zend_uchar type, int options); static int json_determine_array_type(zval **val TSRMLS_DC) /* {{{ */ { @@ -115,7 +133,7 @@ } /* }}} */ -static void json_encode_array(smart_str *buf, zval **val TSRMLS_DC) /* {{{ */ +static void json_encode_array(smart_str *buf, zval **val, int options TSRMLS_DC) /* {{{ */ { int i, r; HashTable *myht; @@ -172,7 +190,7 @@ need_comma = 1; } - json_encode_r(buf, *data TSRMLS_CC); + json_encode_r(buf, *data, options TSRMLS_CC); } else if (r == 1) { if (i == HASH_KEY_IS_STRING || i == HASH_KEY_IS_UNICODE) { @@ -187,10 +205,10 @@ need_comma = 1; } - json_escape_string(buf, key, key_len - 1, (i==HASH_KEY_IS_UNICODE)?IS_UNICODE:IS_STRING); + json_escape_string(buf, key, key_len - 1, (i==HASH_KEY_IS_UNICODE)?IS_UNICODE:IS_STRING, options); smart_str_appendc(buf, ':'); - json_encode_r(buf, *data TSRMLS_CC); + json_encode_r(buf, *data, options TSRMLS_CC); } else { if (need_comma) { smart_str_appendc(buf, ','); @@ -203,7 +221,7 @@ smart_str_appendc(buf, ''); smart_str_appendc(buf, ':'); - json_encode_r(buf, *data TSRMLS_CC); + json_encode_r(buf, *data, options TSRMLS_CC); } } @@ -227,7 +245,7 @@ #define REVERSE16(us) (((us 0xf) 12) | (((us 4) 0xf) 8) | (((us 8) 0xf) 4) | ((us 12) 0xf)) -static void json_escape_string(smart_str *buf, zstr s, int len, zend_uchar type) /* {{{ */ +static void json_escape_string(smart_str *buf, zstr s, int len, zend_uchar type, int options) /* {{{ */ { int pos = 0; unsigned short us; @@ -267,7 +285,11 @@ { case '': { - smart_str_appendl(buf, \\\, 2); + if (options PHP_JSON_HEX_QUOT) { +
[PHP-CVS] cvs: php-src(PHP_5_3) /ext/json json.c /ext/json/tests 006.phpt
pollita Mon Dec 17 07:48:27 2007 UTC Added files: (Branch: PHP_5_3) /php-src/ext/json/tests 006.phpt Modified files: /php-src/ext/json json.c Log: MFH (json.c r-1.32) Add support for encoding options http://cvs.php.net/viewvc.cgi/php-src/ext/json/json.c?r1=1.9.2.19.2.2r2=1.9.2.19.2.3diff_format=u Index: php-src/ext/json/json.c diff -u php-src/ext/json/json.c:1.9.2.19.2.2 php-src/ext/json/json.c:1.9.2.19.2.3 --- php-src/ext/json/json.c:1.9.2.19.2.2Mon Oct 1 15:22:41 2007 +++ php-src/ext/json/json.c Mon Dec 17 07:48:27 2007 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: json.c,v 1.9.2.19.2.2 2007/10/01 15:22:41 iliaa Exp $ */ +/* $Id: json.c,v 1.9.2.19.2.3 2007/12/17 07:48:27 pollita Exp $ */ #ifdef HAVE_CONFIG_H #include config.h @@ -37,6 +37,11 @@ static const char digits[] = 0123456789abcdef; +#define PHP_JSON_HEX_TAG (10) +#define PHP_JSON_HEX_AMP (11) +#define PHP_JSON_HEX_APOS (12) +#define PHP_JSON_HEX_QUOT (13) + /* {{{ json_functions[] * * Every user visible function must have an entry in json_functions[]. @@ -48,6 +53,19 @@ }; /* }}} */ +/* {{{ MINIT */ +static PHP_MINIT_FUNCTION(json) +{ + REGISTER_LONG_CONSTANT(JSON_HEX_TAG, PHP_JSON_HEX_TAG, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT(JSON_HEX_AMP, PHP_JSON_HEX_AMP, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT(JSON_HEX_APOS, PHP_JSON_HEX_APOS, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT(JSON_HEX_QUOT, PHP_JSON_HEX_QUOT, CONST_CS | CONST_PERSISTENT); + + return SUCCESS; +} +/* }}} */ + + /* {{{ json_module_entry */ zend_module_entry json_module_entry = { @@ -56,7 +74,7 @@ #endif json, json_functions, -NULL, +PHP_MINIT(json), NULL, NULL, NULL, @@ -83,8 +101,8 @@ } /* }}} */ -static void json_encode_r(smart_str *buf, zval *val TSRMLS_DC); -static void json_escape_string(smart_str *buf, char *s, int len); +static void json_encode_r(smart_str *buf, zval *val, int options TSRMLS_DC); +static void json_escape_string(smart_str *buf, char *s, int len, int options); static int json_determine_array_type(zval **val TSRMLS_DC) /* {{{ */ { @@ -120,7 +138,7 @@ } /* }}} */ -static void json_encode_array(smart_str *buf, zval **val TSRMLS_DC) { /* {{{ */ +static void json_encode_array(smart_str *buf, zval **val, int options TSRMLS_DC) { /* {{{ */ int i, r; HashTable *myht; @@ -176,7 +194,7 @@ need_comma = 1; } -json_encode_r(buf, *data TSRMLS_CC); +json_encode_r(buf, *data, options TSRMLS_CC); } else if (r == 1) { if (i == HASH_KEY_IS_STRING) { if (key[0] == '\0' Z_TYPE_PP(val) == IS_OBJECT) { @@ -190,10 +208,10 @@ need_comma = 1; } -json_escape_string(buf, key, key_len - 1); +json_escape_string(buf, key, key_len - 1, options); smart_str_appendc(buf, ':'); -json_encode_r(buf, *data TSRMLS_CC); +json_encode_r(buf, *data, options TSRMLS_CC); } else { if (need_comma) { smart_str_appendc(buf, ','); @@ -206,7 +224,7 @@ smart_str_appendc(buf, ''); smart_str_appendc(buf, ':'); -json_encode_r(buf, *data TSRMLS_CC); +json_encode_r(buf, *data, options TSRMLS_CC); } } @@ -230,7 +248,7 @@ #define REVERSE16(us) (((us 0xf) 12) | (((us 4) 0xf) 8) | (((us 8) 0xf) 4) | ((us 12) 0xf)) -static void json_escape_string(smart_str *buf, char *s, int len) /* {{{ */ +static void json_escape_string(smart_str *buf, char *s, int len, int options) /* {{{ */ { int pos = 0; unsigned short us; @@ -266,7 +284,11 @@ { case '': { -smart_str_appendl(buf, \\\, 2); +if (options PHP_JSON_HEX_QUOT) { +smart_str_appendl(buf, \\u0022, 6); +} else { +smart_str_appendl(buf, \\\, 2); +} } break; case '\\': @@ -304,6 +326,42 @@ smart_str_appendl(buf, \\t, 2); } break; +case '': +{ +if (options PHP_JSON_HEX_TAG) { +smart_str_appendl(buf, \\u003C, 6); +} else { +smart_str_appendc(buf, ''); +} +} +break; +
[PHP-CVS] cvs: php-src /ext/standard http_fopen_wrapper.c
pollita Mon Nov 5 00:47:21 2007 UTC Modified files: /php-src/ext/standard http_fopen_wrapper.c Log: Allow http fopen wrapper to fetch content on 'error' condition (David Zulke) http://cvs.php.net/viewvc.cgi/php-src/ext/standard/http_fopen_wrapper.c?r1=1.128r2=1.129diff_format=u Index: php-src/ext/standard/http_fopen_wrapper.c diff -u php-src/ext/standard/http_fopen_wrapper.c:1.128 php-src/ext/standard/http_fopen_wrapper.c:1.129 --- php-src/ext/standard/http_fopen_wrapper.c:1.128 Sun Sep 30 05:43:28 2007 +++ php-src/ext/standard/http_fopen_wrapper.c Mon Nov 5 00:47:21 2007 @@ -19,7 +19,7 @@ | Sara Golemon [EMAIL PROTECTED] | +--+ */ -/* $Id: http_fopen_wrapper.c,v 1.128 2007/09/30 05:43:28 jani Exp $ */ +/* $Id: http_fopen_wrapper.c,v 1.129 2007/11/05 00:47:21 pollita Exp $ */ #include php.h #include php_globals.h @@ -544,7 +544,8 @@ response_code = 0; } /* when we request only the header, don't fail even on error codes */ - if (options STREAM_ONLY_GET_HEADERS) { + if ((options STREAM_ONLY_GET_HEADERS) || + (php_stream_context_get_option(context, http, ignore_errors, tmpzval) == SUCCESS zend_is_true(*tmpzval)) ) { reqok = 1; } switch(response_code) { -- 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) / NEWS /ext/standard http_fopen_wrapper.c
pollita Mon Nov 5 01:00:44 2007 UTC Modified files: (Branch: PHP_5_3) /php-src/ext/standard http_fopen_wrapper.c /php-srcNEWS Log: MFH: http/ignore_errors context option http://cvs.php.net/viewvc.cgi/php-src/ext/standard/http_fopen_wrapper.c?r1=1.99.2.12.2.9.2.1r2=1.99.2.12.2.9.2.2diff_format=u Index: php-src/ext/standard/http_fopen_wrapper.c diff -u php-src/ext/standard/http_fopen_wrapper.c:1.99.2.12.2.9.2.1 php-src/ext/standard/http_fopen_wrapper.c:1.99.2.12.2.9.2.2 --- php-src/ext/standard/http_fopen_wrapper.c:1.99.2.12.2.9.2.1 Sun Sep 30 05:49:45 2007 +++ php-src/ext/standard/http_fopen_wrapper.c Mon Nov 5 01:00:43 2007 @@ -19,7 +19,7 @@ | Sara Golemon [EMAIL PROTECTED] | +--+ */ -/* $Id: http_fopen_wrapper.c,v 1.99.2.12.2.9.2.1 2007/09/30 05:49:45 jani Exp $ */ +/* $Id: http_fopen_wrapper.c,v 1.99.2.12.2.9.2.2 2007/11/05 01:00:43 pollita Exp $ */ #include php.h #include php_globals.h @@ -501,7 +501,8 @@ response_code = 0; } /* when we request only the header, don't fail even on error codes */ - if (options STREAM_ONLY_GET_HEADERS) { + if ((options STREAM_ONLY_GET_HEADERS) || + (php_stream_context_get_option(context, http, ignore_errors, tmpzval) == SUCCESS zend_is_true(*tmpzval)) ) { reqok = 1; } switch(response_code) { http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.965.2.40r2=1.2027.2.547.2.965.2.41diff_format=u Index: php-src/NEWS diff -u php-src/NEWS:1.2027.2.547.2.965.2.40 php-src/NEWS:1.2027.2.547.2.965.2.41 --- php-src/NEWS:1.2027.2.547.2.965.2.40Sat Nov 3 20:56:58 2007 +++ php-src/NEWSMon Nov 5 01:00:43 2007 @@ -22,6 +22,7 @@ (Etienne Kneuss) - Added compact handler for Zend MM storage. (Dmitry) - Added '+' and '*' specifiers to zend_parse_parameters(). (Andrei) +- Added 'ignore_errors' option to http fopen wrapper. (David Zulke, Sara) - Upgraded PCRE to version 7.4 (Nuno) -- 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) / NEWS
pollita Mon Oct 29 17:17:54 2007 UTC Modified files: (Branch: PHP_5_3) /php-srcNEWS Log: Note addition of +/* specifiers http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.965.2.33r2=1.2027.2.547.2.965.2.34diff_format=u Index: php-src/NEWS diff -u php-src/NEWS:1.2027.2.547.2.965.2.33 php-src/NEWS:1.2027.2.547.2.965.2.34 --- php-src/NEWS:1.2027.2.547.2.965.2.33Thu Oct 25 05:39:05 2007 +++ php-src/NEWSMon Oct 29 17:17:54 2007 @@ -17,6 +17,7 @@ - Added support for dynamic access of static members using $foo::myFunc(). (Etienne Kneuss) - Added compact handler for Zend MM storage. (Dmitry) +- Added '+' and '*' specifiers to zend_parse_parameters(). (Andrei) - Upgraded PCRE to version 7.4 (Nuno) - Improved php.ini handling: (Jani) -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/curl interface.c
pollita Tue Aug 21 21:23:35 2007 UTC Modified files: /php-src/ext/curl interface.c Log: Bagder says I don't need these ifdefs http://cvs.php.net/viewvc.cgi/php-src/ext/curl/interface.c?r1=1.115r2=1.116diff_format=u Index: php-src/ext/curl/interface.c diff -u php-src/ext/curl/interface.c:1.115 php-src/ext/curl/interface.c:1.116 --- php-src/ext/curl/interface.c:1.115 Mon Aug 20 18:56:05 2007 +++ php-src/ext/curl/interface.cTue Aug 21 21:23:35 2007 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: interface.c,v 1.115 2007/08/20 18:56:05 pollita Exp $ */ +/* $Id: interface.c,v 1.116 2007/08/21 21:23:35 pollita Exp $ */ #define ZEND_INCLUDE_FULL_WINDOWS_HEADERS @@ -594,9 +594,7 @@ #endif REGISTER_CURL_CONSTANT(CURLPROXY_HTTP); -#ifdef CURLPROXY_SOCKS4 REGISTER_CURL_CONSTANT(CURLPROXY_SOCKS4); -#endif REGISTER_CURL_CONSTANT(CURLPROXY_SOCKS5); REGISTER_CURL_CONSTANT(CURL_NETRC_OPTIONAL); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/standard user_filters.c
pollita Sat Aug 4 07:51:15 2007 UTC Modified files: /php-src/ext/standard user_filters.c Log: Bugfix#36492 Userfilters can leak buckets http://cvs.php.net/viewvc.cgi/php-src/ext/standard/user_filters.c?r1=1.48r2=1.49diff_format=u Index: php-src/ext/standard/user_filters.c diff -u php-src/ext/standard/user_filters.c:1.48 php-src/ext/standard/user_filters.c:1.49 --- php-src/ext/standard/user_filters.c:1.48Sat Jul 14 08:38:20 2007 +++ php-src/ext/standard/user_filters.c Sat Aug 4 07:51:15 2007 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: user_filters.c,v 1.48 2007/07/14 08:38:20 tony2001 Exp $ */ +/* $Id: user_filters.c,v 1.49 2007/08/04 07:51:15 pollita Exp $ */ #include php.h #include php_globals.h @@ -232,8 +232,21 @@ php_error_docref(NULL TSRMLS_CC, E_WARNING, failed to call filter function); } - if (retval) + if (retval) { zval_ptr_dtor(retval); + } + + if (buckets_in-head) { + php_stream_bucket *bucket = buckets_in-head; + + php_error_docref(NULL TSRMLS_CC, E_WARNING, Unprocessed filter buckets remaining on input brigade); + while ((bucket = buckets_in-head)) { + /* Remove unconsumed buckets from the brigade */ + php_stream_bucket_unlink(bucket TSRMLS_CC); + php_stream_bucket_delref(bucket TSRMLS_CC); + } + } + zval_ptr_dtor(zclosing); zval_ptr_dtor(zconsumed); zval_ptr_dtor(zout); -- 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) / NEWS /ext/standard user_filters.c
pollita Sat Aug 4 07:53:00 2007 UTC Modified files: (Branch: PHP_5_2) /php-src/ext/standard user_filters.c /php-srcNEWS Log: MFH(r-1.49)Bugfix#36492 Userfilters can leak buckets http://cvs.php.net/viewvc.cgi/php-src/ext/standard/user_filters.c?r1=1.31.2.4.2.8r2=1.31.2.4.2.9diff_format=u Index: php-src/ext/standard/user_filters.c diff -u php-src/ext/standard/user_filters.c:1.31.2.4.2.8 php-src/ext/standard/user_filters.c:1.31.2.4.2.9 --- php-src/ext/standard/user_filters.c:1.31.2.4.2.8Thu Feb 1 14:21:01 2007 +++ php-src/ext/standard/user_filters.c Sat Aug 4 07:53:00 2007 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: user_filters.c,v 1.31.2.4.2.8 2007/02/01 14:21:01 tony2001 Exp $ */ +/* $Id: user_filters.c,v 1.31.2.4.2.9 2007/08/04 07:53:00 pollita Exp $ */ #include php.h #include php_globals.h @@ -232,8 +232,21 @@ *bytes_consumed = Z_LVAL_P(zconsumed); } - if (retval) + if (retval) { zval_ptr_dtor(retval); + } + + if (buckets_in-head) { + php_stream_bucket *bucket = buckets_in-head; + + php_error_docref(NULL TSRMLS_CC, E_WARNING, Unprocessed filter buckets remaining on input brigade); + while ((bucket = buckets_in-head)) { + /* Remove unconsumed buckets from the brigade */ + php_stream_bucket_unlink(bucket TSRMLS_CC); + php_stream_bucket_delref(bucket TSRMLS_CC); + } + } + zval_ptr_dtor(zclosing); zval_ptr_dtor(zconsumed); zval_ptr_dtor(zout); http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.876r2=1.2027.2.547.2.877diff_format=u Index: php-src/NEWS diff -u php-src/NEWS:1.2027.2.547.2.876 php-src/NEWS:1.2027.2.547.2.877 --- php-src/NEWS:1.2027.2.547.2.876 Thu Aug 2 22:28:18 2007 +++ php-src/NEWSSat Aug 4 07:53:00 2007 @@ -1,6 +1,7 @@ PHPNEWS ||| ?? Aug 2007, PHP 5.2.4 +- Fixed bug #36492 (Userfilters can leak buckets). (Sara) 02 Aug 2007, PHP 5.2.4RC1 - Removed --enable-versioning configure option. (Jani) -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/simplexml simplexml.c
pollita Wed Jul 4 05:05:32 2007 UTC Modified files: /php-src/ext/simplexml simplexml.c Log: Fix behavior of empty($sxe-element) and empty($sxe['prop']) when used on empty elements properties (apply PHP emptiness rules) http://cvs.php.net/viewvc.cgi/php-src/ext/simplexml/simplexml.c?r1=1.239r2=1.240diff_format=u Index: php-src/ext/simplexml/simplexml.c diff -u php-src/ext/simplexml/simplexml.c:1.239 php-src/ext/simplexml/simplexml.c:1.240 --- php-src/ext/simplexml/simplexml.c:1.239 Tue Jul 3 15:02:40 2007 +++ php-src/ext/simplexml/simplexml.c Wed Jul 4 05:05:32 2007 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: simplexml.c,v 1.239 2007/07/03 15:02:40 rrichards Exp $ */ +/* $Id: simplexml.c,v 1.240 2007/07/04 05:05:32 pollita Exp $ */ #ifdef HAVE_CONFIG_H #include config.h @@ -797,6 +797,11 @@ attr = attr-next; } } + if (exists check_empty == 1 + (!attr-children || !attr-children-content || !attr-children-content[0] || !xmlStrcmp(attr-children-content, 0)) ) { + /* Attribute with no content in it's text node */ + exists = 0; + } } if (elements) { @@ -819,6 +824,11 @@ } if (node) { exists = 1; +if (check_empty == 1 + (!node-children || (node-children-type == XML_TEXT_NODE !node-children-next + (!node-children-content || !node-children-content[0] || !xmlStrcmp(node-children-content, 0 ) { + exists = 0; + } } } } @@ -2483,7 +2493,7 @@ { php_info_print_table_start(); php_info_print_table_header(2, Simplexml support, enabled); - php_info_print_table_row(2, Revision, $Revision: 1.239 $); + php_info_print_table_row(2, Revision, $Revision: 1.240 $); php_info_print_table_row(2, Schema support, #ifdef LIBXML_SCHEMAS_ENABLED enabled); -- 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) / NEWS /ext/simplexml simplexml.c
pollita Wed Jul 4 05:05:58 2007 UTC Modified files: (Branch: PHP_5_2) /php-src/ext/simplexml simplexml.c /php-srcNEWS Log: MFH (r-1.240) Fix behavior of empty($sxe-element) and empty($sxe['prop']) when used on empty elements properties (apply PHP emptiness rules) http://cvs.php.net/viewvc.cgi/php-src/ext/simplexml/simplexml.c?r1=1.151.2.22.2.31r2=1.151.2.22.2.32diff_format=u Index: php-src/ext/simplexml/simplexml.c diff -u php-src/ext/simplexml/simplexml.c:1.151.2.22.2.31 php-src/ext/simplexml/simplexml.c:1.151.2.22.2.32 --- php-src/ext/simplexml/simplexml.c:1.151.2.22.2.31 Tue Jul 3 14:55:53 2007 +++ php-src/ext/simplexml/simplexml.c Wed Jul 4 05:05:57 2007 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: simplexml.c,v 1.151.2.22.2.31 2007/07/03 14:55:53 rrichards Exp $ */ +/* $Id: simplexml.c,v 1.151.2.22.2.32 2007/07/04 05:05:57 pollita Exp $ */ #ifdef HAVE_CONFIG_H #include config.h @@ -787,6 +787,11 @@ attr = attr-next; } } + if (exists check_empty == 1 + (!attr-children || !attr-children-content || !attr-children-content[0] || !xmlStrcmp(attr-children-content, 0)) ) { + /* Attribute with no content in it's text node */ + exists = 0; + } } if (elements) { @@ -809,6 +814,11 @@ } if (node) { exists = 1; +if (check_empty == 1 + (!node-children || (node-children-type == XML_TEXT_NODE !node-children-next + (!node-children-content || !node-children-content[0] || !xmlStrcmp(node-children-content, 0 ) { + exists = 0; + } } } } @@ -2420,7 +2430,7 @@ { php_info_print_table_start(); php_info_print_table_header(2, Simplexml support, enabled); - php_info_print_table_row(2, Revision, $Revision: 1.151.2.22.2.31 $); + php_info_print_table_row(2, Revision, $Revision: 1.151.2.22.2.32 $); php_info_print_table_row(2, Schema support, #ifdef LIBXML_SCHEMAS_ENABLED enabled); http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.813r2=1.2027.2.547.2.814diff_format=u Index: php-src/NEWS diff -u php-src/NEWS:1.2027.2.547.2.813 php-src/NEWS:1.2027.2.547.2.814 --- php-src/NEWS:1.2027.2.547.2.813 Tue Jul 3 15:03:16 2007 +++ php-src/NEWSWed Jul 4 05:05:57 2007 @@ -37,6 +37,7 @@ (Ilia) - Fixed INFILE LOCAL option handling with MySQL extensions not to be allowed when open_basedir or safe_mode is active. (Stas) +- Faxed SimpleXML's behavior when used with empty(). (Sara) - Fixed PECL Bug #11345 (PDO_OCI crash after National language Support NLS environment initialization error) (Chris Jones) -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/hash hash.c
pollita Sat May 26 03:56:41 2007 UTC Modified files: /php-src/ext/hash hash.c Log: MFB(r-1.18.2.5.2.7) Use slprintf() instead of snprintf() - Bad Ilia, no biscuit for you. http://cvs.php.net/viewvc.cgi/php-src/ext/hash/hash.c?r1=1.34r2=1.35diff_format=u Index: php-src/ext/hash/hash.c diff -u php-src/ext/hash/hash.c:1.34 php-src/ext/hash/hash.c:1.35 --- php-src/ext/hash/hash.c:1.34Mon Jan 8 22:29:52 2007 +++ php-src/ext/hash/hash.c Sat May 26 03:56:41 2007 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: hash.c,v 1.34 2007/01/08 22:29:52 nlopess Exp $ */ +/* $Id: hash.c,v 1.35 2007/05/26 03:56:41 pollita Exp $ */ #ifdef HAVE_CONFIG_H #include config.h @@ -751,9 +751,9 @@ (type = zend_hash_get_current_key_ex(php_hash_hashtable, str, NULL, idx, 0, pos)) != HASH_KEY_NON_EXISTANT; zend_hash_move_forward_ex(php_hash_hashtable, pos)) { #if (PHP_MAJOR_VERSION = 6) - s += snprintf(s, e - s, %s , str.s); + s += slprintf(s, e - s, %s , str.s); #else - s += snprintf(s, e - s, %s , str); + s += slprintf(s, e - s, %s , str); #endif } *s = 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_2) /ext/curl interface.c
pollita Tue May 22 08:39:20 2007 UTC Modified files: (Branch: PHP_5_2) /php-src/ext/curl interface.c Log: MFH(r-1.112) Add CURLOPT_TIMEOUT_MS and CURLOPT_CONNECTTIMEOUT_MS option constants http://cvs.php.net/viewvc.cgi/php-src/ext/curl/interface.c?r1=1.62.2.14.2.25r2=1.62.2.14.2.26diff_format=u Index: php-src/ext/curl/interface.c diff -u php-src/ext/curl/interface.c:1.62.2.14.2.25 php-src/ext/curl/interface.c:1.62.2.14.2.26 --- php-src/ext/curl/interface.c:1.62.2.14.2.25 Mon Apr 23 14:36:56 2007 +++ php-src/ext/curl/interface.cTue May 22 08:39:20 2007 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: interface.c,v 1.62.2.14.2.25 2007/04/23 14:36:56 tony2001 Exp $ */ +/* $Id: interface.c,v 1.62.2.14.2.26 2007/05/22 08:39:20 pollita Exp $ */ #define ZEND_INCLUDE_FULL_WINDOWS_HEADERS @@ -387,6 +387,9 @@ REGISTER_CURL_CONSTANT(CURLOPT_PROXYUSERPWD); REGISTER_CURL_CONSTANT(CURLOPT_RANGE); REGISTER_CURL_CONSTANT(CURLOPT_TIMEOUT); +#ifdef CURLOPT_TIMEOUT_MS + REGISTER_CURL_CONSTANT(CURLOPT_TIMEOUT_MS); +#endif REGISTER_CURL_CONSTANT(CURLOPT_POSTFIELDS); REGISTER_CURL_CONSTANT(CURLOPT_REFERER); REGISTER_CURL_CONSTANT(CURLOPT_USERAGENT); @@ -430,6 +433,9 @@ REGISTER_CURL_CONSTANT(CURLOPT_RANDOM_FILE); REGISTER_CURL_CONSTANT(CURLOPT_EGDSOCKET); REGISTER_CURL_CONSTANT(CURLOPT_CONNECTTIMEOUT); +#ifdef CURLOPT_CONNECTTIMEOUT_MS + REGISTER_CURL_CONSTANT(CURLOPT_CONNECTTIMEOUT_MS); +#endif REGISTER_CURL_CONSTANT(CURLOPT_SSL_VERIFYPEER); REGISTER_CURL_CONSTANT(CURLOPT_CAINFO); REGISTER_CURL_CONSTANT(CURLOPT_CAPATH); @@ -1224,6 +1230,9 @@ case CURLOPT_MUTE: #endif case CURLOPT_TIMEOUT: +#ifdef CURLOPT_TIMEOUT_MS + case CURLOPT_TIMEOUT_MS: +#endif case CURLOPT_FTP_USE_EPSV: case CURLOPT_LOW_SPEED_LIMIT: case CURLOPT_SSLVERSION: @@ -1240,6 +1249,9 @@ case CURLOPT_FRESH_CONNECT: case CURLOPT_FORBID_REUSE: case CURLOPT_CONNECTTIMEOUT: +#ifdef CURLOPT_CONNECTTIMEOUT_MS + case CURLOPT_CONNECTTIMEOUT_MS: +#endif case CURLOPT_SSL_VERIFYHOST: case CURLOPT_SSL_VERIFYPEER: case CURLOPT_DNS_USE_GLOBAL_CACHE: -- 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) /sapi/cgi cgi_main.c
pollita Thu Mar 29 18:47:04 2007 UTC Modified files: (Branch: PHP_5_2) /php-src/sapi/cgi cgi_main.c Log: Add missing #if check http://cvs.php.net/viewvc.cgi/php-src/sapi/cgi/cgi_main.c?r1=1.267.2.15.2.31r2=1.267.2.15.2.32diff_format=u Index: php-src/sapi/cgi/cgi_main.c diff -u php-src/sapi/cgi/cgi_main.c:1.267.2.15.2.31 php-src/sapi/cgi/cgi_main.c:1.267.2.15.2.32 --- php-src/sapi/cgi/cgi_main.c:1.267.2.15.2.31 Wed Mar 28 15:39:22 2007 +++ php-src/sapi/cgi/cgi_main.c Thu Mar 29 18:47:04 2007 @@ -21,7 +21,7 @@ +--+ */ -/* $Id: cgi_main.c,v 1.267.2.15.2.31 2007/03/28 15:39:22 dmitry Exp $ */ +/* $Id: cgi_main.c,v 1.267.2.15.2.32 2007/03/29 18:47:04 pollita Exp $ */ #include php.h #include php_globals.h @@ -1214,6 +1214,7 @@ } break; } +#if PHP_FASTCGI /* if we're started on command line, check to see if we are being started as an 'external' fastcgi server by accepting a bindpath parameter. */ @@ -1222,6 +1223,7 @@ bindpath = strdup(php_optarg); } break; +#endif } } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /main/streams streams.c
pollita Tue Mar 6 20:04:05 2007 UTC Modified files: /php-src/main/streams streams.c Log: Fix handling over overridden file:// wrapper http://cvs.php.net/viewvc.cgi/php-src/main/streams/streams.c?r1=1.149r2=1.150diff_format=u Index: php-src/main/streams/streams.c diff -u php-src/main/streams/streams.c:1.149 php-src/main/streams/streams.c:1.150 --- php-src/main/streams/streams.c:1.149Sat Mar 3 18:59:53 2007 +++ php-src/main/streams/streams.c Tue Mar 6 20:04:05 2007 @@ -19,7 +19,7 @@ +--+ */ -/* $Id: streams.c,v 1.149 2007/03/03 18:59:53 helly Exp $ */ +/* $Id: streams.c,v 1.150 2007/03/06 20:04:05 pollita Exp $ */ #define _GNU_SOURCE #include php.h @@ -2138,18 +2138,18 @@ if (options STREAM_LOCATE_WRAPPERS_ONLY) { return NULL; } - + /* The file:// wrapper may have been disabled/overridden */ - if (FG(stream_wrappers)) { - if (!wrapperpp || zend_hash_find(wrapper_hash, file, sizeof(file), (void**)wrapperpp) == FAILURE) { + if (FG(stream_wrappers)) { + if (zend_hash_find(wrapper_hash, file, sizeof(file), (void**)wrapperpp) == FAILURE) { if (options REPORT_ERRORS) { php_error_docref(NULL TSRMLS_CC, E_WARNING, Plainfiles wrapper disabled); } return NULL; + } else { + /* Handles overridden plain files wrapper */ + plain_files_wrapper = *wrapperpp; } - - /* Handles overridden plain files wrapper */ - plain_files_wrapper = *wrapperpp; } if (!php_stream_allow_url_fopen(file, sizeof(file) - 1) || -- 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) /main/streams plain_wrapper.c
pollita Fri Feb 23 23:09:14 2007 UTC Modified files: (Branch: PHP_5_2) /php-src/main/streams plain_wrapper.c Log: MFH (r-1.82): Add retry for interrupted reads and graceful handling for failed retries http://cvs.php.net/viewvc.cgi/php-src/main/streams/plain_wrapper.c?r1=1.52.2.6.2.16r2=1.52.2.6.2.17diff_format=u Index: php-src/main/streams/plain_wrapper.c diff -u php-src/main/streams/plain_wrapper.c:1.52.2.6.2.16 php-src/main/streams/plain_wrapper.c:1.52.2.6.2.17 --- php-src/main/streams/plain_wrapper.c:1.52.2.6.2.16 Wed Feb 21 21:57:21 2007 +++ php-src/main/streams/plain_wrapper.cFri Feb 23 23:09:14 2007 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: plain_wrapper.c,v 1.52.2.6.2.16 2007/02/21 21:57:21 tony2001 Exp $ */ +/* $Id: plain_wrapper.c,v 1.52.2.6.2.17 2007/02/23 23:09:14 pollita Exp $ */ #include php.h #include php_globals.h @@ -333,8 +333,15 @@ return 0; } ret = read(data-fd, buf, count); - - stream-eof = (ret == 0 || (ret == (size_t)-1 errno != EWOULDBLOCK)); + + if (ret == (size_t)-1 errno == EINTR) { + /* Read was interrupted, retry once, + If read still fails, giveup with feof==0 + so script can retry if desired */ + ret = read(data-fd, buf, count); + } + + stream-eof = (ret == 0 || (ret == (size_t)-1 errno != EWOULDBLOCK errno != EINTR)); } else { #if HAVE_FLUSHIO -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src / NEWS /ext/soap php_http.c php_xml.c /ext/standard php_fopen_wrapper.c /main main.c php_globals.h php_streams.h /main/streams streams.c userspace.c
pollita Wed Jan 24 21:43:47 2007 UTC Modified files: /php-src/ext/soap php_http.c php_xml.c /php-src/ext/standard php_fopen_wrapper.c /php-src/main main.c php_globals.h php_streams.h /php-src/main/streams streams.c userspace.c /php-srcNEWS Log: Expand allow_url_fopen/allow_url_include functionality http://cvs.php.net/viewvc.cgi/php-src/ext/soap/php_http.c?r1=1.100r2=1.101diff_format=u Index: php-src/ext/soap/php_http.c diff -u php-src/ext/soap/php_http.c:1.100 php-src/ext/soap/php_http.c:1.101 --- php-src/ext/soap/php_http.c:1.100 Wed Jan 17 00:22:48 2007 +++ php-src/ext/soap/php_http.c Wed Jan 24 21:43:47 2007 @@ -17,7 +17,7 @@ | Dmitry Stogov [EMAIL PROTECTED] | +--+ */ -/* $Id: php_http.c,v 1.100 2007/01/17 00:22:48 pollita Exp $ */ +/* $Id: php_http.c,v 1.101 2007/01/24 21:43:47 pollita Exp $ */ #include php_soap.h #include ext/standard/base64.h @@ -232,7 +232,7 @@ int content_type_xml = 0; char *content_encoding; char *http_msg = NULL; - zend_bool old_allow_url_fopen; + char *old_allow_url_fopen_list; soap_client_object *client; if (this_ptr == NULL || Z_TYPE_P(this_ptr) != IS_OBJECT) { @@ -317,13 +317,16 @@ return FALSE; } - old_allow_url_fopen = PG(allow_url_fopen); - zend_alter_ini_entry(allow_url_fopen, sizeof(allow_url_fopen), 1, 1, PHP_INI_SYSTEM, PHP_INI_STAGE_RUNTIME); + old_allow_url_fopen_list = PG(allow_url_fopen_list); + if (!old_allow_url_fopen_list) { + old_allow_url_fopen_list = ; + } + zend_alter_ini_entry(allow_url_fopen, sizeof(allow_url_fopen), *, 1, PHP_INI_SYSTEM, PHP_INI_STAGE_RUNTIME); if (use_ssl php_stream_locate_url_wrapper(https://;, NULL, STREAM_LOCATE_WRAPPERS_ONLY TSRMLS_CC) == NULL) { php_url_free(phpurl); if (request != buf) {efree(request);} add_soap_fault(this_ptr, HTTP, SSL support is not available in this build, NULL, NULL TSRMLS_CC); - zend_alter_ini_entry(allow_url_fopen, sizeof(allow_url_fopen), old_allow_url_fopen ? 1 : 0, 1, PHP_INI_SYSTEM, PHP_INI_STAGE_RUNTIME); + zend_alter_ini_entry(allow_url_fopen, sizeof(allow_url_fopen), old_allow_url_fopen_list, strlen(old_allow_url_fopen_list), PHP_INI_SYSTEM, PHP_INI_STAGE_RUNTIME); return FALSE; } @@ -376,11 +379,11 @@ php_url_free(phpurl); if (request != buf) {efree(request);} add_soap_fault(this_ptr, HTTP, Could not connect to host, NULL, NULL TSRMLS_CC); - zend_alter_ini_entry(allow_url_fopen, sizeof(allow_url_fopen), old_allow_url_fopen ? 1 : 0, 1, PHP_INI_SYSTEM, PHP_INI_STAGE_RUNTIME); + zend_alter_ini_entry(allow_url_fopen, sizeof(allow_url_fopen), old_allow_url_fopen_list, strlen(old_allow_url_fopen_list), PHP_INI_SYSTEM, PHP_INI_STAGE_RUNTIME); return FALSE; } } - zend_alter_ini_entry(allow_url_fopen, sizeof(allow_url_fopen), old_allow_url_fopen ? 1 : 0, 1, PHP_INI_SYSTEM, PHP_INI_STAGE_RUNTIME); + zend_alter_ini_entry(allow_url_fopen, sizeof(allow_url_fopen), old_allow_url_fopen_list, strlen(old_allow_url_fopen_list), PHP_INI_SYSTEM, PHP_INI_STAGE_RUNTIME); if (stream) { if (client-url) { http://cvs.php.net/viewvc.cgi/php-src/ext/soap/php_xml.c?r1=1.31r2=1.32diff_format=u Index: php-src/ext/soap/php_xml.c diff -u php-src/ext/soap/php_xml.c:1.31 php-src/ext/soap/php_xml.c:1.32 --- php-src/ext/soap/php_xml.c:1.31 Wed Jan 17 00:22:48 2007 +++ php-src/ext/soap/php_xml.c Wed Jan 24 21:43:47 2007 @@ -17,7 +17,7 @@ | Dmitry Stogov [EMAIL PROTECTED] | +--+ */ -/* $Id: php_xml.c,v 1.31 2007/01/17 00:22:48 pollita Exp $ */ +/* $Id: php_xml.c,v 1.32 2007/01/24 21:43:47 pollita Exp $ */ #include php_soap.h #include libxml/parser.h @@ -80,16 +80,19 @@ { xmlParserCtxtPtr ctxt = NULL; xmlDocPtr ret; - zend_bool old_allow_url_fopen; + char *old_allow_url_fopen_list; /* xmlInitParser(); */ - old_allow_url_fopen = PG(allow_url_fopen); - zend_alter_ini_entry(allow_url_fopen, sizeof(allow_url_fopen), 1, 1, PHP_INI_SYSTEM, PHP_INI_STAGE_RUNTIME); + old_allow_url_fopen_list = PG(allow_url_fopen_list); + if (!old_allow_url_fopen_list) { + old_allow_url_fopen_list = ; + } + zend_alter_ini_entry(allow_url_fopen, sizeof(allow_url_fopen), *, 1, PHP_INI_SYSTEM, PHP_INI_STAGE_RUNTIME); ctxt = xmlCreateFileParserCtxt(filename); -
[PHP-CVS] cvs: php-src /ext/soap php_http.c php_xml.c
pollita Wed Jan 17 00:22:48 2007 UTC Modified files: /php-src/ext/soap php_http.c php_xml.c Log: INI options should not be modified directly. Bad extension. No cookie for you. http://cvs.php.net/viewvc.cgi/php-src/ext/soap/php_http.c?r1=1.99r2=1.100diff_format=u Index: php-src/ext/soap/php_http.c diff -u php-src/ext/soap/php_http.c:1.99 php-src/ext/soap/php_http.c:1.100 --- php-src/ext/soap/php_http.c:1.99Mon Jan 1 09:29:29 2007 +++ php-src/ext/soap/php_http.c Wed Jan 17 00:22:48 2007 @@ -17,7 +17,7 @@ | Dmitry Stogov [EMAIL PROTECTED] | +--+ */ -/* $Id: php_http.c,v 1.99 2007/01/01 09:29:29 sebastian Exp $ */ +/* $Id: php_http.c,v 1.100 2007/01/17 00:22:48 pollita Exp $ */ #include php_soap.h #include ext/standard/base64.h @@ -318,12 +318,12 @@ } old_allow_url_fopen = PG(allow_url_fopen); - PG(allow_url_fopen) = 1; + zend_alter_ini_entry(allow_url_fopen, sizeof(allow_url_fopen), 1, 1, PHP_INI_SYSTEM, PHP_INI_STAGE_RUNTIME); if (use_ssl php_stream_locate_url_wrapper(https://;, NULL, STREAM_LOCATE_WRAPPERS_ONLY TSRMLS_CC) == NULL) { php_url_free(phpurl); if (request != buf) {efree(request);} add_soap_fault(this_ptr, HTTP, SSL support is not available in this build, NULL, NULL TSRMLS_CC); - PG(allow_url_fopen) = old_allow_url_fopen; + zend_alter_ini_entry(allow_url_fopen, sizeof(allow_url_fopen), old_allow_url_fopen ? 1 : 0, 1, PHP_INI_SYSTEM, PHP_INI_STAGE_RUNTIME); return FALSE; } @@ -376,11 +376,11 @@ php_url_free(phpurl); if (request != buf) {efree(request);} add_soap_fault(this_ptr, HTTP, Could not connect to host, NULL, NULL TSRMLS_CC); - PG(allow_url_fopen) = old_allow_url_fopen; + zend_alter_ini_entry(allow_url_fopen, sizeof(allow_url_fopen), old_allow_url_fopen ? 1 : 0, 1, PHP_INI_SYSTEM, PHP_INI_STAGE_RUNTIME); return FALSE; } } - PG(allow_url_fopen) = old_allow_url_fopen; + zend_alter_ini_entry(allow_url_fopen, sizeof(allow_url_fopen), old_allow_url_fopen ? 1 : 0, 1, PHP_INI_SYSTEM, PHP_INI_STAGE_RUNTIME); if (stream) { if (client-url) { http://cvs.php.net/viewvc.cgi/php-src/ext/soap/php_xml.c?r1=1.30r2=1.31diff_format=u Index: php-src/ext/soap/php_xml.c diff -u php-src/ext/soap/php_xml.c:1.30 php-src/ext/soap/php_xml.c:1.31 --- php-src/ext/soap/php_xml.c:1.30 Mon Jan 1 09:29:29 2007 +++ php-src/ext/soap/php_xml.c Wed Jan 17 00:22:48 2007 @@ -17,7 +17,7 @@ | Dmitry Stogov [EMAIL PROTECTED] | +--+ */ -/* $Id: php_xml.c,v 1.30 2007/01/01 09:29:29 sebastian Exp $ */ +/* $Id: php_xml.c,v 1.31 2007/01/17 00:22:48 pollita Exp $ */ #include php_soap.h #include libxml/parser.h @@ -87,9 +87,9 @@ */ old_allow_url_fopen = PG(allow_url_fopen); - PG(allow_url_fopen) = 1; + zend_alter_ini_entry(allow_url_fopen, sizeof(allow_url_fopen), 1, 1, PHP_INI_SYSTEM, PHP_INI_STAGE_RUNTIME); ctxt = xmlCreateFileParserCtxt(filename); - PG(allow_url_fopen) = old_allow_url_fopen; + zend_alter_ini_entry(allow_url_fopen, sizeof(allow_url_fopen), old_allow_url_fopen ? 1 : 0, 1, PHP_INI_SYSTEM, PHP_INI_STAGE_RUNTIME); if (ctxt) { ctxt-keepBlanks = 0; ctxt-sax-ignorableWhitespace = soap_ignorableWhitespace; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /main php_streams.h /main/streams streams.c
pollita Wed Jan 10 22:43:17 2007 UTC Modified files: /php-src/main php_streams.h /php-src/main/streams streams.c Log: Add convenience function for openeing files with unicode names http://cvs.php.net/viewvc.cgi/php-src/main/php_streams.h?r1=1.120r2=1.121diff_format=u Index: php-src/main/php_streams.h diff -u php-src/main/php_streams.h:1.120 php-src/main/php_streams.h:1.121 --- php-src/main/php_streams.h:1.120Mon Jan 1 09:29:35 2007 +++ php-src/main/php_streams.h Wed Jan 10 22:43:17 2007 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: php_streams.h,v 1.120 2007/01/01 09:29:35 sebastian Exp $ */ +/* $Id: php_streams.h,v 1.121 2007/01/10 22:43:17 pollita Exp $ */ #ifndef PHP_STREAMS_H #define PHP_STREAMS_H @@ -618,12 +618,18 @@ PHPAPI int php_unregister_url_stream_wrapper_volatile(char *protocol TSRMLS_DC); PHPAPI void php_stream_fix_encoding(php_stream *stream, const char *mode, php_stream_context *context TSRMLS_DC); PHPAPI php_stream *_php_stream_open_wrapper_ex(char *path, char *mode, int options, char **opened_path, php_stream_context *context STREAMS_DC TSRMLS_DC); +PHPAPI php_stream *_php_stream_u_open_wrapper(zend_uchar type, zstr path, int path_len, char *mode, int options, zstr *opened_path, int *opened_path_len, php_stream_context *context STREAMS_DC TSRMLS_DC); PHPAPI php_stream_wrapper *php_stream_locate_url_wrapper(const char *path, char **path_for_open, int options TSRMLS_DC); PHPAPI void *php_stream_locate_eol(php_stream *stream, zstr zbuf, int buf_len TSRMLS_DC); #define php_stream_open_wrapper(path, mode, options, opened) _php_stream_open_wrapper_ex((path), (mode), (options), (opened), NULL STREAMS_CC TSRMLS_CC) #define php_stream_open_wrapper_ex(path, mode, options, opened, context) _php_stream_open_wrapper_ex((path), (mode), (options), (opened), (context) STREAMS_CC TSRMLS_CC) +#define php_stream_u_open_wrapper(type, path, path_len, mode, options, opened, context)\ + _php_stream_u_open_wrapper((type), (path), (path_len), (mode), (options), (opened), NULL, (context) STREAMS_CC TSRMLS_CC) +#define php_stream_u_open_wrapper_ex(type, path, path_len, mode, options, opened, opened_len, context) \ + _php_stream_u_open_wrapper((type), (path), (path_len), (mode), (options), (opened), (opened_len), (context) STREAMS_CC TSRMLS_CC) + #define php_stream_get_from_zval(stream, zstream, mode, options, opened, context) \ if (Z_TYPE_PP((zstream)) == IS_RESOURCE) { \ php_stream_from_zval((stream), (zstream)); \ http://cvs.php.net/viewvc.cgi/php-src/main/streams/streams.c?r1=1.142r2=1.143diff_format=u Index: php-src/main/streams/streams.c diff -u php-src/main/streams/streams.c:1.142 php-src/main/streams/streams.c:1.143 --- php-src/main/streams/streams.c:1.142Mon Jan 1 09:29:35 2007 +++ php-src/main/streams/streams.c Wed Jan 10 22:43:17 2007 @@ -19,7 +19,7 @@ +--+ */ -/* $Id: streams.c,v 1.142 2007/01/01 09:29:35 sebastian Exp $ */ +/* $Id: streams.c,v 1.143 2007/01/10 22:43:17 pollita Exp $ */ #define _GNU_SOURCE #include php.h @@ -2434,6 +2434,61 @@ } /* }}} */ +/* {{{ _php_stream_u_open_wrapper */ +PHPAPI php_stream *_php_stream_u_open_wrapper(zend_uchar type, zstr path, int path_len, + char *mode, int options, zstr *opened_path, int *opened_path_len, + php_stream_context *context STREAMS_DC TSRMLS_DC) +{ + php_stream *stream; + char *filename = NULL; + int filename_len; + + if (opened_path) { + opened_path-v = NULL; + } + if (opened_path_len) { + *opened_path_len = 0; + } + + if (type == IS_STRING) { + stream = php_stream_open_wrapper_ex(path.s, mode, options, (char**)opened_path, context); + + if (opened_path_len opened_path opened_path-s) { + *opened_path_len = strlen(opened_path-s); + } + + return stream; + } + + /* type == IS_UNICODE */ + if (FAILURE == php_stream_path_encode(NULL, filename, filename_len, path.u, path_len, options, context)) { + return NULL; + } + + stream = php_stream_open_wrapper_ex(filename, mode, options, (char**)opened_path, context); + efree(filename); + + if (opened_path opened_path-s) { + UChar *upath; + int upath_len; + + if (SUCCESS == php_stream_path_decode(NULL, upath, upath_len, opened_path-s, strlen(opened_path-s), options, context)) { + efree(opened_path-s); + opened_path-u = upath; + if (opened_path_len) { + *opened_path_len = upath_len; +
[PHP-CVS] cvs: php-src /ext/posix posix.c /ext/standard filestat.c
pollita Thu Jan 11 01:52:24 2007 UTC Modified files: /php-src/ext/posix posix.c /php-src/ext/standard filestat.c Log: Some platforms have getpwnam_r() but are missing _SC_GETPW_R_SIZE_MAX http://cvs.php.net/viewvc.cgi/php-src/ext/posix/posix.c?r1=1.87r2=1.88diff_format=u Index: php-src/ext/posix/posix.c diff -u php-src/ext/posix/posix.c:1.87 php-src/ext/posix/posix.c:1.88 --- php-src/ext/posix/posix.c:1.87 Fri Jan 5 21:30:06 2007 +++ php-src/ext/posix/posix.c Thu Jan 11 01:52:24 2007 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: posix.c,v 1.87 2007/01/05 21:30:06 pollita Exp $ */ +/* $Id: posix.c,v 1.88 2007/01/11 01:52:24 pollita Exp $ */ #ifdef HAVE_CONFIG_H #include config.h @@ -147,7 +147,7 @@ static PHP_MINFO_FUNCTION(posix) { php_info_print_table_start(); - php_info_print_table_row(2, Revision, $Revision: 1.87 $); + php_info_print_table_row(2, Revision, $Revision: 1.88 $); php_info_print_table_end(); } /* }}} */ @@ -942,7 +942,7 @@ RETURN_FALSE; } -#ifdef HAVE_GETPWNAM_R +#if defined(_SC_GETPW_R_SIZE_MAX) defined(HAVE_GETPWNAM_R) buflen = sysconf(_SC_GETPW_R_SIZE_MAX); buf = emalloc(buflen); pw = pwbuf; @@ -988,7 +988,7 @@ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, l, uid) == FAILURE) { RETURN_FALSE; } -#ifdef HAVE_GETPWUID_R +#if defined(_SC_GETPW_R_SIZE_MAX) defined(HAVE_GETPWUID_R) pwbuflen = sysconf(_SC_GETPW_R_SIZE_MAX); pwbuf = emalloc(pwbuflen); http://cvs.php.net/viewvc.cgi/php-src/ext/standard/filestat.c?r1=1.154r2=1.155diff_format=u Index: php-src/ext/standard/filestat.c diff -u php-src/ext/standard/filestat.c:1.154 php-src/ext/standard/filestat.c:1.155 --- php-src/ext/standard/filestat.c:1.154 Mon Jan 1 09:29:31 2007 +++ php-src/ext/standard/filestat.c Thu Jan 11 01:52:24 2007 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: filestat.c,v 1.154 2007/01/01 09:29:31 sebastian Exp $ */ +/* $Id: filestat.c,v 1.155 2007/01/11 01:52:24 pollita Exp $ */ #include php.h #include fopen_wrappers.h @@ -521,7 +521,7 @@ if (Z_TYPE_P(user) == IS_LONG) { uid = (uid_t)Z_LVAL_P(user); } else { -#ifdef HAVE_GETPWNAM_R +#if defined(_SC_GETPW_R_SIZE_MAX) defined(HAVE_GETPWNAM_R) struct passwd pw; struct passwd *retpwptr = NULL; int pwbuflen = sysconf(_SC_GETPW_R_SIZE_MAX); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/posix posix.c
pollita Thu Jan 11 02:31:50 2007 UTC Modified files: /php-src/ext/posix posix.c Log: #ifdef out the rest of that getpwuid_r() patch, see prior commit http://cvs.php.net/viewvc.cgi/php-src/ext/posix/posix.c?r1=1.88r2=1.89diff_format=u Index: php-src/ext/posix/posix.c diff -u php-src/ext/posix/posix.c:1.88 php-src/ext/posix/posix.c:1.89 --- php-src/ext/posix/posix.c:1.88 Thu Jan 11 01:52:24 2007 +++ php-src/ext/posix/posix.c Thu Jan 11 02:31:50 2007 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: posix.c,v 1.88 2007/01/11 01:52:24 pollita Exp $ */ +/* $Id: posix.c,v 1.89 2007/01/11 02:31:50 pollita Exp $ */ #ifdef HAVE_CONFIG_H #include config.h @@ -147,7 +147,7 @@ static PHP_MINFO_FUNCTION(posix) { php_info_print_table_start(); - php_info_print_table_row(2, Revision, $Revision: 1.88 $); + php_info_print_table_row(2, Revision, $Revision: 1.89 $); php_info_print_table_end(); } /* }}} */ @@ -932,7 +932,7 @@ struct passwd *pw; char *name; int name_len; -#ifdef HAVE_GETPWNAM_R +#if defined(_SC_GETPW_R_SIZE_MAX) defined(HAVE_GETPWNAM_R) struct passwd pwbuf; int buflen; char *buf; @@ -965,7 +965,7 @@ php_error_docref(NULL TSRMLS_CC, E_WARNING, unable to convert posix passwd struct to array); RETVAL_FALSE; } -#ifdef HAVE_GETPWNAM_R +#if defined(_SC_GETPW_R_SIZE_MAX) defined(HAVE_GETPWNAM_R) efree(buf); #endif } @@ -976,7 +976,7 @@ PHP_FUNCTION(posix_getpwuid) { long uid; -#ifdef HAVE_GETPWUID_R +#if defined(_SC_GETPW_R_SIZE_MAX) defined(HAVE_GETPWUID_R) struct passwd _pw; struct passwd *retpwptr = NULL; int pwbuflen; @@ -1012,7 +1012,7 @@ php_error_docref(NULL TSRMLS_CC, E_WARNING, unable to convert posix passwd struct to array); RETVAL_FALSE; } -#ifdef HAVE_GETPWUID_R +#if defined(_SC_GETPW_R_SIZE_MAX) defined(HAVE_GETPWUID_R) efree(pwbuf); #endif } -- 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) /ext/posix posix.c /ext/standard filestat.c
pollita Thu Jan 11 02:33:07 2007 UTC Modified files: (Branch: PHP_5_2) /php-src/ext/standard filestat.c /php-src/ext/posix posix.c Log: MFH http://cvs.php.net/viewvc.cgi/php-src/ext/standard/filestat.c?r1=1.136.2.8.2.7r2=1.136.2.8.2.8diff_format=u Index: php-src/ext/standard/filestat.c diff -u php-src/ext/standard/filestat.c:1.136.2.8.2.7 php-src/ext/standard/filestat.c:1.136.2.8.2.8 --- php-src/ext/standard/filestat.c:1.136.2.8.2.7 Mon Jan 1 09:36:08 2007 +++ php-src/ext/standard/filestat.c Thu Jan 11 02:33:07 2007 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: filestat.c,v 1.136.2.8.2.7 2007/01/01 09:36:08 sebastian Exp $ */ +/* $Id: filestat.c,v 1.136.2.8.2.8 2007/01/11 02:33:07 pollita Exp $ */ #include php.h #include safe_mode.h @@ -454,7 +454,7 @@ } convert_to_string_ex(filename); if (Z_TYPE_PP(user) == IS_STRING) { -#ifdef HAVE_GETPWNAM_R +#if defined(_SC_GETPW_R_SIZE_MAX) defined(HAVE_GETPWNAM_R) struct passwd pw; struct passwd *retpwptr = NULL; int pwbuflen = sysconf(_SC_GETPW_R_SIZE_MAX); http://cvs.php.net/viewvc.cgi/php-src/ext/posix/posix.c?r1=1.70.2.3.2.10r2=1.70.2.3.2.11diff_format=u Index: php-src/ext/posix/posix.c diff -u php-src/ext/posix/posix.c:1.70.2.3.2.10 php-src/ext/posix/posix.c:1.70.2.3.2.11 --- php-src/ext/posix/posix.c:1.70.2.3.2.10 Mon Jan 1 09:36:05 2007 +++ php-src/ext/posix/posix.c Thu Jan 11 02:33:07 2007 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: posix.c,v 1.70.2.3.2.10 2007/01/01 09:36:05 sebastian Exp $ */ +/* $Id: posix.c,v 1.70.2.3.2.11 2007/01/11 02:33:07 pollita Exp $ */ #ifdef HAVE_CONFIG_H #include config.h @@ -147,7 +147,7 @@ static PHP_MINFO_FUNCTION(posix) { php_info_print_table_start(); - php_info_print_table_row(2, Revision, $Revision: 1.70.2.3.2.10 $); + php_info_print_table_row(2, Revision, $Revision: 1.70.2.3.2.11 $); php_info_print_table_end(); } /* }}} */ @@ -932,7 +932,7 @@ struct passwd *pw; char *name; int name_len; -#ifdef HAVE_GETPWNAM_R +#if defined(_SC_GETPW_R_SIZE_MAX) defined(HAVE_GETPWNAM_R) struct passwd pwbuf; int buflen; char *buf; @@ -942,7 +942,7 @@ RETURN_FALSE; } -#ifdef HAVE_GETPWNAM_R +#if defined(_SC_GETPW_R_SIZE_MAX) defined(HAVE_GETPWNAM_R) buflen = sysconf(_SC_GETPW_R_SIZE_MAX); buf = emalloc(buflen); pw = pwbuf; @@ -965,7 +965,7 @@ php_error_docref(NULL TSRMLS_CC, E_WARNING, unable to convert posix passwd struct to array); RETVAL_FALSE; } -#ifdef HAVE_GETPWNAM_R +#if defined(_SC_GETPW_R_SIZE_MAX) defined(HAVE_GETPWNAM_R) efree(buf); #endif } @@ -976,7 +976,7 @@ PHP_FUNCTION(posix_getpwuid) { long uid; -#ifdef HAVE_GETPWUID_R +#if defined(_SC_GETPW_R_SIZE_MAX) defined(HAVE_GETPWUID_R) struct passwd _pw; struct passwd *retpwptr = NULL; int pwbuflen; @@ -988,7 +988,7 @@ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, l, uid) == FAILURE) { RETURN_FALSE; } -#ifdef HAVE_GETPWUID_R +#if defined(_SC_GETPW_R_SIZE_MAX) defined(HAVE_GETPWUID_R) pwbuflen = sysconf(_SC_GETPW_R_SIZE_MAX); pwbuf = emalloc(pwbuflen); @@ -1012,7 +1012,7 @@ php_error_docref(NULL TSRMLS_CC, E_WARNING, unable to convert posix passwd struct to array); RETVAL_FALSE; } -#ifdef HAVE_GETPWUID_R +#if defined(_SC_GETPW_R_SIZE_MAX) defined(HAVE_GETPWUID_R) efree(pwbuf); #endif } -- 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) / NEWS /ext/curl interface.c
pollita Tue Jan 9 23:13:05 2007 UTC Modified files: (Branch: PHP_5_2) /php-src/ext/curl interface.c /php-srcNEWS Log: MFH: Add CURLOPT_TCP_NODELAY constant http://cvs.php.net/viewvc.cgi/php-src/ext/curl/interface.c?r1=1.62.2.14.2.19r2=1.62.2.14.2.20diff_format=u Index: php-src/ext/curl/interface.c diff -u php-src/ext/curl/interface.c:1.62.2.14.2.19 php-src/ext/curl/interface.c:1.62.2.14.2.20 --- php-src/ext/curl/interface.c:1.62.2.14.2.19 Mon Jan 1 09:35:48 2007 +++ php-src/ext/curl/interface.cTue Jan 9 23:13:05 2007 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: interface.c,v 1.62.2.14.2.19 2007/01/01 09:35:48 sebastian Exp $ */ +/* $Id: interface.c,v 1.62.2.14.2.20 2007/01/09 23:13:05 pollita Exp $ */ #define ZEND_INCLUDE_FULL_WINDOWS_HEADERS @@ -452,6 +452,7 @@ REGISTER_CURL_CONSTANT(CURLOPT_PROXYPORT); REGISTER_CURL_CONSTANT(CURLOPT_UNRESTRICTED_AUTH); REGISTER_CURL_CONSTANT(CURLOPT_FTP_USE_EPRT); + REGISTER_CURL_CONSTANT(CURLOPT_TCP_NODELAY); REGISTER_CURL_CONSTANT(CURLOPT_HTTP200ALIASES); REGISTER_CURL_CONSTANT(CURL_TIMECOND_IFMODSINCE); REGISTER_CURL_CONSTANT(CURL_TIMECOND_IFUNMODSINCE); @@ -1263,6 +1264,7 @@ case CURLOPT_PORT: case CURLOPT_AUTOREFERER: case CURLOPT_COOKIESESSION: + case CURLOPT_TCP_NODELAY: convert_to_long_ex(zvalue); error = curl_easy_setopt(ch-cp, option, Z_LVAL_PP(zvalue)); break; http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.483r2=1.2027.2.547.2.484diff_format=u Index: php-src/NEWS diff -u php-src/NEWS:1.2027.2.547.2.483 php-src/NEWS:1.2027.2.547.2.484 --- php-src/NEWS:1.2027.2.547.2.483 Tue Jan 9 18:50:45 2007 +++ php-src/NEWSTue Jan 9 23:13:05 2007 @@ -1,6 +1,7 @@ PHPNEWS ||| ?? Jan 2007, PHP 5.2.1RC3 +- Added CURLOPT_TCP_NODELAY constant to Curl extension. (Sara) - Improved proc_open(). Now on Windows it can run external commands not through CMD.EXE. (Dmitry) - Fixed bug #40076 (zend_alloc.c: Value of enumeration constant must be in -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/libxml libxml.c php_libxml.h
pollita Mon Jan 8 20:01:23 2007 UTC Modified files: /php-src/ext/libxml libxml.c php_libxml.h Log: Allow libxml DomNodes to remain persistent when requested by other extensions http://cvs.php.net/viewvc.cgi/php-src/ext/libxml/libxml.c?r1=1.56r2=1.57diff_format=u Index: php-src/ext/libxml/libxml.c diff -u php-src/ext/libxml/libxml.c:1.56 php-src/ext/libxml/libxml.c:1.57 --- php-src/ext/libxml/libxml.c:1.56Mon Jan 1 09:29:25 2007 +++ php-src/ext/libxml/libxml.c Mon Jan 8 20:01:23 2007 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: libxml.c,v 1.56 2007/01/01 09:29:25 sebastian Exp $ */ +/* $Id: libxml.c,v 1.57 2007/01/08 20:01:23 pollita Exp $ */ #define IS_EXT_MODULE @@ -947,7 +947,9 @@ ret_refcount = object-document-refcount; } else if (docp != NULL) { ret_refcount = 1; - object-document = emalloc(sizeof(php_libxml_ref_obj)); + object-document = pemalloc(sizeof(php_libxml_ref_obj), 0); + object-document-persistent = 0; + object-document-external_owner = 0; object-document-ptr = docp; object-document-refcount = ret_refcount; object-document-doc_props = NULL; @@ -972,9 +974,23 @@ } efree(object-document-doc_props); } - efree(object-document); + pefree(object-document, object-document-persistent); object-document = NULL; - } + } else if (ret_refcount == 1 object-document-external_owner) { + /* PHP is done with this object, but someone else owns the DomNodes, +* Kill the non-persistent bits, but leave the persistable php_libxml_ref_obj around */ + if (object-document-doc_props != NULL) { + if (object-document-doc_props-classmap) { + zend_hash_destroy(object-document-doc_props-classmap); + FREE_HASHTABLE(object-document-doc_props-classmap); + } + efree(object-document-doc_props); + object-document-doc_props = NULL; + } + /* Don't worry about the fact that this memory is left unfreed, +* Whoever else owns it has the pointer stored somewhere */ + object-document = NULL; + } } return ret_refcount; http://cvs.php.net/viewvc.cgi/php-src/ext/libxml/php_libxml.h?r1=1.23r2=1.24diff_format=u Index: php-src/ext/libxml/php_libxml.h diff -u php-src/ext/libxml/php_libxml.h:1.23 php-src/ext/libxml/php_libxml.h:1.24 --- php-src/ext/libxml/php_libxml.h:1.23Mon Jan 1 09:29:25 2007 +++ php-src/ext/libxml/php_libxml.h Mon Jan 8 20:01:23 2007 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: php_libxml.h,v 1.23 2007/01/01 09:29:25 sebastian Exp $ */ +/* $Id: php_libxml.h,v 1.24 2007/01/08 20:01:23 pollita Exp $ */ #ifndef PHP_LIBXML_H #define PHP_LIBXML_H @@ -58,6 +58,8 @@ void *ptr; int refcount; libxml_doc_props *doc_props; + zend_bool persistent; + zend_bool external_owner; } php_libxml_ref_obj; typedef struct _php_libxml_node_ptr { -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/curl interface.c
pollita Mon Jan 8 20:04:56 2007 UTC Modified files: /php-src/ext/curl interface.c Log: Add CURLOPT_TCP_NODELAY http://cvs.php.net/viewvc.cgi/php-src/ext/curl/interface.c?r1=1.106r2=1.107diff_format=u Index: php-src/ext/curl/interface.c diff -u php-src/ext/curl/interface.c:1.106 php-src/ext/curl/interface.c:1.107 --- php-src/ext/curl/interface.c:1.106 Mon Jan 1 09:29:22 2007 +++ php-src/ext/curl/interface.cMon Jan 8 20:04:56 2007 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: interface.c,v 1.106 2007/01/01 09:29:22 sebastian Exp $ */ +/* $Id: interface.c,v 1.107 2007/01/08 20:04:56 pollita Exp $ */ #define ZEND_INCLUDE_FULL_WINDOWS_HEADERS @@ -450,6 +450,7 @@ REGISTER_CURL_CONSTANT(CURLOPT_PROXYPORT); REGISTER_CURL_CONSTANT(CURLOPT_UNRESTRICTED_AUTH); REGISTER_CURL_CONSTANT(CURLOPT_FTP_USE_EPRT); + REGISTER_CURL_CONSTANT(CURLOPT_TCP_NODELAY); REGISTER_CURL_CONSTANT(CURLOPT_HTTP200ALIASES); REGISTER_CURL_CONSTANT(CURL_TIMECOND_IFMODSINCE); REGISTER_CURL_CONSTANT(CURL_TIMECOND_IFUNMODSINCE); @@ -1268,6 +1269,7 @@ case CURLOPT_PORT: case CURLOPT_AUTOREFERER: case CURLOPT_COOKIESESSION: + case CURLOPT_TCP_NODELAY: convert_to_long_ex(zvalue); error = curl_easy_setopt(ch-cp, option, Z_LVAL_PP(zvalue)); break; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/standard user_filters.c /ext/standard/tests/filters 001.phpt bug35916.phpt
pollita Sun Jan 7 06:29:41 2007 UTC Modified files: /php-src/ext/standard user_filters.c /php-src/ext/standard/tests/filters 001.phpt bug35916.phpt Log: Remaining unicode updates for user filters http://cvs.php.net/viewvc.cgi/php-src/ext/standard/user_filters.c?r1=1.41r2=1.42diff_format=u Index: php-src/ext/standard/user_filters.c diff -u php-src/ext/standard/user_filters.c:1.41 php-src/ext/standard/user_filters.c:1.42 --- php-src/ext/standard/user_filters.c:1.41Mon Jan 1 09:29:32 2007 +++ php-src/ext/standard/user_filters.c Sun Jan 7 06:29:40 2007 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: user_filters.c,v 1.41 2007/01/01 09:29:32 sebastian Exp $ */ +/* $Id: user_filters.c,v 1.42 2007/01/07 06:29:40 pollita Exp $ */ #include php.h #include php_globals.h @@ -31,8 +31,10 @@ struct php_user_filter_data { zend_class_entry *ce; - /* variable length; this *must* be last in the structure */ - char classname[1]; + + zend_uchar classname_type; + zstr classname; + int classname_len; }; /* to provide context for calling into the next filter from user-space */ @@ -50,10 +52,13 @@ } /* define the base filter class */ - -PHP_FUNCTION(user_filter_nop) +/* {{{ proto void user_filter_nop(void) U +Non-function */ +static PHP_FUNCTION(user_filter_nop) { } +/* }}} */ + static ZEND_BEGIN_ARG_INFO(arginfo_php_user_filter_filter, 0) ZEND_ARG_INFO(0, in) @@ -269,10 +274,10 @@ char *period; /* Userspace Filters using ambiguous wildcards could cause problems. - i.e.: myfilter.foo.bar will always call into myfilter.foo.* - never seeing myfilter.* - TODO: Allow failed userfilter creations to continue - scanning through the list */ + i.e.: myfilter.foo.bar will always call into myfilter.foo.* + never seeing myfilter.* + TODO: Allow failed userfilter creations to continue + scanning through the list */ if ((period = strrchr(filtername, '.'))) { char *wildcard; @@ -300,7 +305,7 @@ /* bind the classname to the actual class */ if (fdat-ce == NULL) { - if (FAILURE == zend_lookup_class(fdat-classname, strlen(fdat-classname), + if (FAILURE == zend_u_lookup_class(fdat-classname_type, fdat-classname, fdat-classname_len, (zend_class_entry ***)fdat-ce TSRMLS_CC)) { php_error_docref(NULL TSRMLS_CC, E_WARNING, user-filter \%s\ requires class \%s\, but that class is not defined, @@ -323,7 +328,7 @@ PZVAL_IS_REF(obj) = 1; /* filtername */ - add_property_string(obj, filtername, (char*)filtername, 1); + add_property_rt_string(obj, filtername, (char*)filtername, 1); /* and the parameters, if any */ if (filterparams) { @@ -378,9 +383,10 @@ static void filter_item_dtor(struct php_user_filter_data *fdat) { + efree(fdat-classname.v); } -/* {{{ proto object stream_bucket_make_writeable(resource brigade) +/* {{{ proto object stream_bucket_make_writeable(resource brigade) U Return a bucket object from the brigade for operating on */ PHP_FUNCTION(stream_bucket_make_writeable) { @@ -405,7 +411,7 @@ zval_ptr_dtor(zbucket); if (bucket-buf_type == IS_UNICODE) { add_property_unicodel(return_value, data, bucket-buf.u, bucket-buflen, 1); - add_property_long(return_value, datalen, bucket-buflen); + add_property_long(return_value, datalen, u_countChar32(bucket-buf.u, bucket-buflen)); } else { add_property_stringl(return_value, data, bucket-buf.s, bucket-buflen, 1); add_property_long(return_value, datalen, bucket-buflen); @@ -485,7 +491,7 @@ } /* }}} */ -/* {{{ proto void stream_bucket_prepend(resource brigade, resource bucket) +/* {{{ proto void stream_bucket_prepend(resource brigade, resource bucket) U Prepend bucket to brigade */ PHP_FUNCTION(stream_bucket_prepend) { @@ -493,7 +499,7 @@ } /* }}} */ -/* {{{ proto void stream_bucket_append(resource brigade, resource bucket) +/* {{{ proto void stream_bucket_append(resource brigade, resource bucket) U Append bucket to brigade */ PHP_FUNCTION(stream_bucket_append) { @@ -501,40 +507,40 @@ } /* }}} */ -/* {{{ proto resource stream_bucket_new(resource stream, string buffer) +/* {{{ proto object stream_bucket_new(resource stream, string buffer) U Create a new bucket for use on the current stream */ PHP_FUNCTION(stream_bucket_new) { zval *zstream, *zbucket; php_stream *stream; - zval *buffer; + zstr
[PHP-CVS] cvs: php-src /ext/session mod_files.c
pollita Fri Jan 5 17:29:31 2007 UTC Modified files: /php-src/ext/sessionmod_files.c Log: Don't bother with conversion when the converter is already UTF8 http://cvs.php.net/viewvc.cgi/php-src/ext/session/mod_files.c?r1=1.110r2=1.111diff_format=u Index: php-src/ext/session/mod_files.c diff -u php-src/ext/session/mod_files.c:1.110 php-src/ext/session/mod_files.c:1.111 --- php-src/ext/session/mod_files.c:1.110 Fri Jan 5 14:53:30 2007 +++ php-src/ext/session/mod_files.c Fri Jan 5 17:29:30 2007 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: mod_files.c,v 1.110 2007/01/05 14:53:30 sebastian Exp $ */ +/* $Id: mod_files.c,v 1.111 2007/01/05 17:29:30 pollita Exp $ */ #include php.h @@ -121,8 +121,8 @@ n += key_len; buf[n] = '\0'; - if (UG(unicode) UG(filesystem_encoding_conv)) { - /* If there's a cheap way to see if filesystem_encoding_conv happens to be utf8, we should skip this reconversion */ + if (UG(unicode) UG(filesystem_encoding_conv) + ucnv_getType(UG(filesystem_encoding_conv)) != UCNV_UTF8) { char *newbuf = NULL; int newlen; UErrorCode status = U_ZERO_ERROR; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/posix posix.c
pollita Fri Jan 5 20:01:44 2007 UTC Modified files: /php-src/ext/posix posix.c Log: BSD4.1 (possibly others) doesn't support _SC_TTY_NAME_MAX http://cvs.php.net/viewvc.cgi/php-src/ext/posix/posix.c?r1=1.85r2=1.86diff_format=u Index: php-src/ext/posix/posix.c diff -u php-src/ext/posix/posix.c:1.85 php-src/ext/posix/posix.c:1.86 --- php-src/ext/posix/posix.c:1.85 Mon Jan 1 09:29:28 2007 +++ php-src/ext/posix/posix.c Fri Jan 5 20:01:44 2007 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: posix.c,v 1.85 2007/01/01 09:29:28 sebastian Exp $ */ +/* $Id: posix.c,v 1.86 2007/01/05 20:01:44 pollita Exp $ */ #ifdef HAVE_CONFIG_H #include config.h @@ -147,7 +147,7 @@ static PHP_MINFO_FUNCTION(posix) { php_info_print_table_start(); - php_info_print_table_row(2, Revision, $Revision: 1.85 $); + php_info_print_table_row(2, Revision, $Revision: 1.86 $); php_info_print_table_end(); } /* }}} */ @@ -575,7 +575,12 @@ fd = Z_LVAL_PP(z_fd); } #if HAVE_TTYNAME_R +#ifdef _SC_TTY_NAME_MAX buflen = sysconf(_SC_TTY_NAME_MAX); +#else + /* Arbitrary buffer size for systems which don't extrospect their tty name lengths, way overkill */ + buflen = 64; +#endif p = emalloc(buflen); if (ttyname_r(fd, p, buflen)) { -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/posix config.m4 posix.c
pollita Fri Jan 5 21:30:06 2007 UTC Modified files: /php-src/ext/posix config.m4 posix.c Log: Refix posix_ttyname(), test for a working implementation of ttyname_r() -- which BSD doesn't have http://cvs.php.net/viewvc.cgi/php-src/ext/posix/config.m4?r1=1.15r2=1.16diff_format=u Index: php-src/ext/posix/config.m4 diff -u php-src/ext/posix/config.m4:1.15 php-src/ext/posix/config.m4:1.16 --- php-src/ext/posix/config.m4:1.15Thu Dec 7 01:41:29 2006 +++ php-src/ext/posix/config.m4 Fri Jan 5 21:30:06 2007 @@ -1,5 +1,5 @@ dnl -dnl $Id: config.m4,v 1.15 2006/12/07 01:41:29 iliaa Exp $ +dnl $Id: config.m4,v 1.16 2007/01/05 21:30:06 pollita Exp $ dnl PHP_ARG_ENABLE(posix,whether to enable POSIX-like functions, @@ -11,5 +11,22 @@ AC_CHECK_HEADERS(sys/mkdev.h) - AC_CHECK_FUNCS(seteuid setegid setsid getsid setpgid getpgid ctermid mkfifo mknod getrlimit getlogin getgroups makedev initgroups getpwuid_r getgrgid_r ttyname_r) + AC_CHECK_FUNCS(seteuid setegid setsid getsid setpgid getpgid ctermid mkfifo mknod getrlimit getlogin getgroups makedev initgroups getpwuid_r getgrgid_r) + + AC_MSG_CHECKING([for working ttyname_r() implementation]) + AC_TRY_RUN([ +#include unistd.h + +int main(int argc, char *argv[]) +{ + char buf[64]; + + return ttyname_r(0, buf, 64) ? 1 : 0; +} + ],[ +AC_MSG_RESULT([yes]) +AC_DEFINE(HAVE_TTYNAME_R, 1, [Whether you have a working ttyname_r]) + ],[ +AC_MSG_RESULT([no, posix_ttyname() will be thread-unsafe]) + ]) fi http://cvs.php.net/viewvc.cgi/php-src/ext/posix/posix.c?r1=1.86r2=1.87diff_format=u Index: php-src/ext/posix/posix.c diff -u php-src/ext/posix/posix.c:1.86 php-src/ext/posix/posix.c:1.87 --- php-src/ext/posix/posix.c:1.86 Fri Jan 5 20:01:44 2007 +++ php-src/ext/posix/posix.c Fri Jan 5 21:30:06 2007 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: posix.c,v 1.86 2007/01/05 20:01:44 pollita Exp $ */ +/* $Id: posix.c,v 1.87 2007/01/05 21:30:06 pollita Exp $ */ #ifdef HAVE_CONFIG_H #include config.h @@ -147,7 +147,7 @@ static PHP_MINFO_FUNCTION(posix) { php_info_print_table_start(); - php_info_print_table_row(2, Revision, $Revision: 1.86 $); + php_info_print_table_row(2, Revision, $Revision: 1.87 $); php_info_print_table_end(); } /* }}} */ @@ -575,12 +575,7 @@ fd = Z_LVAL_PP(z_fd); } #if HAVE_TTYNAME_R -#ifdef _SC_TTY_NAME_MAX buflen = sysconf(_SC_TTY_NAME_MAX); -#else - /* Arbitrary buffer size for systems which don't extrospect their tty name lengths, way overkill */ - buflen = 64; -#endif p = emalloc(buflen); if (ttyname_r(fd, p, buflen)) { -- 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) /ext/posix config.m4
pollita Fri Jan 5 21:31:56 2007 UTC Modified files: (Branch: PHP_5_2) /php-src/ext/posix config.m4 Log: MFH: (r-1.16) ttyname_r() is broken on BSD http://cvs.php.net/viewvc.cgi/php-src/ext/posix/config.m4?r1=1.12.4.3r2=1.12.4.4diff_format=u Index: php-src/ext/posix/config.m4 diff -u php-src/ext/posix/config.m4:1.12.4.3 php-src/ext/posix/config.m4:1.12.4.4 --- php-src/ext/posix/config.m4:1.12.4.3Thu Dec 7 01:41:18 2006 +++ php-src/ext/posix/config.m4 Fri Jan 5 21:31:56 2007 @@ -1,5 +1,5 @@ dnl -dnl $Id: config.m4,v 1.12.4.3 2006/12/07 01:41:18 iliaa Exp $ +dnl $Id: config.m4,v 1.12.4.4 2007/01/05 21:31:56 pollita Exp $ dnl PHP_ARG_ENABLE(posix,whether to enable POSIX-like functions, @@ -11,5 +11,22 @@ AC_CHECK_HEADERS(sys/mkdev.h) - AC_CHECK_FUNCS(seteuid setegid setsid getsid setpgid getpgid ctermid mkfifo mknod getrlimit getlogin getgroups makedev initgroups getpwuid_r getgrgid_r ttyname_r) + AC_CHECK_FUNCS(seteuid setegid setsid getsid setpgid getpgid ctermid mkfifo mknod getrlimit getlogin getgroups makedev initgroups getpwuid_r getgrgid_r) + + AC_MSG_CHECKING([for working ttyname_r() implementation]) + AC_TRY_RUN([ +#include unistd.h + +int main(int argc, char *argv[]) +{ + char buf[64]; + + return ttyname_r(0, buf, 64) ? 1 : 0; +} + ],[ +AC_MSG_RESULT([yes]) +AC_DEFINE(HAVE_TTYNAME_R, 1, [Whether you have a working ttyname_r]) + ],[ +AC_MSG_RESULT([no, posix_ttyname() will be thread-unsafe]) + ]) fi -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/session mod_files.c mod_user.c php_session.h session.c /ext/session/tests 001.phpt 003.phpt 004.phpt 005.phpt
pollita Fri Jan 5 02:07:59 2007 UTC Modified files: /php-src/ext/sessionphp_session.h session.c mod_user.c mod_files.c /php-src/ext/session/tests 001.phpt 003.phpt 004.phpt 005.phpt Log: Unicode Updates http://cvs.php.net/viewvc.cgi/php-src/ext/session/php_session.h?r1=1.111r2=1.112diff_format=u Index: php-src/ext/session/php_session.h diff -u php-src/ext/session/php_session.h:1.111 php-src/ext/session/php_session.h:1.112 --- php-src/ext/session/php_session.h:1.111 Thu Jan 4 22:04:38 2007 +++ php-src/ext/session/php_session.h Fri Jan 5 02:07:59 2007 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: php_session.h,v 1.111 2007/01/04 22:04:38 pollita Exp $ */ +/* $Id: php_session.h,v 1.112 2007/01/05 02:07:59 pollita Exp $ */ #ifndef PHP_SESSION_H #define PHP_SESSION_H @@ -199,6 +199,7 @@ ulong num_key; \ zval **struc; +/* (Possibly) needed for BC (e.g. by external modules using the session registry) */ #define PS_ENCODE_LOOP(code) do { \ HashTable *_ht = Z_ARRVAL_P(PS(http_session_vars)); \ \ @@ -212,6 +213,24 @@ } \ } while(0) +#define PS_UENCODE_LOOP(code) do { \ + int key_type; \ + HashTable *_ht = Z_ARRVAL_P(PS(http_session_vars)); \ + HashPosition _pos; \ + \ + for (zend_hash_internal_pointer_reset_ex(_ht, _pos); \ + (key_type = zend_hash_get_current_key_ex(_ht, key, key_length, num_key, 0, _pos)) != HASH_KEY_NON_EXISTANT; \ + zend_hash_move_forward_ex(_ht, _pos)) { \ + if (key_type != HASH_KEY_IS_STRING key_type != HASH_KEY_IS_UNICODE) { break; } \ + key_length--; \ + struc = NULL; \ + zend_hash_get_current_data_ex(_ht, (void**)struc, _pos); \ +\ + code; \ + } \ + } while(0) + + PHPAPI ZEND_EXTERN_MODULE_GLOBALS(ps) void php_session_auto_start(void *data); http://cvs.php.net/viewvc.cgi/php-src/ext/session/session.c?r1=1.462r2=1.463diff_format=u Index: php-src/ext/session/session.c diff -u php-src/ext/session/session.c:1.462 php-src/ext/session/session.c:1.463 --- php-src/ext/session/session.c:1.462 Thu Jan 4 22:04:38 2007 +++ php-src/ext/session/session.c Fri Jan 5 02:07:59 2007 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: session.c,v 1.462 2007/01/04 22:04:38 pollita Exp $ */ +/* $Id: session.c,v 1.463 2007/01/05 02:07:59 pollita Exp $ */ #ifdef HAVE_CONFIG_H #include config.h @@ -140,9 +140,11 @@ } } +/* BC? */ PHPAPI void php_set_session_var(char *name, size_t namelen, zval *state_val, php_unserialize_data_t *var_hash TSRMLS_DC) { - zend_set_hash_symbol(state_val, name, namelen, PZVAL_IS_REF(state_val), 1, Z_ARRVAL_P(PS(http_session_vars))); + zend_utf8_hash_update(Z_ARRVAL_P(PS(http_session_vars)), name, namelen + 1, state_val, sizeof(zval *), NULL); + zval_add_ref(state_val); } PHPAPI int php_get_session_var(char *name, size_t namelen, zval ***state_var TSRMLS_DC) @@ -572,19 +574,22 @@ PHP_VAR_SERIALIZE_INIT(var_hash); - PS_ENCODE_LOOP( - if (key_length PS_BIN_MAX) continue; - smart_str_appendc(buf, (unsigned char) key_length); - smart_str_appendl(buf, key.s, key_length); - - php_var_serialize(buf, struc, var_hash TSRMLS_CC); - } else { - if (key_length PS_BIN_MAX) continue; - smart_str_appendc(buf, (unsigned char) (key_length PS_BIN_UNDEF)); - smart_str_appendl(buf, key.s, key_length); + PS_UENCODE_LOOP( + if (key_length PS_BIN_MAX || key_type != HASH_KEY_IS_STRING) continue; + if (struc) { +
[PHP-CVS] cvs: php-src / NEWS /ext/session CREDITS php_session.h session.c
*/ } to_read -= n; } @@ -332,6 +356,7 @@ } } + digest = emalloc(digest_len + 1); switch (PS(hash_func)) { case PS_HASH_FUNC_MD5: PHP_MD5Final(digest, md5_context); @@ -339,6 +364,12 @@ case PS_HASH_FUNC_SHA1: PHP_SHA1Final(digest, sha1_context); break; +#ifdef HAVE_HASH_EXT + case PS_HASH_FUNC_OTHER: + PS(hash_ops)-hash_final(digest, hash_context); + efree(hash_context); + break; +#endif /* HAVE_HASH_EXT */ } if (PS(hash_bits_per_character) 4 @@ -347,7 +378,14 @@ php_error_docref(NULL TSRMLS_CC, E_WARNING, The ini setting hash_bits_per_character is out of range (should be 4, 5, or 6) - using 4 for now); } + + if (PS_ID_INITIAL_SIZE ((digest_len + 2) * (8 / PS(hash_bits_per_character))) ) { + /* 100 bytes is enough for most, but not all hash algos */ + buf = erealloc(buf, (digest_len + 2) * (8 / PS(hash_bits_per_character)) ); + } + j = (int) (bin_to_readable((char *)digest, digest_len, buf, PS(hash_bits_per_character)) - buf); + efree(digest); if (newlen) { *newlen = j; @@ -526,6 +564,53 @@ return SUCCESS; } +static PHP_INI_MH(OnUpdateHashFunc) +{ +long val; + char *endptr = NULL; + +#ifdef HAVE_HASH_EXT + PS(hash_ops) = NULL; +#endif + + val = strtol(new_value, endptr, 10); + if (endptr (*endptr == '\0')) { + /* Numeric value */ + PS(hash_func) = val ? 1 : 0; + + return SUCCESS; + } + + if (new_value_length == (sizeof(md5) - 1) + strncasecmp(new_value, md5, sizeof(md5) - 1) == 0) { + PS(hash_func) = PS_HASH_FUNC_MD5; + + return SUCCESS; + } + + if (new_value_length == (sizeof(sha1) - 1) + strncasecmp(new_value, sha1, sizeof(sha1) - 1) == 0) { + PS(hash_func) = PS_HASH_FUNC_SHA1; + + return SUCCESS; + } + +#ifdef HAVE_HASH_EXT +{ + php_hash_ops *ops = php_hash_fetch_ops(new_value, new_value_length); + + if (ops) { + PS(hash_func) = PS_HASH_FUNC_OTHER; + PS(hash_ops) = ops; + + return SUCCESS; + } +} +#endif /* HAVE_HASH_EXT */ + +return FAILURE; +} + /* {{{ PHP_INI */ PHP_INI_BEGIN() @@ -550,7 +635,7 @@ STD_PHP_INI_ENTRY(session.cache_limiter, nocache, PHP_INI_ALL, OnUpdateString, cache_limiter, php_ps_globals,ps_globals) STD_PHP_INI_ENTRY(session.cache_expire, 180, PHP_INI_ALL, OnUpdateLong,cache_expire, php_ps_globals,ps_globals) PHP_INI_ENTRY(session.use_trans_sid, 0, PHP_INI_ALL, OnUpdateTransSid) - STD_PHP_INI_ENTRY(session.hash_function, 0, PHP_INI_ALL, OnUpdateLong,hash_func, php_ps_globals,ps_globals) + PHP_INI_ENTRY(session.hash_function, 0, PHP_INI_ALL, OnUpdateHashFunc) STD_PHP_INI_ENTRY(session.hash_bits_per_character, 4, PHP_INI_ALL, OnUpdateLong,hash_bits_per_character, php_ps_globals, ps_globals) /* Commented out until future discussion */ http://cvs.php.net/viewvc.cgi/php-src/ext/session/CREDITS?r1=1.1r2=1.2diff_format=u Index: php-src/ext/session/CREDITS diff -u php-src/ext/session/CREDITS:1.1 php-src/ext/session/CREDITS:1.2 --- php-src/ext/session/CREDITS:1.1 Mon Nov 20 10:31:35 2000 +++ php-src/ext/session/CREDITS Fri Jan 5 03:57:57 2007 @@ -1,2 +1,2 @@ Sessions -Sascha Schumann, Andrei Zmievski +Sascha Schumann, Andrei Zmievski, Sara Golemon -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/standard file.c
pollita Thu Dec 7 09:51:36 2006 UTC Modified files: /php-src/ext/standard file.c Log: Change fgets() behavior back to BC version http://cvs.php.net/viewvc.cgi/php-src/ext/standard/file.c?r1=1.472r2=1.473diff_format=u Index: php-src/ext/standard/file.c diff -u php-src/ext/standard/file.c:1.472 php-src/ext/standard/file.c:1.473 --- php-src/ext/standard/file.c:1.472 Tue Dec 5 13:45:49 2006 +++ php-src/ext/standard/file.c Thu Dec 7 09:51:36 2006 @@ -21,7 +21,7 @@ +--+ */ -/* $Id: file.c,v 1.472 2006/12/05 13:45:49 tony2001 Exp $ */ +/* $Id: file.c,v 1.473 2006/12/07 09:51:36 pollita Exp $ */ /* Synced with php 3.0 revision 1.218 1999-06-16 [ssb] */ @@ -1114,7 +1114,7 @@ } /* }}} */ -/* {{{ proto string fgets(resource fp[, int length]) U +/* {{{ proto string fgets(resource fp[, int lengthish]) U Get a line from file pointer */ PHPAPI PHP_FUNCTION(fgets) { @@ -1131,6 +1131,11 @@ php_stream_from_zval(stream, zstream); + if (length 0) { + /* For BC reasons, fgets() should only return length-1 bytes. */ + length--; + } + buf.v = php_stream_get_line_ex(stream, stream-readbuf_type, NULL_ZSTR, 0, length, retlen); if (!buf.v) { RETURN_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 file.c
pollita Fri Dec 8 01:02:49 2006 UTC Modified files: /php-src/ext/standard file.c Log: More BC bodges for fgets/fgetss http://cvs.php.net/viewvc.cgi/php-src/ext/standard/file.c?r1=1.474r2=1.475diff_format=u Index: php-src/ext/standard/file.c diff -u php-src/ext/standard/file.c:1.474 php-src/ext/standard/file.c:1.475 --- php-src/ext/standard/file.c:1.474 Thu Dec 7 23:00:45 2006 +++ php-src/ext/standard/file.c Fri Dec 8 01:02:49 2006 @@ -21,7 +21,7 @@ +--+ */ -/* $Id: file.c,v 1.474 2006/12/07 23:00:45 tony2001 Exp $ */ +/* $Id: file.c,v 1.475 2006/12/08 01:02:49 pollita Exp $ */ /* Synced with php 3.0 revision 1.218 1999-06-16 [ssb] */ @@ -1129,13 +1129,15 @@ RETURN_NULL(); } - php_stream_from_zval(stream, zstream); - - if (length 0) { + if (length == 1) { /* For BC reasons, fgets() should only return length-1 bytes. */ + RETURN_FALSE; + } else if (length 1) { length--; } + php_stream_from_zval(stream, zstream); + buf.v = php_stream_get_line_ex(stream, stream-readbuf_type, NULL_ZSTR, 0, length, retlen); if (!buf.v) { RETURN_FALSE; @@ -1180,7 +1182,7 @@ } /* }}} */ -/* {{{ proto string fgetss(resource fp [, int length, string allowable_tags]) U +/* {{{ proto string fgetss(resource fp [, int lengthish, string allowable_tags]) U Get a line from file pointer and strip HTML tags */ PHPAPI PHP_FUNCTION(fgetss) { @@ -1194,6 +1196,13 @@ return; } + if (length == 1) { + /* For BC reasons, fgetss() should only return length-1 bytes. */ + RETURN_FALSE; + } else if (length 1) { + length--; + } + php_stream_from_zval(stream, zstream); if (length 0) { -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/standard string.c
pollita Wed Dec 6 23:14:15 2006 UTC Modified files: /php-src/ext/standard string.c Log: Use proper zstr for str_getcsv() and add documentation for Andrei's peace of mind http://cvs.php.net/viewvc.cgi/php-src/ext/standard/string.c?r1=1.619r2=1.620diff_format=u Index: php-src/ext/standard/string.c diff -u php-src/ext/standard/string.c:1.619 php-src/ext/standard/string.c:1.620 --- php-src/ext/standard/string.c:1.619 Tue Dec 5 04:52:44 2006 +++ php-src/ext/standard/string.c Wed Dec 6 23:14:15 2006 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: string.c,v 1.619 2006/12/05 04:52:44 pollita Exp $ */ +/* $Id: string.c,v 1.620 2006/12/06 23:14:15 pollita Exp $ */ /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */ @@ -6742,7 +6742,7 @@ PHP_FUNCTION(str_getcsv) { zend_uchar str_type, delim_type = IS_STRING, enc_type = IS_STRING, esc_type = IS_STRING; - char *str, *delim = ,, *enc = \, *esc = \\; + zstr str, delim = ZSTR(,), enc = ZSTR(\), esc = ZSTR(\\); int str_len, delim_len = 1, enc_len = 1, esc_len = 1; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, T|TTT, @@ -6756,23 +6756,35 @@ if (str_type == IS_UNICODE) { UChar udelim = ',', uenc = '', uesc = '\\'; - /* Non-passed params would need to be upconverted, but we can cheat with some local declarations */ + /* When a unicode string is passed for the main argument, +* the 'T' specifiers will atuomatically align any remaining +* arguments that are actually passed to be Unicode as well. +* +* However, since they are optional, they may have reached +* this point still in IS_STRING form (because they wern't passed). +* +* The clean way to handle this would be to use zend_string_to_unicode() +* to convert the binary defaults to their unicode counterparts. +* +* However, since these are simple fixed constants, it's cheaper +* to declare them as UChars locally and point at these versions. +*/ if (delim_type == IS_STRING) { - delim = (char*)udelim; + delim.u = udelim; delim_len = 1; } if (enc_type == IS_STRING) { - enc = (char*)uenc; + enc.u = uenc; enc_len = 1; } if (esc_type == IS_STRING) { - esc = (char*)uesc; + esc.u = uesc; esc_len = 1; } - php_u_fgetcsv(NULL, (UChar*)delim, delim_len, (UChar*)enc, enc_len, (UChar*)esc, esc_len, (UChar*)str, str_len, return_value TSRMLS_CC); + php_u_fgetcsv(NULL, delim.u, delim_len, enc.u, enc_len, esc.u, esc_len, str.u, str_len, return_value TSRMLS_CC); } else { - php_fgetcsv_ex(NULL, delim, delim_len, enc, enc_len, esc, esc_len, str, str_len, return_value TSRMLS_CC); + php_fgetcsv_ex(NULL, delim.s, delim_len, enc.s, enc_len, esc.s, esc_len, str.s, str_len, return_value TSRMLS_CC); } } /* }}} */ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/standard file.c file.h /ext/standard/tests/file bug12556.phpt fgetcsv.phpt
pollita Tue Dec 5 04:13:47 2006 UTC Modified files: /php-src/ext/standard file.c file.h /php-src/ext/standard/tests/filebug12556.phpt fgetcsv.phpt Log: Unicode upgrade for fgetcsv() http://cvs.php.net/viewvc.cgi/php-src/ext/standard/file.c?r1=1.469r2=1.470diff_format=u Index: php-src/ext/standard/file.c diff -u php-src/ext/standard/file.c:1.469 php-src/ext/standard/file.c:1.470 --- php-src/ext/standard/file.c:1.469 Wed Nov 22 12:56:26 2006 +++ php-src/ext/standard/file.c Tue Dec 5 04:13:46 2006 @@ -21,7 +21,7 @@ +--+ */ -/* $Id: file.c,v 1.469 2006/11/22 12:56:26 pajoye Exp $ */ +/* $Id: file.c,v 1.470 2006/12/05 04:13:46 pollita Exp $ */ /* Synced with php 3.0 revision 1.218 1999-06-16 [ssb] */ @@ -1932,43 +1932,6 @@ } /* }}} */ -static const char *php_fgetcsv_lookup_trailing_spaces(const char *ptr, size_t len, const char delimiter TSRMLS_DC) -{ - int inc_len; - unsigned char last_chars[2] = { 0, 0 }; - - while (len 0) { - inc_len = (*ptr == '\0' ? 1: php_mblen(ptr, len)); - switch (inc_len) { - case -2: - case -1: - inc_len = 1; - php_mblen(NULL, 0); - break; - case 0: - goto quit_loop; - case 1: - default: - last_chars[0] = last_chars[1]; - last_chars[1] = *ptr; - break; - } - ptr += inc_len; - len -= inc_len; - } -quit_loop: - switch (last_chars[1]) { - case '\n': - if (last_chars[0] == '\r') { - return ptr - 2; - } - /* break is omitted intentionally */ - case '\r': - return ptr - 1; - } - return ptr; -} - #define FPUTCSV_FLD_CHK(c) memchr(Z_STRVAL_PP(field), c, Z_STRLEN_PP(field)) /* {{{ proto int fputcsv(resource fp, array fields [, string delimiter [, string enclosure]]) @@ -2072,87 +2035,149 @@ } /* }}} */ -/* {{{ proto array fgetcsv(resource fp [,int length [, string delimiter [, string enclosure]]]) +/* {{{ proto array fgetcsv(resource fp [,int length [, string delimiter [, string enclosure[, string escape) U Get line from file pointer and parse for CSV fields */ -/* UTODO: Accept unicode contents */ +#define PHP_FGETCSV_TRUNCATE(field) \ +if (argc 4) { \ + /* Caller knows about new semantics since they're using new param, allow multichar */ \ +} else if (field##_type == IS_STRING field##_len 1) { \ + php_error_docref(NULL TSRMLS_CC, E_NOTICE, #field must be a single character); \ + delimiter_len = 1; \ +} else if (field##_type == IS_UNICODE u_countChar32((UChar*)field, field##_len) 1) { \ + int __tmp = 0; \ + php_error_docref(NULL TSRMLS_CC, E_NOTICE, #field must be a single character); \ + U16_FWD_1(((UChar*)field), __tmp, field##_len); \ + field##_len = __tmp; \ +} + PHP_FUNCTION(fgetcsv) { - char delimiter = ','; /* allow this to be set as parameter */ - char enclosure = ''; /* allow this to be set as parameter */ - /* first section exactly as php_fgetss */ - - long len = 0; - size_t buf_len; - char *buf; + zend_uchar delimiter_type = IS_STRING, enclosure_type = IS_STRING, escape_type = IS_STRING; + char *delimiter = ,, *enclosure = \, *escape = \\; + int delimiter_len = 1, enclosure_len = 1, escape_len = 1; + long len = -1; + zstr buf; + int buf_len, argc = ZEND_NUM_ARGS(); php_stream *stream; + zval *zstream; + zend_uchar delimiter_free = 0, enclosure_free = 0, escape_free = 0; - { - zval *fd, **len_zv = NULL; - char *delimiter_str = NULL; - int delimiter_str_len = 0; - char *enclosure_str = NULL; - int enclosure_str_len = 0; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, r|Zss, - fd, len_zv, delimiter_str, delimiter_str_len, - enclosure_str, enclosure_str_len) == FAILURE) { - return; - } + if (zend_parse_parameters(argc TSRMLS_CC, r|l!ttt, zstream, len, + delimiter, delimiter_len, delimiter_type, + enclosure, enclosure_len, enclosure_type, + escape,escape_len, escape_type) == FAILURE) { + return; + } - if
[PHP-CVS] cvs: php-src(PHP_5_2) /ext/hash hash.c hash_md.c hash_ripemd.c php_hash.h php_hash_md.h php_hash_ripemd.h /ext/hash/tests md2.phpt ripemd256.phpt ripemd320.phpt
pollita Wed Nov 15 20:06:10 2006 UTC Added files: (Branch: PHP_5_2) /php-src/ext/hash/tests md2.phpt ripemd256.phpt ripemd320.phpt Modified files: /php-src/ext/hash hash.c hash_md.c hash_ripemd.c php_hash.h php_hash_md.h php_hash_ripemd.h Log: Backport md2, ripemd256, and ripemd320 algos from HEAD http://cvs.php.net/viewvc.cgi/php-src/ext/hash/hash.c?r1=1.18.2.5.2.3r2=1.18.2.5.2.4diff_format=u Index: php-src/ext/hash/hash.c diff -u php-src/ext/hash/hash.c:1.18.2.5.2.3 php-src/ext/hash/hash.c:1.18.2.5.2.4 --- php-src/ext/hash/hash.c:1.18.2.5.2.3Fri Jul 28 14:27:03 2006 +++ php-src/ext/hash/hash.c Wed Nov 15 20:06:09 2006 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: hash.c,v 1.18.2.5.2.3 2006/07/28 14:27:03 iliaa Exp $ */ +/* $Id: hash.c,v 1.18.2.5.2.4 2006/11/15 20:06:09 pollita Exp $ */ #ifdef HAVE_CONFIG_H #include config.h @@ -517,6 +517,7 @@ zend_hash_init(php_hash_hashtable, 35, NULL, NULL, 1); + php_hash_register_algo(md2, php_hash_md2_ops); php_hash_register_algo(md4, php_hash_md4_ops); php_hash_register_algo(md5, php_hash_md5_ops); php_hash_register_algo(sha1, php_hash_sha1_ops); @@ -525,6 +526,8 @@ php_hash_register_algo(sha512,php_hash_sha512_ops); php_hash_register_algo(ripemd128, php_hash_ripemd128_ops); php_hash_register_algo(ripemd160, php_hash_ripemd160_ops); + php_hash_register_algo(ripemd256, php_hash_ripemd256_ops); + php_hash_register_algo(ripemd320, php_hash_ripemd320_ops); php_hash_register_algo(whirlpool, php_hash_whirlpool_ops); php_hash_register_algo(tiger128,3,php_hash_3tiger128_ops); php_hash_register_algo(tiger160,3,php_hash_3tiger160_ops); http://cvs.php.net/viewvc.cgi/php-src/ext/hash/hash_md.c?r1=1.6.2.4r2=1.6.2.4.2.1diff_format=u Index: php-src/ext/hash/hash_md.c diff -u php-src/ext/hash/hash_md.c:1.6.2.4 php-src/ext/hash/hash_md.c:1.6.2.4.2.1 --- php-src/ext/hash/hash_md.c:1.6.2.4 Sun Jan 1 12:50:07 2006 +++ php-src/ext/hash/hash_md.c Wed Nov 15 20:06:09 2006 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: hash_md.c,v 1.6.2.4 2006/01/01 12:50:07 sniper Exp $ */ +/* $Id: hash_md.c,v 1.6.2.4.2.1 2006/11/15 20:06:09 pollita Exp $ */ #include php_hash.h #include php_hash_md.h @@ -39,6 +39,15 @@ sizeof(PHP_MD4_CTX) }; +php_hash_ops php_hash_md2_ops = { + (php_hash_init_func_t) PHP_MD2Init, + (php_hash_update_func_t) PHP_MD2Update, + (php_hash_final_func_t) PHP_MD2Final, + 16, + 16, + sizeof(PHP_MD2_CTX) +}; + /* MD common stuff */ static unsigned char PADDING[64] = @@ -579,6 +588,95 @@ } /* }}} */ +/* MD2 */ + +static unsigned char MD2_S[256] = { +41, 46, 67, 201, 162, 216, 124, 1, 61, 54, 84, 161, 236, 240, 6, 19, +98, 167, 5, 243, 192, 199, 115, 140, 152, 147, 43, 217, 188, 76, 130, 202, +30, 155, 87, 60, 253, 212, 224, 22, 103, 66, 111, 24, 138, 23, 229, 18, + 190, 78, 196, 214, 218, 158, 222, 73, 160, 251, 245, 142, 187, 47, 238, 122, + 169, 104, 121, 145, 21, 178, 7, 63, 148, 194, 16, 137, 11, 34, 95, 33, + 128, 127, 93, 154, 90, 144, 50, 39, 53, 62, 204, 231, 191, 247, 151, 3, + 255, 25, 48, 179, 72, 165, 181, 209, 215, 94, 146, 42, 172, 86, 170, 198, +79, 184, 56, 210, 150, 164, 125, 182, 118, 252, 107, 226, 156, 116, 4, 241, +69, 157, 112, 89, 100, 113, 135, 32, 134, 91, 207, 101, 230, 45, 168, 2, +27, 96, 37, 173, 174, 176, 185, 246, 28, 70, 97, 105, 52, 64, 126, 15, +85, 71, 163, 35, 221, 81, 175, 58, 195, 92, 249, 206, 186, 197, 234, 38, +44, 83, 13, 110, 133, 40, 132, 9, 211, 223, 205, 244, 65, 129, 77, 82, + 106, 220, 55, 200, 108, 193, 171, 250, 36, 225, 123, 8, 12, 189, 177, 74, + 120, 136, 149, 139, 227, 99, 232, 109, 233, 203, 213, 254, 59, 0, 29, 57, + 242, 239, 183, 14, 102, 88, 208, 228, 166, 119, 114, 248, 235, 117, 75, 10, +49, 68, 80, 180, 143, 237, 31, 26, 219, 153, 141, 51, 159, 17, 131, 20 }; + +PHP_HASH_API void PHP_MD2Init(PHP_MD2_CTX *context) +{ + memset(context, 0, sizeof(PHP_MD2_CTX)); +} + +static void MD2_Transform(PHP_MD2_CTX *context, const unsigned char *block) +{ + unsigned char i,j,t = 0; + + for(i = 0; i 16; i++) { + context-state[16+i] = block[i]; + context-state[32+i] = (context-state[16+i] ^ context-state[i]); + } + + for(i = 0; i 18; i++) { + for(j = 0; j 48; j++) { +
[PHP-CVS] cvs: php-src /ext/spl spl_array.c
pollita Thu Oct 19 22:20:44 2006 UTC Modified files: /php-src/ext/splspl_array.c Log: Fix working with ArrayObjects which contain arrays. http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_array.c?r1=1.113r2=1.114diff_format=u Index: php-src/ext/spl/spl_array.c diff -u php-src/ext/spl/spl_array.c:1.113 php-src/ext/spl/spl_array.c:1.114 --- php-src/ext/spl/spl_array.c:1.113 Sun Oct 8 10:50:19 2006 +++ php-src/ext/spl/spl_array.c Thu Oct 19 22:20:44 2006 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: spl_array.c,v 1.113 2006/10/08 10:50:19 bjori Exp $ */ +/* $Id: spl_array.c,v 1.114 2006/10/19 22:20:44 pollita Exp $ */ #ifdef HAVE_CONFIG_H # include config.h @@ -300,6 +300,8 @@ static zval *spl_array_read_dimension_ex(int check_inherited, zval *object, zval *offset, int type TSRMLS_DC) /* {{{ */ { + zval **ret; + if (check_inherited) { spl_array_object *intern = (spl_array_object*)zend_object_store_get_object(object TSRMLS_CC); if (intern-fptr_offset_get) { @@ -316,7 +318,30 @@ return EG(uninitialized_zval_ptr); } } - return *spl_array_get_dimension_ptr_ptr(check_inherited, object, offset, type TSRMLS_CC); + ret = spl_array_get_dimension_ptr_ptr(check_inherited, object, offset, type TSRMLS_CC); + + /* When in a write context, +* ZE has to be fooled into thinking this is in a reference set +* by separating (if necessary) and returning as an is_ref=1 zval (even if refcount == 1) */ + if ((type == BP_VAR_W || type == BP_VAR_RW) !(*ret)-is_ref) { + if ((*ret)-refcount 1) { + zval *newval; + + /* Separate */ + MAKE_STD_ZVAL(newval); + *newval = **ret; + zval_copy_ctor(newval); + newval-refcount = 1; + + /* Replace */ + (*ret)-refcount--; + *ret = newval; + } + + (*ret)-is_ref = 1; + } + + return *ret; } /* }}} */ static zval *spl_array_read_dimension(zval *object, zval *offset, int type TSRMLS_DC) /* {{{ */ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src / README.UNICODE-UPGRADES
pollita Tue Oct 17 20:56:29 2006 UTC Modified files: /php-srcREADME.UNICODE-UPGRADES Log: Update the upgrading doc to the current wisdom. Pass One. This pass simply retruthifies the information already present. The next pass will add additional information. http://cvs.php.net/viewvc.cgi/php-src/README.UNICODE-UPGRADES?r1=1.7r2=1.8diff_format=u Index: php-src/README.UNICODE-UPGRADES diff -u php-src/README.UNICODE-UPGRADES:1.7 php-src/README.UNICODE-UPGRADES:1.8 --- php-src/README.UNICODE-UPGRADES:1.7 Wed Jun 28 15:07:14 2006 +++ php-src/README.UNICODE-UPGRADES Tue Oct 17 20:56:28 2006 @@ -16,70 +16,131 @@ switch. Its value is found in the Unicode globals variable, UG(unicode). It is either on or off for the entire request. -The big thing is that there are two new string types: IS_UNICODE and -IS_BINARY. The former one has its own storage in the value union part of -zval (value.ustr) and the latter re-uses value.str. +The big thing is that there is a new string types: IS_UNICODE. +This has its own storage in the value union part of +zval (value.ustr) while non-unicode (binary) strings reuse the +IS_STRING type and the value.str element of the zval. -Both types have new macros to set the zval value and to access it. +New macros exist (parallel to Z_STRVAL/Z_STRLEN) for accessing unicode strings. Z_USTRVAL(), Z_USTRLEN() - - accesses the value and length (in code units) of the Unicode type string - -Z_BINVAL(), Z_BINLEN() - - accesses the value and length of the binary type string + - accesses the value (as a UChar*) and length (in code units) of the Unicode type string + value.ustr.val value.ustr.len Z_UNIVAL(), Z_UNILEN() - - accesses either Unicode or native string value, depending on the current - setting of UG(unicode) switch. The Z_UNIVAL() type resolves to char*, so - you may need to cast it appropriately. + - accesses the value (as a zstr) and length (in type-appropriate units) + value.uni.valvalue.uni.len Z_USTRCPLEN() - - gives the number of codepoints in the Unicode type string - -ZVAL_BINARY(), ZVAL_BINARYL() - - Sets zval to hold a binary string. Takes the same parameters as - Z_STRING(), Z_STRINGL(). + - gives the number of codepoints (not units) in the Unicode type string + This macro examines the actual string taking into account Surrogate Pairs + and returns the number of UChar32(UTF32) codepoints which may be less than the + number of UChar(UTF16) codeunits found in the string buffer. + If this value will be used repeatedly, consider storing it in a local variable + to avoid having to reexamine the string every time. + + +ZVAL_* macros +- + +The 'dup' parameter to the ZVAL_STRING()/RETVAL_STRING()/RETURN_STRING() type +macros has been extended slightly. The following defines are now encouraged instead: + +#define ZSTR_DUPLICATE (10) +#define ZSTR_AUTOFREE (11) + +ZSTR_DUPLICATE (which has a resulting value of 1) serves the same purpose as a +truth value in old-style 'dup' flags. The value of 1 was specifically chosen +to match the common practice of passing a 1 for this parameter. +Warning: If you find extension code which uses a truth value other than one for +the dup flag, its logic should be modified to explicitly pass ZSTR_DUPLICATE instead. + +ZSTR_AUTOFREE is used with macros such as ZVAL_RT_STRING which may populate Unicode +zvals from non-unicode source strings. When UG(unicode) is on, the source string +will be implicitly copied (to make a UChar* version). If the original string +needed copying anyway this is fine. However if the original string was emalloc()'d +and would have ordinarily been given to the engine (i.e. RETURN_STRING(estrdup(foo), 0)) +then it will need to be freed in UG(unicode) mode to avoid leaking. +The ZSTR_AUTOFREE flag ensures that the original string is freed in UG(unicode) mode. -ZVAL_UNICODE, ZVAL_UNICODEL() +ZVAL_UNICODE(pzv, str, dup), ZVAL_UNICODEL(pzv, str, str_len, dup) - Sets zval to hold a Unicode string. Takes the same parameters as Z_STRING(), Z_STRINGL(). -ZVAL_ASCII_STRING(), ZVAL_ASCII_STRINGL() - - When UG(unicode) is off, it's equivalent to Z_STRING(), ZSTRINGL(). When - UG(unicode) is on, it sets zval to hold a Unicode representation of the - passed-in ASCII string. It will always create a new string in - UG(unicode)=1 case, so the value of the duplicate flag is not taken into - account. - -ZVAL_RT_STRING() - - When UG(unicode) is off, it's equivalent to Z_STRING(), Z_STRINGL(). WHen - UG(unicode) is on, it takes the input string, converts it to Unicode - using the runtime_encoding converter and sets zval to it. Since a new - string is always created in this case, the value of the duplicate flag - does not matter. +ZVAL_U_STRING(conv, pzv, str, dup), ZVAL_U_STRINGL(conv, pzv, str, str_len, dup) + - When UG(unicode) is off, it's equivalent to Z_STRING(), ZSTRINGL() + and the conv parameter is ignored.
[PHP-CVS] cvs: php-src / README.UNICODE-UPGRADES
pollita Tue Oct 17 21:42:29 2006 UTC Modified files: /php-srcREADME.UNICODE-UPGRADES Log: More unicode upgrading notes http://cvs.php.net/viewvc.cgi/php-src/README.UNICODE-UPGRADES?r1=1.8r2=1.9diff_format=u Index: php-src/README.UNICODE-UPGRADES diff -u php-src/README.UNICODE-UPGRADES:1.8 php-src/README.UNICODE-UPGRADES:1.9 --- php-src/README.UNICODE-UPGRADES:1.8 Tue Oct 17 20:56:28 2006 +++ php-src/README.UNICODE-UPGRADES Tue Oct 17 21:42:28 2006 @@ -407,8 +407,8 @@ This functions returns part of a string based on offset and length parameters. -void *str; -int32_t str_len, cp_len; +zstr str; +int str_len, cp_len; zend_uchar str_type; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, tl|l, str, str_len, str_type, f, l) == FAILURE) { @@ -417,11 +417,11 @@ The first thing we notice is that the incoming string specifier is 't', which means that we can accept all 3 string types. The 'str' variable is -declared as void*, because it can point to either UChar* or char*. +declared as zstr, because it can point to either UChar* or char*. The actual type of the incoming string is stored in 'str_type' variable. if (str_type == IS_UNICODE) { -cp_len = u_countChar32(str, str_len); +cp_len = u_countChar32(str.u, str_len); } else { cp_len = str_len; } @@ -435,10 +435,10 @@ if (str_type == IS_UNICODE) { int32_t start = 0, end = 0; -U16_FWD_N((UChar*)str, end, str_len, f); +U16_FWD_N(str.u, end, str_len, f); start = end; -U16_FWD_N((UChar*)str, end, str_len, l); -RETURN_UNICODEL((UChar*)str + start, end-start, 1); +U16_FWD_N(str.u, end, str_len, l); +RETURN_UNICODEL(str.u + start, end-start, ZSTR_DUPLICATE); Since codepoint (character) #n is not necessarily at offset #n in Unicode strings, we start at the beginning and iterate forward until we have gone @@ -448,10 +448,10 @@ segment as a Unicode string. } else { -RETURN_STRINGL((char*)str + f, l, 1); +RETURN_STRINGL(str.s + f, l, ZSTR_DUPLICATE); } -For native and binary types, we can return the segment directly. +For native strings, we can return the segment directly. strrev() @@ -486,9 +486,9 @@ Unicode type, processes it exactly as before, simply swapping bytes around. For Unicode case, the magic is like this: - int32_t i, x1, x2; - UChar32 ch; - UChar *u_s, *u_n, *u_p; +int32_t i, x1, x2; +UChar32 ch; +UChar *u_s, *u_n, *u_p; u_n = eumalloc(Z_USTRLEN_PP(str)+1); u_p = u_n; @@ -525,6 +525,98 @@ characters (UChar32 type) to 1 or 2 UTF-16 code units (UChar type). +realpath() +-- + +Filenames use their own converter as it's not uncommon, for example, +to need to access files on a filesystem with latin1 entries while outputting +UTF8 runtime content. + +The most common approach to parsing filenames can be found in realpath(): + +zval **ppfilename; +char *filename; +int filename_len; + +if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, Z, ppfilename) == FAILURE || + php_stream_path_param_encode(ppfilename, filename, filename_len, REPORT_ERRORS, FG(default_context)) == FAILURE) { + return; +} + +Here, the filename is taken first as a generic zval**, then converted (separating if necessary) +and populated into local char* and int storage. The filename will be converted according to +unicode.filesystem_encoding unless the wrapper specified overrides this with its own conversion +function (The http:// wrapper, for example, enforces utf8 conversion). + + +rmdir() +--- + +If the function accepts a context parameter, then this context should be used in place of FG(default_context) + +zval **ppdir, *zcontext = NULL; +char *dir; +int dir_len; + +if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, Z|r, ppdir, zcontext) == FAILURE) { + return; +} + +context = php_stream_context_from_zval(zcontext, 0); +if (php_stream_path_param_encode(ppdir, dir, dir_len, REPORT_ERRORS, context) == FAILURE) { + return; +} + + +sqlite_query() +-- + +If the function's underlying library expects a particular encoding (i.e. UTF8), then the alternate form of +the string parameter may be used with zend_parse_parameters(). + +char *sql; +int sql_len; + +if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, s, sql, sql_len, UG(utf8_conv)) == FAILURE) { +return; +} + +Converters +== + +Standard Converters +--- + +The following converters (UConverter*) are initialized by Zend and are always available (regardless of UG(unicode) mode): + UG(utf8_conv) + UG(ascii_conv) + UG(fallback_encoding_conv) - UTF8 unless overridden by INI setting unicode.fallback_encoding + +Additional converters will be optionally initialized depending on INI settings: + UG(runtime_encoding_conv) - unicode.runtime_encoding + . Unicode output generated by
[PHP-CVS] cvs: php-src / NEWS /main fopen_wrappers.c fopen_wrappers.h main.c
pollita Tue Oct 17 21:54:17 2006 UTC Modified files: /php-src/main main.c fopen_wrappers.c fopen_wrappers.h /php-srcNEWS Log: Extend open_basedir functionality to allow runtime tightening http://cvs.php.net/viewvc.cgi/php-src/main/main.c?r1=1.704r2=1.705diff_format=u Index: php-src/main/main.c diff -u php-src/main/main.c:1.704 php-src/main/main.c:1.705 --- php-src/main/main.c:1.704 Tue Oct 3 16:28:02 2006 +++ php-src/main/main.c Tue Oct 17 21:54:16 2006 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: main.c,v 1.704 2006/10/03 16:28:02 pollita Exp $ */ +/* $Id: main.c,v 1.705 2006/10/17 21:54:16 pollita Exp $ */ /* {{{ includes */ @@ -339,6 +339,7 @@ #else # define DEFAULT_SENDMAIL_PATH NULL #endif + /* {{{ PHP_INI */ PHP_INI_BEGIN() @@ -392,7 +393,7 @@ STD_PHP_INI_ENTRY(extension_dir, PHP_EXTENSION_DIR, PHP_INI_SYSTEM, OnUpdateStringUnempty, extension_dir, php_core_globals, core_globals) STD_PHP_INI_ENTRY(include_path, PHP_INCLUDE_PATH, PHP_INI_ALL,OnUpdateStringUnempty, include_path, php_core_globals, core_globals) PHP_INI_ENTRY(max_execution_time, 30, PHP_INI_ALL,OnUpdateTimeout) - STD_PHP_INI_ENTRY(open_basedir, NULL, PHP_INI_SYSTEM, OnUpdateString, open_basedir, php_core_globals, core_globals) + STD_PHP_INI_ENTRY(open_basedir, NULL, PHP_INI_ALL,OnUpdateBaseDir,open_basedir, php_core_globals, core_globals) STD_PHP_INI_BOOLEAN(file_uploads, 1, PHP_INI_SYSTEM, OnUpdateBool, file_uploads, php_core_globals, core_globals) STD_PHP_INI_ENTRY(upload_max_filesize,2M, PHP_INI_SYSTEM|PHP_INI_PERDIR, OnUpdateLong, upload_max_filesize,php_core_globals, core_globals) http://cvs.php.net/viewvc.cgi/php-src/main/fopen_wrappers.c?r1=1.183r2=1.184diff_format=u Index: php-src/main/fopen_wrappers.c diff -u php-src/main/fopen_wrappers.c:1.183 php-src/main/fopen_wrappers.c:1.184 --- php-src/main/fopen_wrappers.c:1.183 Sat Jul 1 11:50:52 2006 +++ php-src/main/fopen_wrappers.c Tue Oct 17 21:54:16 2006 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: fopen_wrappers.c,v 1.183 2006/07/01 11:50:52 nlopess Exp $ */ +/* $Id: fopen_wrappers.c,v 1.184 2006/10/17 21:54:16 pollita Exp $ */ /* {{{ includes */ @@ -82,6 +82,64 @@ #endif /* }}} */ +/* {{{ OnUpdateBaseDir +Allows any change to open_basedir setting in during Startup and Shutdown events, +or a tightening during activation/runtime/deactivation */ +PHPAPI ZEND_INI_MH(OnUpdateBaseDir) +{ + char **p, *pathbuf, *ptr, *end; +#ifndef ZTS + char *base = (char *) mh_arg2; +#else + char *base = (char *) ts_resource(*((int *) mh_arg2)); +#endif + + p = (char **) (base+(size_t) mh_arg1); + + if (stage == PHP_INI_STAGE_STARTUP || stage == PHP_INI_STAGE_SHUTDOWN) { + /* We're in a PHP_INI_SYSTEM context, no restrictions */ + *p = new_value; + return SUCCESS; + } + + + /* Elsewise, we're in runtime */ + if (!*p || !**p) { + /* open_basedir not set yet, go ahead and give it a value */ + *p = new_value; + return SUCCESS; + } + + /* Shortcut: When we have a open_basedir and someone tries to unset, we know it'll fail */ + if (!new_value || !*new_value) { + return FAILURE; + } + + /* Is the proposed open_basedir at least as restrictive as the current setting? */ + ptr = pathbuf = estrdup(new_value); + while (ptr *ptr) { + end = strchr(ptr, DEFAULT_DIR_SEPARATOR); + if (end != NULL) { + *end = '\0'; + end++; + } + if (php_check_open_basedir_ex(ptr, 0 TSRMLS_CC) != 0) { + /* At least one portion of this open_basedir is less restrictive than the prior one, FAIL */ + efree(pathbuf); + return FAILURE; + } + ptr = end; + } + efree(pathbuf); + + /* Everything checks out, set it */ + *p = new_value; + + return SUCCESS; +} +/* }}} */ + + /* {{{ php_check_specific_open_basedir When open_basedir is not NULL, check if the given filename is located in open_basedir. Returns -1 if error or not in the open_basedir,
[PHP-CVS] cvs: php-src /main/streams filter.c
pollita Wed Oct 11 23:07:31 2006 UTC Modified files: /php-src/main/streams filter.c Log: Bugfix 38648: Don't assume all buckets are part of a brigade http://cvs.php.net/viewvc.cgi/php-src/main/streams/filter.c?r1=1.37r2=1.38diff_format=u Index: php-src/main/streams/filter.c diff -u php-src/main/streams/filter.c:1.37 php-src/main/streams/filter.c:1.38 --- php-src/main/streams/filter.c:1.37 Sun Oct 8 13:34:24 2006 +++ php-src/main/streams/filter.c Wed Oct 11 23:07:30 2006 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: filter.c,v 1.37 2006/10/08 13:34:24 bjori Exp $ */ +/* $Id: filter.c,v 1.38 2006/10/11 23:07:30 pollita Exp $ */ #include php.h #include php_globals.h @@ -281,12 +281,12 @@ { if (bucket-prev) { bucket-prev-next = bucket-next; - } else { + } else if (bucket-brigade) { bucket-brigade-head = bucket-next; } if (bucket-next) { bucket-next-prev = bucket-prev; - } else { + } else if (bucket-brigade) { bucket-brigade-tail = bucket-prev; } bucket-brigade = NULL; -- 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) /main/streams filter.c
pollita Wed Oct 11 23:11:26 2006 UTC Modified files: (Branch: PHP_5_2) /php-src/main/streams filter.c Log: MFH(r-1.38) Bugfix 38648: Don't assume all buckets are part of a brigade http://cvs.php.net/viewvc.cgi/php-src/main/streams/filter.c?r1=1.17.2.3.2.2r2=1.17.2.3.2.3diff_format=u Index: php-src/main/streams/filter.c diff -u php-src/main/streams/filter.c:1.17.2.3.2.2 php-src/main/streams/filter.c:1.17.2.3.2.3 --- php-src/main/streams/filter.c:1.17.2.3.2.2 Tue Oct 3 19:51:01 2006 +++ php-src/main/streams/filter.c Wed Oct 11 23:11:26 2006 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: filter.c,v 1.17.2.3.2.2 2006/10/03 19:51:01 iliaa Exp $ */ +/* $Id: filter.c,v 1.17.2.3.2.3 2006/10/11 23:11:26 pollita Exp $ */ #include php.h #include php_globals.h @@ -224,12 +224,12 @@ { if (bucket-prev) { bucket-prev-next = bucket-next; - } else { + } else if (bucket-brigade) { bucket-brigade-head = bucket-next; } if (bucket-next) { bucket-next-prev = bucket-prev; - } else { + } else if (bucket-brigade) { bucket-brigade-tail = bucket-prev; } bucket-brigade = NULL; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/standard streamsfuncs.c
pollita Wed Oct 11 23:20:54 2006 UTC Modified files: /php-src/ext/standard streamsfuncs.c Log: Bugfix#38649 Optional param not initialized http://cvs.php.net/viewvc.cgi/php-src/ext/standard/streamsfuncs.c?r1=1.95r2=1.96diff_format=u Index: php-src/ext/standard/streamsfuncs.c diff -u php-src/ext/standard/streamsfuncs.c:1.95 php-src/ext/standard/streamsfuncs.c:1.96 --- php-src/ext/standard/streamsfuncs.c:1.95Mon Oct 9 02:48:06 2006 +++ php-src/ext/standard/streamsfuncs.c Wed Oct 11 23:20:54 2006 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: streamsfuncs.c,v 1.95 2006/10/09 02:48:06 pollita Exp $ */ +/* $Id: streamsfuncs.c,v 1.96 2006/10/11 23:20:54 pollita Exp $ */ #include php.h #include php_globals.h @@ -317,7 +317,7 @@ php_stream *stream; zval *zstream; long flags = 0; - char *data, *target_addr; + char *data, *target_addr = NULL; int datalen, target_addr_len = 0; php_sockaddr_storage sa; socklen_t sl = 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_2) /ext/standard streamsfuncs.c
pollita Wed Oct 11 23:22:45 2006 UTC Modified files: (Branch: PHP_5_2) /php-src/ext/standard streamsfuncs.c Log: MFH(r-1.96) Bugfix#38649 Optional param not initialized http://cvs.php.net/viewvc.cgi/php-src/ext/standard/streamsfuncs.c?r1=1.58.2.6.2.8r2=1.58.2.6.2.9diff_format=u Index: php-src/ext/standard/streamsfuncs.c diff -u php-src/ext/standard/streamsfuncs.c:1.58.2.6.2.8 php-src/ext/standard/streamsfuncs.c:1.58.2.6.2.9 --- php-src/ext/standard/streamsfuncs.c:1.58.2.6.2.8Tue Oct 3 17:41:47 2006 +++ php-src/ext/standard/streamsfuncs.c Wed Oct 11 23:22:45 2006 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: streamsfuncs.c,v 1.58.2.6.2.8 2006/10/03 17:41:47 iliaa Exp $ */ +/* $Id: streamsfuncs.c,v 1.58.2.6.2.9 2006/10/11 23:22:45 pollita Exp $ */ #include php.h #include php_globals.h @@ -311,7 +311,7 @@ php_stream *stream; zval *zstream; long flags = 0; - char *data, *target_addr; + char *data, *target_addr = NULL; int datalen, target_addr_len = 0; php_sockaddr_storage sa; socklen_t sl = 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_2) / NEWS
pollita Wed Oct 11 23:36:33 2006 UTC Modified files: (Branch: PHP_5_2) /php-srcNEWS Log: BFN http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.303r2=1.2027.2.547.2.304diff_format=u Index: php-src/NEWS diff -u php-src/NEWS:1.2027.2.547.2.303 php-src/NEWS:1.2027.2.547.2.304 --- php-src/NEWS:1.2027.2.547.2.303 Wed Oct 11 18:27:42 2006 +++ php-src/NEWSWed Oct 11 23:36:32 2006 @@ -13,8 +13,10 @@ - Fixed bug #39067 (getDeclaringClass() and private properties). (Tony) - Fixed bug #39034 (curl_exec() with return transfer returns TRUE on empty files). (Ilia) +- Fixed bug #38649 (uninit'd optional arg in stream_socket_sendto()). (Sara) - Fixed bug #38198 (possible crash when COM reports an exception). (Ilia) - Fixed bug #37262 (var_export() does not escape \0 character). (Ilia) +- Fixed bug #36515 (Unlinking buckets from non-existant brigades). (Sara) 05 Oct 2006, PHP 5.2.0RC5 - Updated bundled OpenSSL to version 0.9.8d in the Windows distro. (Edin) -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/gmp gmp.c /ext/gmp/tests 006.phpt 007.phpt 008.phpt 009.phpt gmp_nextprime.phpt
pollita Mon Oct 9 20:42:36 2006 UTC Modified files: /php-src/ext/gmpgmp.c /php-src/ext/gmp/tests 006.phpt 007.phpt 008.phpt 009.phpt gmp_nextprime.phpt Log: PHP6 Updates http://cvs.php.net/viewvc.cgi/php-src/ext/gmp/gmp.c?r1=1.55r2=1.56diff_format=u Index: php-src/ext/gmp/gmp.c diff -u php-src/ext/gmp/gmp.c:1.55 php-src/ext/gmp/gmp.c:1.56 --- php-src/ext/gmp/gmp.c:1.55 Mon Jun 26 14:10:57 2006 +++ php-src/ext/gmp/gmp.c Mon Oct 9 20:42:35 2006 @@ -465,6 +465,9 @@ mpz_init_set_si(**gmpnumber, Z_LVAL_PP(val)); } break; + case IS_UNICODE: + convert_to_string_ex(val); + /* Fallthrough */ case IS_STRING: { char *numstr = Z_STRVAL_PP(val); @@ -478,6 +481,11 @@ base = 2; skip_lead = 1; } + /* Note: tests/004.phpt and tests/005.phpt suggest that we should be +* interpreting a leading zero as octal (when not followed by x or b) +* Yet the docs, and the existing code (above), suggest otherwise. +* +* Possibly fix this by putting an: else base = 8;here */ } } ret = mpz_init_set_str(**gmpnumber, (skip_lead ? numstr[2] : numstr), base); @@ -748,7 +756,7 @@ } /* }}} */ -/* {{{ proto resource gmp_init(mixed number [, int base]) +/* {{{ proto resource gmp_init(mixed number [, int base]) U Initializes GMP number */ ZEND_FUNCTION(gmp_init) { @@ -780,7 +788,7 @@ } /* }}} */ -/* {{{ proto int gmp_intval(resource gmpnumber) +/* {{{ proto int gmp_intval(resource gmpnumber) U Gets signed long value of GMP number */ ZEND_FUNCTION(gmp_intval) { @@ -801,7 +809,7 @@ } /* }}} */ -/* {{{ proto string gmp_strval(resource gmpnumber [, int base]) +/* {{{ proto string gmp_strval(resource gmpnumber [, int base]) U Gets string representation of GMP number */ ZEND_FUNCTION(gmp_strval) { @@ -852,11 +860,11 @@ } else { out_string[num_len] = '\0'; } - RETVAL_STRINGL(out_string, num_len, 0); + RETVAL_RT_STRINGL(out_string, num_len, ZSTR_AUTOFREE); } /* }}} */ -/* {{{ proto resource gmp_add(resource a, resource b) +/* {{{ proto resource gmp_add(resource a, resource b) U Add a and b */ ZEND_FUNCTION(gmp_add) { @@ -864,7 +872,7 @@ } /* }}} */ -/* {{{ proto resource gmp_sub(resource a, resource b) +/* {{{ proto resource gmp_sub(resource a, resource b) U Subtract b from a */ ZEND_FUNCTION(gmp_sub) { @@ -872,7 +880,7 @@ } /* }}} */ -/* {{{ proto resource gmp_mul(resource a, resource b) +/* {{{ proto resource gmp_mul(resource a, resource b) U Multiply a and b */ ZEND_FUNCTION(gmp_mul) { @@ -880,7 +888,7 @@ } /* }}} */ -/* {{{ proto array gmp_div_qr(resource a, resource b [, int round]) +/* {{{ proto array gmp_div_qr(resource a, resource b [, int round]) U Divide a by b, returns quotient and reminder */ ZEND_FUNCTION(gmp_div_qr) { @@ -917,7 +925,7 @@ } /* }}} */ -/* {{{ proto resource gmp_div_r(resource a, resource b [, int round]) +/* {{{ proto resource gmp_div_r(resource a, resource b [, int round]) U Divide a by b, returns reminder only */ ZEND_FUNCTION(gmp_div_r) { @@ -953,7 +961,7 @@ } /* }}} */ -/* {{{ proto resource gmp_div_q(resource a, resource b [, int round]) +/* {{{ proto resource gmp_div_q(resource a, resource b [, int round]) U Divide a by b, returns quotient only */ ZEND_FUNCTION(gmp_div_q) { @@ -990,7 +998,7 @@ } /* }}} */ -/* {{{ proto resource gmp_mod(resource a, resource b) +/* {{{ proto resource gmp_mod(resource a, resource b) U Computes a modulo b */ ZEND_FUNCTION(gmp_mod) { @@ -1004,7 +1012,7 @@ } /* }}} */ -/* {{{ proto resource gmp_divexact(resource a, resource b) +/* {{{ proto resource gmp_divexact(resource a, resource b) U Divide a by b using exact division algorithm */ ZEND_FUNCTION(gmp_divexact) { @@ -1012,7 +1020,7 @@ } /* }}} */ -/* {{{ proto resource gmp_neg(resource a) +/* {{{ proto resource gmp_neg(resource a) U Negates a number */ ZEND_FUNCTION(gmp_neg) { @@ -1020,7 +1028,7 @@ } /* }}} */ -/* {{{ proto resource gmp_abs(resource a) +/* {{{ proto resource gmp_abs(resource a) U Calculates absolute value */ ZEND_FUNCTION(gmp_abs) { @@ -1028,7 +1036,7 @@ } /* }}} */ -/* {{{ proto resource gmp_fact(int a) +/* {{{ proto resource gmp_fact(int a) U Calculates factorial function */ ZEND_FUNCTION(gmp_fact) { @@ -1057,7 +1065,7 @@ } /* }}} */ -/* {{{ proto resource gmp_pow(resource base, int exp) +/*
[PHP-CVS] cvs: php-src /ext/standard type.c
pollita Sun Oct 8 18:00:44 2006 UTC Modified files: /php-src/ext/standard type.c Log: Fix win32 (again), just temporarily convert the classname to ascii on this platform... http://cvs.php.net/viewvc.cgi/php-src/ext/standard/type.c?r1=1.46r2=1.47diff_format=u Index: php-src/ext/standard/type.c diff -u php-src/ext/standard/type.c:1.46 php-src/ext/standard/type.c:1.47 --- php-src/ext/standard/type.c:1.46Sat Oct 7 04:45:42 2006 +++ php-src/ext/standard/type.c Sun Oct 8 18:00:44 2006 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: type.c,v 1.46 2006/10/07 04:45:42 pollita Exp $ */ +/* $Id: type.c,v 1.47 2006/10/08 18:00:44 pollita Exp $ */ #include php.h #include php_incomplete_class.h @@ -238,12 +238,25 @@ /* We can get away with this because INCOMPLETE_CLASS is ascii and has a 1:1 relationship with unicode */ RETURN_TRUE; } else if (UG(unicode)) { +#ifndef PHP_WIN32 U_STRING_DECL(uIncompleteClass, (INCOMPLETE_CLASS), sizeof(INCOMPLETE_CLASS) - 1); U_STRING_INIT(uIncompleteClass, (INCOMPLETE_CLASS), sizeof(INCOMPLETE_CLASS) - 1); if (!memcmp(ce-name.u, uIncompleteClass, UBYTES(sizeof(INCOMPLETE_CLASS { RETURN_FALSE; } +#else /* WIN32 -- U_STRING_DECL breaks under Win32 with string macros */ + char *ascii_name = zend_unicode_to_ascii(ce-name.u, ce-name_length TSRSMLS_CC); + + if (ascii_name) { + if (memcmp(INCOMPLETE_CLASS, ascii_name, sizeof(INCOMPLETE_CLASS) - 1) == 0) { + efree(ascii_name); + RETURN_FALSE; + } + efree(ascii_name); + } + /* Non-ascii class name means it can't be INCOMPLETE_CLASS and is therefore okay */ +#endif } else { if (!memcmp(ce-name.s, INCOMPLETE_CLASS, sizeof(INCOMPLETE_CLASS))) { RETURN_FALSE; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src / NEWS /ext/standard basic_functions.c streamsfuncs.c streamsfuncs.h
pollita Mon Oct 9 02:48:06 2006 UTC Modified files: /php-src/ext/standard basic_functions.c streamsfuncs.c streamsfuncs.h /php-srcNEWS Log: Add stream_resolve_include_path() http://cvs.php.net/viewvc.cgi/php-src/ext/standard/basic_functions.c?r1=1.810r2=1.811diff_format=u Index: php-src/ext/standard/basic_functions.c diff -u php-src/ext/standard/basic_functions.c:1.810 php-src/ext/standard/basic_functions.c:1.811 --- php-src/ext/standard/basic_functions.c:1.810Sun Oct 8 13:34:23 2006 +++ php-src/ext/standard/basic_functions.c Mon Oct 9 02:48:06 2006 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: basic_functions.c,v 1.810 2006/10/08 13:34:23 bjori Exp $ */ +/* $Id: basic_functions.c,v 1.811 2006/10/09 02:48:06 pollita Exp $ */ #include php.h #include php_streams.h @@ -2443,6 +2443,12 @@ ZEND_ARG_INFO(0, stream) ZEND_ARG_INFO(0, encoding) ZEND_END_ARG_INFO() + +static +ZEND_BEGIN_ARG_INFO_EX(arginfo_stream_resolve_include_path, 0, 0, 1) + ZEND_ARG_INFO(0, filename) + ZEND_ARG_INFO(0, context) +ZEND_END_ARG_INFO() /* }}} */ /* {{{ string.c */ static @@ -3553,6 +3559,7 @@ #endif PHP_FE(stream_copy_to_stream, arginfo_stream_copy_to_stream) PHP_FE(stream_get_contents, arginfo_stream_get_contents) + PHP_FE(stream_resolve_include_path, arginfo_stream_resolve_include_path) PHP_FE(fgetcsv, arginfo_fgetcsv) PHP_FE(fputcsv, arginfo_fputcsv) PHP_FE(flock, arginfo_flock) http://cvs.php.net/viewvc.cgi/php-src/ext/standard/streamsfuncs.c?r1=1.94r2=1.95diff_format=u Index: php-src/ext/standard/streamsfuncs.c diff -u php-src/ext/standard/streamsfuncs.c:1.94 php-src/ext/standard/streamsfuncs.c:1.95 --- php-src/ext/standard/streamsfuncs.c:1.94Sun Oct 8 13:34:23 2006 +++ php-src/ext/standard/streamsfuncs.c Mon Oct 9 02:48:06 2006 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: streamsfuncs.c,v 1.94 2006/10/08 13:34:23 bjori Exp $ */ +/* $Id: streamsfuncs.c,v 1.95 2006/10/09 02:48:06 pollita Exp $ */ #include php.h #include php_globals.h @@ -1579,6 +1579,72 @@ } /* }}} */ +/* {{{ proto string stream_resolve_include_path(string filename[, resource context]) U +Determine what file will be opened by calls to fopen() with a relative path */ +PHP_FUNCTION(stream_resolve_include_path) +{ + zval **ppfilename, *zcontext = NULL; + char *filename, *ptr = PG(include_path), *end = ptr + (ptr ? strlen(ptr) : 0), buffer[MAXPATHLEN]; + int filename_len; + php_stream_context *context = NULL; + struct stat sb; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, Z|r, ppfilename, zcontext) == FAILURE || + php_stream_path_param_encode(ppfilename, filename, filename_len, REPORT_ERRORS, context = php_stream_context_from_zval(zcontext, 0)) == FAILURE) { + return; + } + + while (ptr end) { + char *s = strchr(ptr, DEFAULT_DIR_SEPARATOR); + + if (!s) { + s = end; + } + + if (s == ptr) { + ptr++; + continue; + } + + if ((s - ptr) + 1 + filename_len = MAXPATHLEN) { + /* Too long to try */ + ptr = s + 1; + continue; + } + + memcpy(buffer, ptr, s - ptr); + buffer[s - ptr] = '/'; + memcpy(buffer + (s - ptr) + 1, filename, filename_len + 1); + + if (php_check_open_basedir_ex(buffer, 0 TSRMLS_CC)) { + ptr = s + 1; + continue; + } + + if (VCWD_STAT(buffer, sb)) { + ptr = s + 1; + continue; + } + + if (UG(unicode)) { + UChar *upath; + int upath_len; + + if (SUCCESS == php_stream_path_decode(NULL, upath, upath_len, buffer, (s - ptr) + 1 + filename_len, REPORT_ERRORS, context)) { + RETURN_UNICODEL(upath, upath_len, 0); + } else { +
[PHP-CVS] cvs: php-src /ext/standard file.c
pollita Mon Oct 9 02:52:27 2006 UTC Modified files: /php-src/ext/standard file.c Log: Fix realpath() in unicode mode http://cvs.php.net/viewvc.cgi/php-src/ext/standard/file.c?r1=1.462r2=1.463diff_format=u Index: php-src/ext/standard/file.c diff -u php-src/ext/standard/file.c:1.462 php-src/ext/standard/file.c:1.463 --- php-src/ext/standard/file.c:1.462 Sun Oct 8 13:34:23 2006 +++ php-src/ext/standard/file.c Mon Oct 9 02:52:27 2006 @@ -21,7 +21,7 @@ +--+ */ -/* $Id: file.c,v 1.462 2006/10/08 13:34:23 bjori Exp $ */ +/* $Id: file.c,v 1.463 2006/10/09 02:52:27 pollita Exp $ */ /* Synced with php 3.0 revision 1.218 1999-06-16 [ssb] */ @@ -2432,10 +2432,11 @@ UChar *path; int path_len; - if (php_stream_path_decode(php_plain_files_wrapper, path, path_len, filename, filename_len, REPORT_ERRORS, FG(default_context)) == SUCCESS) { + if (php_stream_path_decode(php_plain_files_wrapper, path, path_len, resolved_path_buff, strlen(resolved_path_buff), REPORT_ERRORS, FG(default_context)) == SUCCESS) { RETVAL_UNICODEL(path, path_len, 0); } else { - RETVAL_FALSE; + /* Fallback */ + RETVAL_STRING(resolved_path_buff, 1); } } else { RETVAL_STRING(resolved_path_buff, 1); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/standard type.c
pollita Mon Oct 9 02:55:38 2006 UTC Modified files: /php-src/ext/standard type.c Log: Oi http://cvs.php.net/viewvc.cgi/php-src/ext/standard/type.c?r1=1.47r2=1.48diff_format=u Index: php-src/ext/standard/type.c diff -u php-src/ext/standard/type.c:1.47 php-src/ext/standard/type.c:1.48 --- php-src/ext/standard/type.c:1.47Sun Oct 8 18:00:44 2006 +++ php-src/ext/standard/type.c Mon Oct 9 02:55:38 2006 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: type.c,v 1.47 2006/10/08 18:00:44 pollita Exp $ */ +/* $Id: type.c,v 1.48 2006/10/09 02:55:38 pollita Exp $ */ #include php.h #include php_incomplete_class.h @@ -246,7 +246,7 @@ RETURN_FALSE; } #else /* WIN32 -- U_STRING_DECL breaks under Win32 with string macros */ - char *ascii_name = zend_unicode_to_ascii(ce-name.u, ce-name_length TSRSMLS_CC); + char *ascii_name = zend_unicode_to_ascii(ce-name.u, ce-name_length TSRMLS_CC); if (ascii_name) { if (memcmp(INCOMPLETE_CLASS, ascii_name, sizeof(INCOMPLETE_CLASS) - 1) == 0) { -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/gd gd.c
pollita Sat Oct 7 17:41:14 2006 UTC Modified files: /php-src/ext/gd gd.c Log: More PHP6 Updates http://cvs.php.net/viewvc.cgi/php-src/ext/gd/gd.c?r1=1.356r2=1.357diff_format=u Index: php-src/ext/gd/gd.c diff -u php-src/ext/gd/gd.c:1.356 php-src/ext/gd/gd.c:1.357 --- php-src/ext/gd/gd.c:1.356 Sat Oct 7 16:38:23 2006 +++ php-src/ext/gd/gd.c Sat Oct 7 17:41:14 2006 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: gd.c,v 1.356 2006/10/07 16:38:23 pollita Exp $ */ +/* $Id: gd.c,v 1.357 2006/10/07 17:41:14 pollita Exp $ */ /* gd 1.2 is copyright 1994, 1995, Quest Protein Database Center, Cold Spring Harbor Labs. */ @@ -2976,7 +2976,7 @@ } /* }}} */ -/* {{{ proto int imagecolortransparent(resource im [, int col]) +/* {{{ proto int imagecolortransparent(resource im [, int col]) U Define a color as transparent */ PHP_FUNCTION(imagecolortransparent) { @@ -3205,15 +3205,24 @@ { zval *IM; long size, x, y, col; + zend_uchar str_type; char *str; int str_len, i; gdImagePtr im; gdFontPtr font; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, rlllsl, IM, size, x, y, str, str_len, col) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, rllltl, IM, size, x, y, str, str_len, str_type, col) == FAILURE) { return; } + if (str_type == IS_UNICODE) { + str = zend_unicode_to_ascii((UChar*)str, str_len TSRMLS_CC); + if (!str) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, Binary or ASCII-Unicode string expected, non-ASCII-Unicode string received. Consider using the TTF functions for Unicode output); + RETURN_FALSE; + } + } + ZEND_FETCH_RESOURCE(im, gdImagePtr, IM, -1, Image, le_gd); font = php_find_gd_font(size TSRMLS_CC); @@ -3241,11 +3250,15 @@ } } + if (str_type == IS_UNICODE) { + efree(str); + } + RETURN_TRUE; } /* }}} */ -/* {{{ proto bool imagechar(resource im, int font, int x, int y, string c, int col) +/* {{{ proto bool imagechar(resource im, int font, int x, int y, string c, int col) U Draw a character */ PHP_FUNCTION(imagechar) { @@ -3253,7 +3266,7 @@ } /* }}} */ -/* {{{ proto bool imagecharup(resource im, int font, int x, int y, string c, int col) +/* {{{ proto bool imagecharup(resource im, int font, int x, int y, string c, int col) U Draw a character rotated 90 degrees counter-clockwise */ PHP_FUNCTION(imagecharup) { @@ -3261,7 +3274,7 @@ } /* }}} */ -/* {{{ proto bool imagestring(resource im, int font, int x, int y, string str, int col) +/* {{{ proto bool imagestring(resource im, int font, int x, int y, string str, int col) U Draw a string horizontally */ PHP_FUNCTION(imagestring) { @@ -3269,7 +3282,7 @@ } /* }}} */ -/* {{{ proto bool imagestringup(resource im, int font, int x, int y, string str, int col) +/* {{{ proto bool imagestringup(resource im, int font, int x, int y, string str, int col) U Draw a string vertically - rotated 90 degrees counter-clockwise */ PHP_FUNCTION(imagestringup) { @@ -3404,7 +3417,7 @@ #ifdef ENABLE_GD_TTF #if HAVE_LIBFREETYPE HAVE_GD_STRINGFTEX -/* {{{ proto array imageftbbox(float size, float angle, string font_file, string text [, array extrainfo]) +/* {{{ proto array imageftbbox(float size, float angle, string font_file, string text [, array extrainfo]) U Give the bounding box of a text using fonts via freetype2 */ PHP_FUNCTION(imageftbbox) { @@ -3412,7 +3425,7 @@ } /* }}} */ -/* {{{ proto array imagefttext(resource im, float size, float angle, int x, int y, int col, string font_file, string text [, array extrainfo]) +/* {{{ proto array imagefttext(resource im, float size, float angle, int x, int y, int col, string font_file, string text [, array extrainfo]) U Write text to the image using fonts via freetype2 */ PHP_FUNCTION(imagefttext) { @@ -3421,7 +3434,7 @@ /* }}} */ #endif -/* {{{ proto array imagettfbbox(float size, float angle, string font_file, string text) +/* {{{ proto array imagettfbbox(float size, float angle, string font_file, string text) U Give the bounding box of a text using TrueType fonts */ PHP_FUNCTION(imagettfbbox) { @@ -3429,7 +3442,7 @@ } /* }}} */ -/* {{{ proto array imagettftext(resource im, float size, float angle, int x, int y, int col, string font_file, string text) +/* {{{ proto array imagettftext(resource im, float size, float angle, int x, int y, int col, string font_file, string text) U Write text to the image using a TrueType font */ PHP_FUNCTION(imagettftext) { @@ -3458,15 +3471,21 @@ #endif if (mode == TTFTEXT_BBOX) { + zval **ppfontname; + if (argc 4 || argc ((extended) ? 5 : 4)) {
[PHP-CVS] cvs: php-src /ext/sqlite config.m4 php_sqlite.h sqlite.c
pollita Sat Oct 7 17:49:30 2006 UTC Modified files: /php-src/ext/sqlite config.m4 php_sqlite.h sqlite.c Log: Update SQLITE2 (non-PDO parts at least) for PHP6/Unicode Change default build of bundled libsqlite to utf8 mode iso-8859 mode is still available using --disable-sqlite-utf8 http://cvs.php.net/viewvc.cgi/php-src/ext/sqlite/config.m4?r1=1.41r2=1.42diff_format=u Index: php-src/ext/sqlite/config.m4 diff -u php-src/ext/sqlite/config.m4:1.41 php-src/ext/sqlite/config.m4:1.42 --- php-src/ext/sqlite/config.m4:1.41 Tue Jun 14 01:44:16 2005 +++ php-src/ext/sqlite/config.m4Sat Oct 7 17:49:30 2006 @@ -1,4 +1,4 @@ -dnl $Id: config.m4,v 1.41 2005/06/14 01:44:16 sniper Exp $ +dnl $Id: config.m4,v 1.42 2006/10/07 17:49:30 pollita Exp $ dnl config.m4 for extension sqlite dnl vim:et:ts=2:sw=2 @@ -8,8 +8,8 @@ Sqlite include and library files are located, if not using bundled library.], yes) -PHP_ARG_ENABLE(sqlite-utf8, whether to enable UTF-8 support in sqlite (default: ISO-8859-1), -[ --enable-sqlite-utf8 SQLite: Enable UTF-8 support for SQLite], no, no) +PHP_ARG_ENABLE(sqlite-utf8, whether to disable UTF-8 support in libsqlite (charset changes to ISO-8859-1), +[ --disable-sqlite-utf8 SQLite: Disable UTF-8 support for SQLite (use ISO8859)], yes, no) @@ -126,11 +126,11 @@ dnl use latin 1 for SQLite older than 2.8.9; the utf-8 handling dnl in funcs.c uses assert(), which is a bit silly and something dnl we want to avoid. This assert() was removed in SQLite 2.8.9. -if test $PHP_SQLITE_UTF8 = yes; then +if test $PHP_SQLITE_UTF8 = no; then + SQLITE_ENCODING=ISO8859 +else SQLITE_ENCODING=UTF8 AC_DEFINE(SQLITE_UTF8, 1, [ ]) -else - SQLITE_ENCODING=ISO8859 fi PHP_SUBST(SQLITE_ENCODING) http://cvs.php.net/viewvc.cgi/php-src/ext/sqlite/php_sqlite.h?r1=1.34r2=1.35diff_format=u Index: php-src/ext/sqlite/php_sqlite.h diff -u php-src/ext/sqlite/php_sqlite.h:1.34 php-src/ext/sqlite/php_sqlite.h:1.35 --- php-src/ext/sqlite/php_sqlite.h:1.34Sun Jan 1 13:09:54 2006 +++ php-src/ext/sqlite/php_sqlite.h Sat Oct 7 17:49:30 2006 @@ -17,7 +17,7 @@ | Marcus Boerger [EMAIL PROTECTED] | +--+ - $Id: php_sqlite.h,v 1.34 2006/01/01 13:09:54 sniper Exp $ + $Id: php_sqlite.h,v 1.35 2006/10/07 17:49:30 pollita Exp $ */ #ifndef PHP_SQLITE_H @@ -93,7 +93,10 @@ PHP_FUNCTION(sqlite_fetch_column_types); ZEND_BEGIN_MODULE_GLOBALS(sqlite) -long assoc_case; + long assoc_case; +#ifdef SQLITE_ISO8859 + UConverter *iso8859_conv; +#endif ZEND_END_MODULE_GLOBALS(sqlite) #ifdef ZTS http://cvs.php.net/viewvc.cgi/php-src/ext/sqlite/sqlite.c?r1=1.197r2=1.198diff_format=u Index: php-src/ext/sqlite/sqlite.c diff -u php-src/ext/sqlite/sqlite.c:1.197 php-src/ext/sqlite/sqlite.c:1.198 --- php-src/ext/sqlite/sqlite.c:1.197 Tue Sep 19 10:38:31 2006 +++ php-src/ext/sqlite/sqlite.c Sat Oct 7 17:49:30 2006 @@ -17,7 +17,7 @@ | Marcus Boerger [EMAIL PROTECTED] | +--+ - $Id: sqlite.c,v 1.197 2006/09/19 10:38:31 dmitry Exp $ + $Id: sqlite.c,v 1.198 2006/10/07 17:49:30 pollita Exp $ */ #ifdef HAVE_CONFIG_H @@ -29,9 +29,12 @@ #include php.h #include php_ini.h #include ext/standard/info.h +#include ext/standard/file.h +#include ext/standard/php_string.h #if HAVE_PHP_SESSION !defined(COMPILE_DL_SESSION) #include ext/session/php_session.h #endif +#include sqlite.h #include php_sqlite.h #if HAVE_TIME_H @@ -41,7 +44,12 @@ #include unistd.h #endif -#include sqlite.h + +#ifdef SQLITE_UTF8 +#define SQLITE2_CONV UG(utf8_conv) +#else /* ISO 8859 */ +#define SQLITE2_CONV SQLITE_G(iso8859_conv) +#endif #include zend_exceptions.h #include zend_interfaces.h @@ -95,10 +103,48 @@ } } +#ifdef SQLITE_ISO8859 +static ZEND_INI_MH(OnUpdateEncodingISO8859) +{ + UConverter **converter; +#ifndef ZTS + char *base = (char *) mh_arg2; +#else + char *base = (char *) ts_resource(*((int *) mh_arg2)); +#endif + char encoding[sizeof(iso-8859-999)]; + + converter = (UConverter **) (base+(size_t) mh_arg1); + if (new_value_length 3) { + /* Really, 2 is sufficient, but be generous, the zend_set_converter_encoding call will find it out */ + zend_error(E_CORE_ERROR, Unrecognized locale '%s' for iso-8859 encoding used for %s, new_value ? new_value : 1, entry-name); + return FAILURE; + } + + snprintf(encoding, sizeof(iso-8859-999), iso-8859-%s, new_value ? new_value : 1); + +if (zend_set_converter_encoding(converter, encoding) == FAILURE) { +zend_error(E_CORE_ERROR, Unrecognized
[PHP-CVS] cvs: php-src /ext/standard type.c
pollita Sat Oct 7 04:45:42 2006 UTC Modified files: /php-src/ext/standard type.c Log: Win32 build gets confused by expansion of U_STRING_DECL macro with constants http://cvs.php.net/viewvc.cgi/php-src/ext/standard/type.c?r1=1.45r2=1.46diff_format=u Index: php-src/ext/standard/type.c diff -u php-src/ext/standard/type.c:1.45 php-src/ext/standard/type.c:1.46 --- php-src/ext/standard/type.c:1.45Fri Oct 6 20:11:25 2006 +++ php-src/ext/standard/type.c Sat Oct 7 04:45:42 2006 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: type.c,v 1.45 2006/10/06 20:11:25 andrei Exp $ */ +/* $Id: type.c,v 1.46 2006/10/07 04:45:42 pollita Exp $ */ #include php.h #include php_incomplete_class.h @@ -238,8 +238,8 @@ /* We can get away with this because INCOMPLETE_CLASS is ascii and has a 1:1 relationship with unicode */ RETURN_TRUE; } else if (UG(unicode)) { - U_STRING_DECL(uIncompleteClass, INCOMPLETE_CLASS, sizeof(INCOMPLETE_CLASS) - 1); - U_STRING_INIT(uIncompleteClass, INCOMPLETE_CLASS, sizeof(INCOMPLETE_CLASS) - 1); + U_STRING_DECL(uIncompleteClass, (INCOMPLETE_CLASS), sizeof(INCOMPLETE_CLASS) - 1); + U_STRING_INIT(uIncompleteClass, (INCOMPLETE_CLASS), sizeof(INCOMPLETE_CLASS) - 1); if (!memcmp(ce-name.u, uIncompleteClass, UBYTES(sizeof(INCOMPLETE_CLASS { RETURN_FALSE; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/bz2 bz2.c /ext/bz2/tests 001.phpt 004.phpt 005.phpt
pollita Thu Oct 5 21:28:19 2006 UTC Modified files: /php-src/ext/bz2bz2.c /php-src/ext/bz2/tests 001.phpt 004.phpt 005.phpt Log: Updated for PHP6 http://cvs.php.net/viewvc.cgi/php-src/ext/bz2/bz2.c?r1=1.26r2=1.27diff_format=u Index: php-src/ext/bz2/bz2.c diff -u php-src/ext/bz2/bz2.c:1.26 php-src/ext/bz2/bz2.c:1.27 --- php-src/ext/bz2/bz2.c:1.26 Wed Aug 30 18:40:01 2006 +++ php-src/ext/bz2/bz2.c Thu Oct 5 21:28:18 2006 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: bz2.c,v 1.26 2006/08/30 18:40:01 iliaa Exp $ */ +/* $Id: bz2.c,v 1.27 2006/10/05 21:28:18 pollita Exp $ */ #ifdef HAVE_CONFIG_H #include config.h @@ -305,7 +305,7 @@ php_info_print_table_end(); } -/* {{{ proto string bzread(resource bz[, int length]) +/* {{{ proto string bzread(resource bz[, int length]) U Reads up to length bytes from a BZip2 stream, or 1024 bytes if length is not specified */ static PHP_FUNCTION(bzread) { @@ -324,54 +324,64 @@ RETURN_FALSE; } - Z_STRVAL_P(return_value) = emalloc(len + 1); - Z_STRLEN_P(return_value) = php_stream_read(stream, Z_STRVAL_P(return_value), len); - - if (Z_STRLEN_P(return_value) 0) { - efree(Z_STRVAL_P(return_value)); - php_error_docref(NULL TSRMLS_CC, E_WARNING, could not read valid bz2 data from stream); - RETURN_FALSE; - } - - Z_STRVAL_P(return_value)[Z_STRLEN_P(return_value)] = 0; + if (stream-readbuf_type == IS_UNICODE) { + int buflen = len; + UChar *buf = php_stream_read_unicode_chars(stream, buflen); + + if (!buf) { + /* For BC */ + RETURN_EMPTY_UNICODE(); + } - Z_TYPE_P(return_value) = IS_STRING; + RETURN_UNICODEL(buf, buflen, 0); + } else { /* IS_STRING */ + char *buf = emalloc(len + 1); + int buflen = php_stream_read(stream, buf, len); + + if (!buflen) { + efree(buf); + RETURN_EMPTY_STRING(); + } + buf[buflen] = 0; + RETURN_STRINGL(buf, buflen, 0); + } } /* }}} */ -/* {{{ proto resource bzopen(string|int file|fp, string mode) +/* {{{ proto resource bzopen(string|int file|fp, string mode) U Opens a new BZip2 stream */ static PHP_FUNCTION(bzopen) { - zval**file, /* The file to open */ - **mode; /* The mode to open the stream with */ + zval**file; /* The file to open */ + char*mode;/* The mode to open the stream with */ + int mode_len; BZFILE *bz; /* The compressed file stream */ php_stream *stream = NULL; - if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, file, mode) == FAILURE) { - WRONG_PARAM_COUNT; + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, Zs, file, mode, mode_len) == FAILURE) { + return; } - convert_to_string_ex(mode); - if (Z_STRLEN_PP(mode) != 1 || (Z_STRVAL_PP(mode)[0] != 'r' Z_STRVAL_PP(mode)[0] != 'w')) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, '%s' is not a valid mode for bzopen(). Only 'w' and 'r' are supported., Z_STRVAL_PP(mode)); + if (mode_len != 1 || (mode[0] != 'r' mode[0] != 'w')) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, '%s' is not a valid mode for bzopen(). Only 'w' and 'r' are supported., mode); RETURN_FALSE; } /* If it's not a resource its a string containing the filename to open */ if (Z_TYPE_PP(file) != IS_RESOURCE) { - convert_to_string_ex(file); + char *filename; + int filename_len; + + if (FAILURE == php_stream_path_param_encode(file, filename, filename_len, REPORT_ERRORS, FG(default_context))) { + RETURN_FALSE; + } - if (Z_STRLEN_PP(file) == 0) { + if (filename_len == 0) { php_error_docref(NULL TSRMLS_CC, E_WARNING, filename cannot be empty); RETURN_FALSE; } - stream = php_stream_bz2open(NULL, - Z_STRVAL_PP(file), - Z_STRVAL_PP(mode), - REPORT_ERRORS, - NULL); + stream = php_stream_bz2open(NULL, filename, mode, REPORT_ERRORS, NULL); } else { /* If it is a resource, than its a stream resource */ int fd; @@ -388,17 +398,17 @@
[PHP-CVS] cvs: php-src /main main.c ZendEngine2 zend.c zend.h zend_builtin_functions.c
pollita Tue Oct 3 16:28:02 2006 UTC Modified files: /ZendEngine2zend.c zend.h zend_builtin_functions.c /php-src/main main.c Log: PHP6 Update for get_included_files() and export of path decode for Zend http://cvs.php.net/viewvc.cgi/ZendEngine2/zend.c?r1=1.373r2=1.374diff_format=u Index: ZendEngine2/zend.c diff -u ZendEngine2/zend.c:1.373 ZendEngine2/zend.c:1.374 --- ZendEngine2/zend.c:1.373Fri Sep 29 20:59:26 2006 +++ ZendEngine2/zend.c Tue Oct 3 16:28:02 2006 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: zend.c,v 1.373 2006/09/29 20:59:26 andrei Exp $ */ +/* $Id: zend.c,v 1.374 2006/10/03 16:28:02 pollita Exp $ */ #include zend.h #include zend_extensions.h @@ -56,6 +56,7 @@ ZEND_API int (*zend_printf)(const char *format, ...); ZEND_API zend_write_func_t zend_write; ZEND_API int (*zend_path_encode)(char **encpath, int *encpath_len, const UChar *path, int path_len TSRMLS_DC); +ZEND_API int (*zend_path_decode)(UChar **decpath, int *decpath_len, const char *path, int path_len TSRMLS_DC); ZEND_API FILE *(*zend_fopen)(const char *filename, char **opened_path); ZEND_API int (*zend_stream_open_function)(const char *filename, zend_file_handle *handle TSRMLS_DC); ZEND_API void (*zend_block_interruptions)(void); @@ -624,6 +625,22 @@ return SUCCESS; } +static int zend_path_decode_wrapper(UChar **decpath, int *decpath_len, const char *path, int path_len TSRMLS_DC) +{ + UErrorCode status = U_ZERO_ERROR; + + zend_string_to_unicode_ex(ZEND_U_CONVERTER(UG(filesystem_encoding_conv)), decpath, decpath_len, path, path_len, status); + + if (U_FAILURE(status)) { + efree(*decpath); + *decpath = NULL; + *decpath_len = 0; + return FAILURE; + } + + return SUCCESS; +} + static FILE *zend_fopen_wrapper(const char *filename, char **opened_path) { if (opened_path) { @@ -1012,6 +1029,10 @@ if (!zend_path_encode) { zend_path_encode = zend_path_encode_wrapper; } + zend_path_decode = utility_functions-path_decode_function; + if (!zend_path_decode) { + zend_path_decode = zend_path_decode_wrapper; + } zend_fopen = utility_functions-fopen_function; if (!zend_fopen) { zend_fopen = zend_fopen_wrapper; http://cvs.php.net/viewvc.cgi/ZendEngine2/zend.h?r1=1.327r2=1.328diff_format=u Index: ZendEngine2/zend.h diff -u ZendEngine2/zend.h:1.327 ZendEngine2/zend.h:1.328 --- ZendEngine2/zend.h:1.327Thu Sep 14 10:32:57 2006 +++ ZendEngine2/zend.h Tue Oct 3 16:28:02 2006 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: zend.h,v 1.327 2006/09/14 10:32:57 dmitry Exp $ */ +/* $Id: zend.h,v 1.328 2006/10/03 16:28:02 pollita Exp $ */ #ifndef ZEND_H #define ZEND_H @@ -411,6 +411,7 @@ int (*printf_function)(const char *format, ...); int (*write_function)(const char *str, uint str_length); int (*path_encode_function)(char **encpath, int *encpath_len, const UChar *path, int path_len TSRMLS_DC); + int (*path_decode_function)(UChar **decpath, int *decpath_len, const char *path, int path_len TSRMLS_DC); FILE *(*fopen_function)(const char *filename, char **opened_path); void (*message_handler)(long message, void *data); void (*block_interruptions)(void); @@ -557,6 +558,7 @@ extern ZEND_API int (*zend_printf)(const char *format, ...); extern ZEND_API zend_write_func_t zend_write; extern ZEND_API int (*zend_path_encode)(char **encpath, int *encpath_len, const UChar *path, int path_len TSRMLS_DC); +extern ZEND_API int (*zend_path_decode)(UChar **decpath, int *decpath_len, const char *path, int path_len TSRMLS_DC); extern ZEND_API FILE *(*zend_fopen)(const char *filename, char **opened_path); extern ZEND_API void (*zend_block_interruptions)(void); extern ZEND_API void (*zend_unblock_interruptions)(void); http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_builtin_functions.c?r1=1.326r2=1.327diff_format=u Index: ZendEngine2/zend_builtin_functions.c diff -u ZendEngine2/zend_builtin_functions.c:1.326 ZendEngine2/zend_builtin_functions.c:1.327 --- ZendEngine2/zend_builtin_functions.c:1.326 Tue Sep 26 07:55:40 2006 +++ ZendEngine2/zend_builtin_functions.cTue Oct 3 16:28:02 2006 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: zend_builtin_functions.c,v 1.326 2006/09/26 07:55:40 dmitry Exp $ */ +/* $Id: zend_builtin_functions.c,v 1.327 2006/10/03 16:28:02 pollita Exp $ */ #include zend.h #include zend_API.h @@ -1197,22 +1197,28 @@ #endif /* ZEND_DEBUG */ -/* {{{ proto array get_included_files(void) - Returns an array with the file names that were include_once()'d */ +/* {{{ proto array get_included_files(void) U + Returns an
[PHP-CVS] cvs: php-src / NEWS /ext/standard proc_open.c
pollita Tue Oct 3 19:37:01 2006 UTC Modified files: /php-srcNEWS /php-src/ext/standard proc_open.c Log: Update proc_open() for PHP6 http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2125r2=1.2126diff_format=u Index: php-src/NEWS diff -u php-src/NEWS:1.2125 php-src/NEWS:1.2126 --- php-src/NEWS:1.2125 Mon Oct 2 17:47:02 2006 +++ php-src/NEWSTue Oct 3 19:37:01 2006 @@ -52,6 +52,7 @@ set params during context creation. (Sara) . sys_get_temp_dir() function that returns the default directory for temporary files (as requested in bug #35380). (Hartmut) + . context and binary_pipes params in other_options arg. (Sara) - Fixed bug #36630 (umask not reset at the end of the request). (Ilia) - Fixed bug #34286 (__toString() behavior is inconsistent). (Marcus) http://cvs.php.net/viewvc.cgi/php-src/ext/standard/proc_open.c?r1=1.44r2=1.45diff_format=u Index: php-src/ext/standard/proc_open.c diff -u php-src/ext/standard/proc_open.c:1.44 php-src/ext/standard/proc_open.c:1.45 --- php-src/ext/standard/proc_open.c:1.44 Mon Oct 2 21:02:08 2006 +++ php-src/ext/standard/proc_open.cTue Oct 3 19:37:01 2006 @@ -15,7 +15,7 @@ | Author: Wez Furlong [EMAIL PROTECTED] | +--+ */ -/* $Id: proc_open.c,v 1.44 2006/10/02 21:02:08 pollita Exp $ */ +/* $Id: proc_open.c,v 1.45 2006/10/03 19:37:01 pollita Exp $ */ #if 0 (defined(__linux__) || defined(sun) || defined(__IRIX__)) # define _BSD_SOURCE /* linux wants this when XOPEN mode is on */ @@ -417,10 +417,11 @@ }; /* }}} */ -/* {{{ proto resource proc_open(string command, array descriptorspec, array pipes [, string cwd [, array env [, array other_options]]]) +/* {{{ proto resource proc_open(string command, array descriptorspec, array pipes [, string cwd [, array env [, array other_options]]]) U Run a process with more control over it's file descriptors */ PHP_FUNCTION(proc_open) { + zval **ppcommand, **ppcwd = NULL; char *command, *cwd=NULL; int command_len, cwd_len; zval *descriptorspec; @@ -458,23 +459,39 @@ php_file_descriptor_t dev_ptmx = -1;/* master */ php_file_descriptor_t slave_pty = -1; #endif + php_stream_context *context = FG(default_context); + zend_uchar binary_pipes = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, saz|s!a!a!, command, - command_len, descriptorspec, pipes, cwd, cwd_len, environment, - other_options) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, Zaz|Z!a!a!, ppcommand, descriptorspec, pipes, ppcwd, environment, other_options) == FAILURE || + php_stream_path_param_encode(ppcommand, command, command_len, REPORT_ERRORS, FG(default_context)) == FAILURE) { + RETURN_FALSE; + } + + if (ppcwd php_stream_path_param_encode(ppcwd, cwd, cwd_len, REPORT_ERRORS, FG(default_context)) == FAILURE) { RETURN_FALSE; } -#ifdef PHP_WIN32 if (other_options) { zval **item; +#ifdef PHP_WIN32 if (SUCCESS == zend_ascii_hash_find(Z_ARRVAL_P(other_options), suppress_errors, sizeof(suppress_errors), (void**)item)) { if (Z_TYPE_PP(item) == IS_BOOL Z_BVAL_PP(item)) { suppress_errors = 1; } } - } #endif + /* Suppresses automatic application of unicode filters when unicode.semantics=on */ + if (SUCCESS == zend_ascii_hash_find(Z_ARRVAL_P(other_options), binary_pipes, sizeof(binary_pipes), (void**)item)) { + if (Z_TYPE_PP(item) == IS_BOOL Z_BVAL_PP(item)) { + binary_pipes = 1; + } + } + + /* Override FG(default_context) */ + if (SUCCESS == zend_ascii_hash_find(Z_ARRVAL_P(other_options), context, sizeof(context), (void**)item)) { + context = php_stream_context_from_zval(*item, 0); + } + } if (environment) { env = _php_array_to_envp(environment, is_persistent TSRMLS_CC); @@ -579,36 +596,52 @@ #endif descriptors[ndesc].mode_flags = descriptors[ndesc].mode DESC_PARENT_MODE_WRITE ? O_WRONLY : O_RDONLY; #ifdef PHP_WIN32 - if (Z_STRLEN_PP(zmode) = 2 Z_STRVAL_PP(zmode)[1] == 'b') + if (Z_STRLEN_PP(zmode) = 2 Z_STRVAL_PP(zmode)[1] == 'b') { descriptors[ndesc].mode_flags |= O_BINARY; + } #endif } else if
[PHP-CVS] cvs: php-src /ext/standard uuencode.c
pollita Tue Oct 3 19:51:35 2006 UTC Modified files: /php-src/ext/standard uuencode.c Log: PHP6 updates for convert_uu(en|de)code() http://cvs.php.net/viewvc.cgi/php-src/ext/standard/uuencode.c?r1=1.7r2=1.8diff_format=u Index: php-src/ext/standard/uuencode.c diff -u php-src/ext/standard/uuencode.c:1.7 php-src/ext/standard/uuencode.c:1.8 --- php-src/ext/standard/uuencode.c:1.7 Sun Jun 25 19:19:31 2006 +++ php-src/ext/standard/uuencode.c Tue Oct 3 19:51:35 2006 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: uuencode.c,v 1.7 2006/06/25 19:19:31 bjori Exp $ */ +/* $Id: uuencode.c,v 1.8 2006/10/03 19:51:35 pollita Exp $ */ /* * Portions of this code are based on Berkeley's uuencode/uudecode @@ -183,35 +183,60 @@ return -1; } -/* {{{ proto string convert_uuencode(string data) +/* {{{ proto string convert_uuencode(string data) U uuencode a string */ PHP_FUNCTION(convert_uuencode) { char *src, *dst; int src_len, dst_len; + zend_uchar src_type; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, s, src, src_len) == FAILURE || src_len 1) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, t, src, src_len, src_type) == FAILURE || src_len 1) { RETURN_FALSE; } + if (src_type == IS_UNICODE) { + src = zend_unicode_to_ascii((UChar*)src, src_len TSRMLS_CC); + if (!src) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, Binary or ASCII-Unicode string expected, non-ASCII-Unicode string received); + RETURN_FALSE; + } + } + dst_len = php_uuencode(src, src_len, dst); + if (src_type == IS_UNICODE) { + efree(src); + } - RETURN_STRINGL(dst, dst_len, 0); + RETURN_RT_STRINGL(dst, dst_len, ZSTR_AUTOFREE); } /* }}} */ -/* {{{ proto string convert_uudecode(string data) +/* {{{ proto string convert_uudecode(string data) U decode a uuencoded string */ PHP_FUNCTION(convert_uudecode) { char *src, *dst; int src_len, dst_len; + zend_uchar src_type; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, s, src, src_len) == FAILURE || src_len 1) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, t, src, src_len, src_type) == FAILURE || src_len 1) { RETURN_FALSE; } + if (src_type == IS_UNICODE) { + src = zend_unicode_to_ascii((UChar*)src, src_len TSRMLS_CC); + if (!src) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, Binary or ASCII-Unicode string expected, non-ASCII-Unicode string received); + RETURN_FALSE; + } + } + dst_len = php_uudecode(src, src_len, dst); + if (src_type == IS_UNICODE) { + efree(src); + } + if (dst_len 0) { php_error_docref(NULL TSRMLS_CC, E_WARNING, The given parameter is not a valid uuencoded string.); RETURN_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 dir.c
pollita Mon Oct 2 17:45:30 2006 UTC Modified files: /php-src/ext/standard dir.c Log: Switch opendir/chroot/chdir to new path_param API and upgrade scandir() for PHP6 http://cvs.php.net/viewvc.cgi/php-src/ext/standard/dir.c?r1=1.155r2=1.156diff_format=u Index: php-src/ext/standard/dir.c diff -u php-src/ext/standard/dir.c:1.155 php-src/ext/standard/dir.c:1.156 --- php-src/ext/standard/dir.c:1.155Sat Sep 23 12:32:32 2006 +++ php-src/ext/standard/dir.c Mon Oct 2 17:45:30 2006 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: dir.c,v 1.155 2006/09/23 12:32:32 tony2001 Exp $ */ +/* $Id: dir.c,v 1.156 2006/10/02 17:45:30 pollita Exp $ */ /* {{{ includes/startup/misc */ @@ -178,36 +178,32 @@ /* {{{ internal functions */ static void _php_do_opendir(INTERNAL_FUNCTION_PARAMETERS, int createobject) { - UChar *udir; + zval **ppdir; + UChar *udir = NULL; char *dir; int dir_len, udir_len; - zend_uchar dir_type; zval *zcontext = NULL; php_stream_context *context = NULL; php_stream *dirp; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, t|r, dir, dir_len, dir_type, zcontext) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, Z|r, ppdir, zcontext) == FAILURE) { return; } RETVAL_FALSE; - /* Save for later */ - udir = (UChar*)dir; - udir_len = dir_len; - - if (zcontext) { - context = php_stream_context_from_zval(zcontext, 0); + if (createobject Z_TYPE_PP(ppdir) == IS_UNICODE) { + /* Save for later */ + udir = eustrndup(Z_USTRVAL_PP(ppdir), Z_USTRLEN_PP(ppdir)); + udir_len = Z_USTRLEN_PP(ppdir); } - if (dir_type == IS_UNICODE) { - if (FAILURE == php_stream_path_encode(NULL, dir, dir_len, udir, udir_len, REPORT_ERRORS, context)) { - goto opendir_cleanup; - } + context = php_stream_context_from_zval(zcontext, 0); + if (FAILURE == php_stream_path_param_encode(ppdir, dir, dir_len, REPORT_ERRORS, context)) { + goto opendir_cleanup; } dirp = php_stream_opendir(dir, REPORT_ERRORS, context); - if (dirp == NULL) { goto opendir_cleanup; } @@ -216,8 +212,11 @@ if (createobject) { object_init_ex(return_value, dir_class_entry_ptr); - if (dir_type == IS_UNICODE) { - add_property_unicodel(return_value, path, udir, udir_len, 1); + if (udir) { + add_property_unicodel(return_value, path, udir, udir_len, 0); + + /* Avoid auto-cleanup */ + udir = NULL; } else { add_property_stringl(return_value, path, dir, dir_len, 1); } @@ -228,8 +227,8 @@ } opendir_cleanup: - if (dir_type == IS_UNICODE) { - efree(dir); + if (udir) { + efree(udir); } } /* }}} */ @@ -272,25 +271,16 @@ Change root directory */ PHP_FUNCTION(chroot) { + zval **ppstr; char *str; int ret, str_len; - zend_uchar str_type; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, t, str, str_len, str_type) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, Z, ppstr) == FAILURE || + php_stream_path_param_encode(ppstr, str, str_len, REPORT_ERRORS, FG(default_context)) == FAILURE) { return; } - - if (str_type == IS_UNICODE) { - if (FAILURE == php_stream_path_encode(NULL, str, str_len, (UChar*)str, str_len, REPORT_ERRORS, FG(default_context))) { - RETURN_FALSE; - } - } ret = chroot(str); - if (str_type == IS_UNICODE) { - efree(str); - } - if (ret != 0) { php_error_docref(NULL TSRMLS_CC, E_WARNING, %s (errno %d), strerror(errno), errno); RETURN_FALSE; @@ -312,25 +302,16 @@ Change the current directory */ PHP_FUNCTION(chdir) { + zval **ppstr; char *str; int ret, str_len; - zend_uchar str_type; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, t, str, str_len, str_type) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, Z, ppstr) == FAILURE || + php_stream_path_param_encode(ppstr, str, str_len, REPORT_ERRORS, FG(default_context)) == FAILURE) { return; } - if (str_type == IS_UNICODE) { - if (FAILURE == php_stream_path_encode(NULL, str, str_len, (UChar*)str, str_len, REPORT_ERRORS, FG(default_context))) { - RETURN_FALSE; -
[PHP-CVS] cvs: php-src / NEWS
pollita Mon Oct 2 17:47:02 2006 UTC Modified files: /php-srcNEWS Log: Note context param changes in opendir(), dir(), and scandir() http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2124r2=1.2125diff_format=u Index: php-src/NEWS diff -u php-src/NEWS:1.2124 php-src/NEWS:1.2125 --- php-src/NEWS:1.2124 Mon Oct 2 03:17:48 2006 +++ php-src/NEWSMon Oct 2 17:47:02 2006 @@ -8,6 +8,8 @@ - Changed return new by reference to throw an E_STRICT error. (Dmitry) - Changed instanceof and catch operators, is_a() and is_subclass_of() functions to not call __autoload(). (Dmitry) +- Changed opendir/dir/scandir to use default context + when no context argument is passed. (Sara) - Removed old legacy: . register_globals support. (Pierre) -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/standard dir.c
pollita Mon Oct 2 18:14:43 2006 UTC Modified files: /php-src/ext/standard dir.c Log: Update glob() for PHP6 http://cvs.php.net/viewvc.cgi/php-src/ext/standard/dir.c?r1=1.156r2=1.157diff_format=u Index: php-src/ext/standard/dir.c diff -u php-src/ext/standard/dir.c:1.156 php-src/ext/standard/dir.c:1.157 --- php-src/ext/standard/dir.c:1.156Mon Oct 2 17:45:30 2006 +++ php-src/ext/standard/dir.c Mon Oct 2 18:14:42 2006 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: dir.c,v 1.156 2006/10/02 17:45:30 pollita Exp $ */ +/* $Id: dir.c,v 1.157 2006/10/02 18:14:42 pollita Exp $ */ /* {{{ includes/startup/misc */ @@ -377,7 +377,7 @@ /* }}} */ #ifdef HAVE_GLOB -/* {{{ proto array glob(string pattern [, int flags]) +/* {{{ proto array glob(string pattern [, int flags]) U Find pathnames matching a pattern */ PHP_FUNCTION(glob) { @@ -387,6 +387,7 @@ char work_pattern[MAXPATHLEN]; char *result; #endif + zval **pppattern; char *pattern = NULL; int pattern_len; long flags = 0; @@ -394,8 +395,10 @@ unsigned int n; int ret; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, s|l, pattern, pattern_len, flags) == FAILURE) + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, Z|l, pppattern, flags) == FAILURE || + php_stream_path_param_encode(pppattern, pattern, pattern_len, REPORT_ERRORS, FG(default_context)) == FAILURE) { return; + } #ifdef ZTS if (!IS_ABSOLUTE_PATH(pattern, pattern_len)) { @@ -469,7 +472,20 @@ continue; } } - add_next_index_rt_string(return_value, globbuf.gl_pathv[n]+cwd_skip, 1); + if (UG(unicode)) { + UChar *path; + int path_len; + + if (SUCCESS == php_stream_path_decode(php_plain_files_wrapper, path, path_len, globbuf.gl_pathv[n]+cwd_skip, + strlen(globbuf.gl_pathv[n]+cwd_skip), REPORT_ERRORS, FG(default_context))) { + add_next_index_unicodel(return_value, path, path_len, 0); + } else { + /* Fallback on string version, path_decode will emit warning */ + add_next_index_string(return_value, globbuf.gl_pathv[n]+cwd_skip, 1); + } + } else { + add_next_index_string(return_value, globbuf.gl_pathv[n]+cwd_skip, 1); + } } globfree(globbuf); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/standard proc_open.c
pollita Mon Oct 2 21:02:08 2006 UTC Modified files: /php-src/ext/standard proc_open.c Log: Flag the easy stuff out of the way, proc_open() is the real beast in here http://cvs.php.net/viewvc.cgi/php-src/ext/standard/proc_open.c?r1=1.43r2=1.44diff_format=u Index: php-src/ext/standard/proc_open.c diff -u php-src/ext/standard/proc_open.c:1.43 php-src/ext/standard/proc_open.c:1.44 --- php-src/ext/standard/proc_open.c:1.43 Tue Sep 19 10:38:31 2006 +++ php-src/ext/standard/proc_open.cMon Oct 2 21:02:08 2006 @@ -15,7 +15,7 @@ | Author: Wez Furlong [EMAIL PROTECTED] | +--+ */ -/* $Id: proc_open.c,v 1.43 2006/09/19 10:38:31 dmitry Exp $ */ +/* $Id: proc_open.c,v 1.44 2006/10/02 21:02:08 pollita Exp $ */ #if 0 (defined(__linux__) || defined(sun) || defined(__IRIX__)) # define _BSD_SOURCE /* linux wants this when XOPEN mode is on */ @@ -253,7 +253,7 @@ } /* }}} */ -/* {{{ proto int proc_terminate(resource process [, long signal]) +/* {{{ proto int proc_terminate(resource process [, long signal]) U kill a process opened by proc_open */ PHP_FUNCTION(proc_terminate) { @@ -278,7 +278,7 @@ } /* }}} */ -/* {{{ proto int proc_close(resource process) +/* {{{ proto int proc_close(resource process) U close a process opened by proc_open */ PHP_FUNCTION(proc_close) { @@ -296,7 +296,7 @@ } /* }}} */ -/* {{{ proto array proc_get_status(resource process) +/* {{{ proto array proc_get_status(resource process) U get information about a process opened by proc_open */ PHP_FUNCTION(proc_get_status) { @@ -319,7 +319,19 @@ array_init(return_value); - add_ascii_assoc_string(return_value, command, proc-command, 1); + if (UG(unicode)) { + UChar *ucmd; + int ucmd_len; + + if (SUCCESS == php_stream_path_decode(php_plain_files_wrapper, ucmd, ucmd_len, proc-command, strlen(proc-command), REPORT_ERRORS, FG(default_context))) { + add_ascii_assoc_unicodel(return_value, command, ucmd, ucmd_len, 0); + } else { + /* Fallback on original binary string */ + add_ascii_assoc_string(return_value, command, proc-command, 1); + } + } else { + add_ascii_assoc_string(return_value, command, proc-command, 1); + } add_ascii_assoc_long(return_value, pid, (long) proc-child); #ifdef PHP_WIN32 -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/hash hash.c /ext/hash/tests adler32.phpt crc32.phpt gost.phpt haval.phpt hmac-md5.phpt md2.phpt md4.phpt md5.phpt ripemd128.phpt ripemd160.phpt ripemd256.phpt ripemd320.ph
pollita Mon Oct 2 01:38:06 2006 UTC Modified files: /php-src/ext/hash hash.c /php-src/ext/hash/tests adler32.phpt crc32.phpt gost.phpt haval.phpt hmac-md5.phpt md2.phpt md4.phpt md5.phpt ripemd128.phpt ripemd160.phpt ripemd256.phpt ripemd320.phpt sha1.phpt sha256.phpt sha384.phpt sha512.phpt snefru.phpt tiger.phpt whirlpool.phpt Log: Allow hash()/hash_hmac() to accept ascii-unicode data, Update tests to work in unicode.semantics mode. http://cvs.php.net/viewvc.cgi/php-src/ext/hash/hash.c?r1=1.31r2=1.32diff_format=u Index: php-src/ext/hash/hash.c diff -u php-src/ext/hash/hash.c:1.31 php-src/ext/hash/hash.c:1.32 --- php-src/ext/hash/hash.c:1.31Wed Sep 20 01:48:06 2006 +++ php-src/ext/hash/hash.c Mon Oct 2 01:38:05 2006 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: hash.c,v 1.31 2006/09/20 01:48:06 pollita Exp $ */ +/* $Id: hash.c,v 1.32 2006/10/02 01:38:05 pollita Exp $ */ #ifdef HAVE_CONFIG_H #include config.h @@ -84,9 +84,12 @@ RETURN_FALSE; } } else { - /* Unicode string passed for raw hashing */ - php_error_docref(NULL TSRMLS_CC, E_WARNING, Unicode strings can not be hashed. Convert to a binary type.); - RETURN_FALSE; + data = zend_unicode_to_ascii((UChar*)data, data_len TSRMLS_CC); + if (!data) { + /* Non-ASCII Unicode string passed for raw hashing */ + php_error_docref(NULL TSRMLS_CC, E_WARNING, Binary or ASCII-Unicode string expected, non-ASCII-Unicode string received); + RETURN_FALSE; + } } } #else @@ -94,25 +97,19 @@ return; } #endif + /* Assume failure */ + RETVAL_FALSE; ops = php_hash_fetch_ops(algo, algo_len); if (!ops) { php_error_docref(NULL TSRMLS_CC, E_WARNING, Unknown hashing algorithm: %s, algo); - if (data_type != IS_STRING) { - /* Original filename was UNICODE, this string is a converted copy */ - efree(data); - } - RETURN_FALSE; + goto hash_done; } if (isfilename) { stream = php_stream_open_wrapper_ex(data, rb, REPORT_ERRORS, NULL, DEFAULT_CONTEXT); - if (data_type != IS_STRING) { - /* Original filename was UNICODE, this string is a converted copy */ - efree(data); - } if (!stream) { /* Stream will report errors opening file */ - RETURN_FALSE; + goto hash_done; } } @@ -137,14 +134,27 @@ if (raw_output) { digest[ops-digest_size] = 0; - RETURN_STRINGL(digest, ops-digest_size, 0); + + /* Raw output is binary only */ + RETVAL_STRINGL(digest, ops-digest_size, 0); } else { char *hex_digest = safe_emalloc(ops-digest_size, 2, 1); php_hash_bin2hex(hex_digest, (unsigned char *) digest, ops-digest_size); hex_digest[2 * ops-digest_size] = 0; efree(digest); - RETURN_STRINGL(hex_digest, 2 * ops-digest_size, 0); + + /* hexits can be binary or unicode */ +#if PHP_MAJOR_VERSION = 6 + RETVAL_RT_STRINGL(hex_digest, 2 * ops-digest_size, ZSTR_AUTOFREE); +#else + RETVAL_STRINGL(hex_digest, 2 * ops-digest_size, 0); +#endif + } + +hash_done: + if (data_type != IS_STRING) { + efree(data); } } @@ -168,14 +178,14 @@ { char *algo, *data, *digest, *key, *K; int algo_len, data_len, key_len, i; - zend_uchar data_type = IS_STRING; + zend_uchar data_type = IS_STRING, key_type = IS_STRING; zend_bool raw_output = 0; php_hash_ops *ops; void *context; php_stream *stream = NULL; #if PHP_MAJOR_VERSION = 6 - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, stS|b, algo, algo_len, data, data_len, data_type, key, key_len, raw_output) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, stt|b, algo, algo_len, data, data_len, data_type, key, key_len, key_type, raw_output) == FAILURE) { return; } @@ -185,8 +195,22 @@ RETURN_FALSE; } } else { - /* Unicode string passed for raw hashing */ -
[PHP-CVS] cvs: php-src /ext/standard file.c /main php_streams.h
pollita Mon Oct 2 02:24:29 2006 UTC Modified files: /php-src/main php_streams.h /php-src/ext/standard file.c Log: Try out simplified API for encoding paths/filenames http://cvs.php.net/viewvc.cgi/php-src/main/php_streams.h?r1=1.115r2=1.116diff_format=u Index: php-src/main/php_streams.h diff -u php-src/main/php_streams.h:1.115 php-src/main/php_streams.h:1.116 --- php-src/main/php_streams.h:1.115Sun Sep 24 20:33:14 2006 +++ php-src/main/php_streams.h Mon Oct 2 02:24:29 2006 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: php_streams.h,v 1.115 2006/09/24 20:33:14 pollita Exp $ */ +/* $Id: php_streams.h,v 1.116 2006/10/02 02:24:29 pollita Exp $ */ #ifndef PHP_STREAMS_H #define PHP_STREAMS_H @@ -388,6 +388,61 @@ END_EXTERN_C() +#define php_stream_path_param_encode(ppzval, ppath, ppath_len, options, context) \ + _php_stream_path_param_encode((ppzval), (ppath), (ppath_len), (options), (context) TSRMLS_CC) +static inline int _php_stream_path_param_encode(zval **ppzval, char **ppath, int *ppath_len, int options, php_stream_context *context TSRMLS_DC) +{ + if (Z_TYPE_PP(ppzval) == IS_UNICODE) { + zval *zpath; + char *path; + int path_len; + + /* Convert the path and put it into a fresh new zval */ + if (FAILURE == php_stream_path_encode(NULL, path, path_len, Z_USTRVAL_PP(ppzval), Z_USTRLEN_PP(ppzval), options, context)) { + return FAILURE; + } + MAKE_STD_ZVAL(zpath); + ZVAL_STRINGL(zpath, path, path_len, 0); + zpath-is_ref = 0; + zpath-refcount = 1; + + /* Replace the param stack with the new zval */ + zval_ptr_dtor(ppzval); + *ppzval = zpath; + } else if (Z_TYPE_PP(ppzval) != IS_STRING) { + if ((*ppzval)-is_ref || + (*ppzval)-refcount 1) { + zval *zpath; + + /* Produce a new zval of type string */ + MAKE_STD_ZVAL(zpath); + *zpath = **ppzval; + zval_copy_ctor(zpath); + convert_to_string(zpath); + zpath-is_ref = 0; + zpath-refcount = 1; + + /* Replace the param stack with it */ + zval_ptr_dtor(ppzval); + *ppzval = zpath; + } else { + /* Convert the value on the param stack directly */ + convert_to_string(*ppzval); + } + } + + /* Populate convenience params if requested */ + if (ppath) { + *ppath = Z_STRVAL_PP(ppzval); + } + if (ppath_len) { + *ppath_len = Z_STRLEN_PP(ppzval); + } + + return SUCCESS; +} + + /* Flags for mkdir method in wrapper ops */ #define PHP_STREAM_MKDIR_RECURSIVE 1 /* define REPORT ERRORS 8 (below) */ http://cvs.php.net/viewvc.cgi/php-src/ext/standard/file.c?r1=1.457r2=1.458diff_format=u Index: php-src/ext/standard/file.c diff -u php-src/ext/standard/file.c:1.457 php-src/ext/standard/file.c:1.458 --- php-src/ext/standard/file.c:1.457 Sun Sep 24 21:40:44 2006 +++ php-src/ext/standard/file.c Mon Oct 2 02:24:29 2006 @@ -21,7 +21,7 @@ +--+ */ -/* $Id: file.c,v 1.457 2006/09/24 21:40:44 pollita Exp $ */ +/* $Id: file.c,v 1.458 2006/10/02 02:24:29 pollita Exp $ */ /* Synced with php 3.0 revision 1.218 1999-06-16 [ssb] */ @@ -1016,30 +1016,25 @@ Open a file or a URL and return a file pointer */ PHP_NAMED_FUNCTION(php_if_fopen) { + zval **ppfilename; char *filename, *mode; int filename_len, mode_len; - zend_uchar filename_type; zend_bool use_include_path = 0; zval *zcontext = NULL; php_stream *stream; php_stream_context *context = NULL; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, ts|br, filename, filename_len, filename_type, - mode, mode_len, use_include_path, zcontext) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, Zs|br, ppfilename, mode, mode_len, use_include_path, zcontext) == FAILURE) { RETURN_FALSE; } context = php_stream_context_from_zval(zcontext, 0); - if (filename_type == IS_UNICODE) { - if (php_stream_path_encode(NULL, filename, filename_len, (UChar*)filename, filename_len, REPORT_ERRORS, context) == FAILURE) { - RETURN_FALSE; - } + if (FAILURE == php_stream_path_param_encode(ppfilename, filename, filename_len, REPORT_ERRORS, context)) { + RETURN_FALSE; } + stream =
[PHP-CVS] cvs: php-src /ext/standard file.c
pollita Mon Oct 2 02:47:34 2006 UTC Modified files: /php-src/ext/standard file.c Log: Apply simplified path encoding to copy() and give it a context param. Funnily enough, this makes the copy() implementation almost identical to what it was back in PHP5. http://cvs.php.net/viewvc.cgi/php-src/ext/standard/file.c?r1=1.458r2=1.459diff_format=u Index: php-src/ext/standard/file.c diff -u php-src/ext/standard/file.c:1.458 php-src/ext/standard/file.c:1.459 --- php-src/ext/standard/file.c:1.458 Mon Oct 2 02:24:29 2006 +++ php-src/ext/standard/file.c Mon Oct 2 02:47:34 2006 @@ -21,7 +21,7 @@ +--+ */ -/* $Id: file.c,v 1.458 2006/10/02 02:24:29 pollita Exp $ */ +/* $Id: file.c,v 1.459 2006/10/02 02:47:34 pollita Exp $ */ /* Synced with php 3.0 revision 1.218 1999-06-16 [ssb] */ @@ -1881,49 +1881,28 @@ } /* }}} */ -/* {{{ proto bool copy(string source_file, string destination_file) U +/* {{{ proto bool copy(string source_file, string destination_file[, resource context]) U Copy a file */ PHP_FUNCTION(copy) { - char *source, *dest; - int source_len, dest_len; - zend_uchar source_type, dest_type; - zend_uchar free_source = 0, free_dest = 0; + zval **source, **target, *zcontext = NULL; + php_stream_context *context; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, tt, source, source_len, source_type, dest, dest_len, dest_type) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, ZZ|r, source, target, zcontext) == FAILURE) { return; } - /* Assume failure until success is known */ - RETVAL_FALSE; - - if (source_type == IS_UNICODE) { - if (FAILURE == php_stream_path_encode(NULL, source, source_len, (UChar*)source, source_len, REPORT_ERRORS, FG(default_context))) { - goto copy_cleanup; - } - free_source = 1; - } - if (dest_type == IS_UNICODE) { - if (FAILURE == php_stream_path_encode(NULL, dest, dest_len, (UChar*)dest, dest_len, REPORT_ERRORS, FG(default_context))) { - goto copy_cleanup; - } - free_dest = 1; - } - - if (php_check_open_basedir(source TSRMLS_CC)) { - goto copy_cleanup; - } - - if (php_copy_file(source, dest TSRMLS_CC) == SUCCESS) { - RETVAL_TRUE; + context = php_stream_context_from_zval(zcontext, 0); + if (FAILURE == php_stream_path_param_encode(source, NULL, NULL, REPORT_ERRORS, context) || + FAILURE == php_stream_path_param_encode(target, NULL, NULL, REPORT_ERRORS, context) || + 0 != php_check_open_basedir(Z_STRVAL_PP(source) TSRMLS_CC)) { + RETURN_FALSE; } -copy_cleanup: - if (free_source) { - efree(source); - } - if (free_dest) { - efree(dest); + if (php_copy_file(Z_STRVAL_PP(source), Z_STRVAL_PP(target) TSRMLS_CC)==SUCCESS) { + RETURN_TRUE; + } else { + RETURN_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 file.c
pollita Mon Oct 2 03:13:47 2006 UTC Modified files: /php-src/ext/standard file.c Log: Apply new path encoding style to the rest of e/s/file.c This layout is definately simpler to maintain and every bit as functional as the other version. http://cvs.php.net/viewvc.cgi/php-src/ext/standard/file.c?r1=1.459r2=1.460diff_format=u Index: php-src/ext/standard/file.c diff -u php-src/ext/standard/file.c:1.459 php-src/ext/standard/file.c:1.460 --- php-src/ext/standard/file.c:1.459 Mon Oct 2 02:47:34 2006 +++ php-src/ext/standard/file.c Mon Oct 2 03:13:47 2006 @@ -21,7 +21,7 @@ +--+ */ -/* $Id: file.c,v 1.459 2006/10/02 02:47:34 pollita Exp $ */ +/* $Id: file.c,v 1.460 2006/10/02 03:13:47 pollita Exp $ */ /* Synced with php 3.0 revision 1.218 1999-06-16 [ssb] */ @@ -358,9 +358,9 @@ PHP_FUNCTION(get_meta_tags) { + zval **ppfilename; char *filename; int filename_len; - zend_uchar filename_type; zend_bool use_include_path = 0; int in_tag = 0, done = 0; int looking_for_val = 0, have_name = 0, have_content = 0; @@ -373,22 +373,14 @@ memset(md, 0, sizeof(md)); /* Parse arguments */ - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, t|b, - filename, filename_len, filename_type, use_include_path) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, Z|b, ppfilename, use_include_path) == FAILURE || + php_stream_path_param_encode(ppfilename, filename, filename_len, REPORT_ERRORS, FG(default_context)) == FAILURE) { return; } - if (filename_type == IS_UNICODE) { - if (php_stream_path_encode(NULL, filename, filename_len, (UChar*)filename, filename_len, REPORT_ERRORS, FG(default_context)) == FAILURE) { - RETURN_FALSE; - } - } md.stream = php_stream_open_wrapper(filename, rt, (use_include_path ? USE_PATH : 0) | REPORT_ERRORS, NULL); - if (filename_type == IS_UNICODE) { - efree(filename); - } if (!md.stream) { RETURN_FALSE; } @@ -534,9 +526,9 @@ Read the entire file into a string */ PHP_FUNCTION(file_get_contents) { + zval **ppfilename; char *filename; int filename_len; - zend_uchar filename_type; void *contents = NULL; long flags = 0; php_stream *stream; @@ -547,24 +539,18 @@ php_stream_context *context = NULL; /* Parse arguments */ - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, t|lr!ll, - filename, filename_len, filename_type, flags, zcontext, offset, maxlen) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, Z|lr!ll, ppfilename, flags, zcontext, offset, maxlen) == FAILURE) { return; } context = php_stream_context_from_zval(zcontext, 0); - if (filename_type == IS_UNICODE) { - if (php_stream_path_encode(NULL, filename, filename_len, (UChar*)filename, filename_len, REPORT_ERRORS, context) == FAILURE) { - RETURN_FALSE; - } + if (php_stream_path_param_encode(ppfilename, filename, filename_len, REPORT_ERRORS, context) == FAILURE) { + RETURN_FALSE; } stream = php_stream_open_wrapper_ex(filename, (flags PHP_FILE_TEXT) ? rt : rb, ((flags PHP_FILE_USE_INCLUDE_PATH) ? USE_PATH : 0) | REPORT_ERRORS, NULL, context); - if (filename_type == IS_UNICODE) { - efree(filename); - } if (!stream) { RETURN_FALSE; } @@ -616,9 +602,9 @@ { int argc = ZEND_NUM_ARGS(); php_stream *stream; + zval **ppfilename; char *filename; int filename_len; - zend_uchar filename_type; zval *data; int numchars = 0; long flags = ((argc 3) UG(unicode)) ? PHP_FILE_TEXT : 0; @@ -627,8 +613,7 @@ char mode[3] = { 'w', 0, 0 }; php_stream *srcstream = NULL; - if (zend_parse_parameters(argc TSRMLS_CC, tz/|lr!, filename, filename_len, filename_type, - data, flags, zcontext) == FAILURE) { + if (zend_parse_parameters(argc TSRMLS_CC, Zz/|lr!, ppfilename, data, flags, zcontext) == FAILURE) { return; } @@ -637,6 +622,9 @@ } context = php_stream_context_from_zval(zcontext, flags PHP_FILE_NO_DEFAULT_CONTEXT); + if (php_stream_path_param_encode(ppfilename, filename, filename_len, REPORT_ERRORS, context) == FAILURE) { + RETURN_FALSE; + } if (flags PHP_FILE_APPEND)
[PHP-CVS] cvs: php-src / NEWS
pollita Mon Oct 2 03:17:48 2006 UTC Modified files: /php-srcNEWS Log: Note context parameter in copy() function and group streams related additions http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2123r2=1.2124diff_format=u Index: php-src/NEWS diff -u php-src/NEWS:1.2123 php-src/NEWS:1.2124 --- php-src/NEWS:1.2123 Sat Sep 9 21:24:27 2006 +++ php-src/NEWSMon Oct 2 03:17:48 2006 @@ -36,18 +36,20 @@ - Added automatic module globals management. (Dmitry) - Added jump label operator (limited goto). (Dmitry, Sara) - Added E_STRICT to E_ALL. (Dmitry) -- Added allow_url_include ini option to be able to turn off remote url - code execution separately from the allow_url_fopen setting. (Rasmus) - Added --rclass and --rextension CLI parameters to reflect internal classes and loaded extensions. (Johannes) - Added an optional parameter to strstr() and stristr() for retrieval of either the part of haystack before or after first occurence of needle. (Johannes) - Added possibility to check in which extension an internal function was defined using reflection API. (Johannes) -- Added second optional parameter to stream_context_create() to set params - during context creation. (Sara) -- Added sys_get_temp_dir() function that returns the default directory for - temporary files (as requested in bug #35380). (Hartmut) +- Added streams features: + . Context parameter for copy() function. (Sara) + . allow_url_include ini option to be able to turn off remote url +code execution separately from the allow_url_fopen setting. (Rasmus) + . Second optional parameter to stream_context_create() to +set params during context creation. (Sara) + . sys_get_temp_dir() function that returns the default directory +for temporary files (as requested in bug #35380). (Hartmut) - Fixed bug #36630 (umask not reset at the end of the request). (Ilia) - Fixed bug #34286 (__toString() behavior is inconsistent). (Marcus) -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/standard exec.c
pollita Sun Sep 24 17:03:58 2006 UTC Modified files: /php-src/ext/standard exec.c Log: PHP6 Updates http://cvs.php.net/viewvc.cgi/php-src/ext/standard/exec.c?r1=1.120r2=1.121diff_format=u Index: php-src/ext/standard/exec.c diff -u php-src/ext/standard/exec.c:1.120 php-src/ext/standard/exec.c:1.121 --- php-src/ext/standard/exec.c:1.120 Sun Jun 11 20:33:29 2006 +++ php-src/ext/standard/exec.c Sun Sep 24 17:03:58 2006 @@ -16,7 +16,7 @@ | Ilia Alshanetsky [EMAIL PROTECTED] | +--+ */ -/* $Id: exec.c,v 1.120 2006/06/11 20:33:29 bjori Exp $ */ +/* $Id: exec.c,v 1.121 2006/09/24 17:03:58 pollita Exp $ */ #include stdio.h #include php.h @@ -55,6 +55,7 @@ * If type==2, all lines will be saved to given array (exec with $array) * If type==3, output will be printed binary, no lines will be saved or returned (passthru) * + * Unicode command strings are encoding using filesystem_encoding, returned data is not decoded back to unicode */ int php_exec(int type, char *cmd, zval *array, zval *return_value TSRMLS_DC) { @@ -168,15 +169,16 @@ { char *cmd; int cmd_len; + zend_uchar cmd_type; zval *ret_code=NULL, *ret_array=NULL; int ret; if (mode) { - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, s|z/, cmd, cmd_len, ret_code) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, t|z/, cmd, cmd_len, cmd_type, ret_code) == FAILURE) { RETURN_FALSE; } } else { - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, s|z/z/, cmd, cmd_len, ret_array, ret_code) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, t|z/z/, cmd, cmd_len, cmd_type, ret_array, ret_code) == FAILURE) { RETURN_FALSE; } } @@ -185,6 +187,12 @@ RETURN_FALSE; } + if (cmd_type == IS_UNICODE) { + if (FAILURE == php_stream_path_encode(NULL, cmd, cmd_len, (UChar*)cmd, cmd_len, REPORT_ERRORS, FG(default_context))) { + RETURN_FALSE; + } + } + if (!ret_array) { ret = php_exec(mode, cmd, NULL, return_value TSRMLS_CC); } else { @@ -198,9 +206,13 @@ zval_dtor(ret_code); ZVAL_LONG(ret_code, ret); } + + if (cmd_type == IS_UNICODE) { + efree(cmd); + } } -/* {{{ proto string exec(string command [, array output [, int return_value]]) +/* {{{ proto string exec(string command [, array output [, int return_value]]) U Execute an external program */ PHP_FUNCTION(exec) { @@ -209,7 +221,7 @@ /* }}} */ -/* {{{ proto int system(string command [, int return_value]) +/* {{{ proto int system(string command [, int return_value]) U Execute an external program and display output */ PHP_FUNCTION(system) { @@ -217,7 +229,7 @@ } /* }}} */ -/* {{{ proto void passthru(string command [, int return_value]) +/* {{{ proto void passthru(string command [, int return_value]) U Execute an external program and display raw output */ PHP_FUNCTION(passthru) { @@ -235,11 +247,11 @@ *NOT* safe for binary strings */ char *php_escape_shell_cmd(char *str) { - register int x, y, l; + register int x, y, l = strlen(str); char *cmd; char *p = NULL; + size_t estimate = (2 * l) + 1; - l = strlen(str); cmd = safe_emalloc(2, l, 1); for (x = 0, y = 0; x l; x++) { @@ -292,6 +304,13 @@ } } cmd[y] = '\0'; + + if ((estimate - y) 4096) { + /* realloc if the estimate was way overill +* Arbitrary cutoff point of 4096 */ + cmd = erealloc(cmd, y + 1); + } + return cmd; } /* }}} */ @@ -299,12 +318,10 @@ /* {{{ php_escape_shell_arg */ char *php_escape_shell_arg(char *str) { - int x, y, l; + int x, y = 0, l = strlen(str); char *cmd; + size_t estimate = (4 * l) + 3; - y = 0; - l = strlen(str); - cmd = safe_emalloc(4, l, 3); /* worst case */ #ifdef PHP_WIN32 @@ -337,71 +354,106 @@ cmd[y++] = '\''; #endif cmd[y] = '\0'; + + if ((estimate - y) 4096) { + /* realloc if the estimate was way overill +* Arbitrary cutoff point of 4096 */ + cmd = erealloc(cmd, y + 1); + } return cmd; } /* }}} */ -/* {{{ proto string escapeshellcmd(string command) +/* {{{ proto string escapeshellcmd(string command) U Escape shell metacharacters */ PHP_FUNCTION(escapeshellcmd) { - zval **arg1; + char *command; + int command_len; + zend_uchar command_type; char *cmd = NULL; -
[PHP-CVS] cvs: php-src /ext/standard md5.c sha1.c
pollita Sun Sep 24 17:09:46 2006 UTC Modified files: /php-src/ext/standard md5.c sha1.c Log: PHP6 Updates http://cvs.php.net/viewvc.cgi/php-src/ext/standard/md5.c?r1=1.46r2=1.47diff_format=u Index: php-src/ext/standard/md5.c diff -u php-src/ext/standard/md5.c:1.46 php-src/ext/standard/md5.c:1.47 --- php-src/ext/standard/md5.c:1.46 Thu Mar 2 13:12:45 2006 +++ php-src/ext/standard/md5.c Sun Sep 24 17:09:46 2006 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: md5.c,v 1.46 2006/03/02 13:12:45 dmitry Exp $ */ +/* $Id: md5.c,v 1.47 2006/09/24 17:09:46 pollita Exp $ */ /* * md5.c - Copyright 1997 Lachlan Roche @@ -38,7 +38,7 @@ *md5str = '\0'; } -/* {{{ proto string md5(string str, [ bool raw_output]) +/* {{{ proto string md5(string str, [ bool raw_output]) U Calculate the md5 hash of a string */ PHP_NAMED_FUNCTION(php_if_md5) { @@ -49,7 +49,7 @@ PHP_MD5_CTX context; unsigned char digest[16]; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, s|b, arg, arg_len, raw_output) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, S|b, arg, arg_len, raw_output) == FAILURE) { return; } @@ -61,13 +61,13 @@ RETURN_STRINGL((char*)digest, 16, 1); } else { make_digest(md5str, digest); - RETVAL_ASCII_STRING(md5str, 1); + RETVAL_ASCII_STRING(md5str, ZSTR_DUPLICATE); } } /* }}} */ -/* {{{ proto string md5_file(string filename [, bool raw_output]) +/* {{{ proto string md5_file(string filename [, bool raw_output]) U Calculate the md5 hash of given filename */ PHP_NAMED_FUNCTION(php_if_md5_file) { @@ -81,7 +81,7 @@ int n; php_stream*stream; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, s|b, arg, arg_len, raw_output) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, S|b, arg, arg_len, raw_output) == FAILURE) { return; } @@ -108,7 +108,7 @@ RETURN_STRINGL((char*)digest, 16, 1); } else { make_digest(md5str, digest); - RETVAL_ASCII_STRING(md5str, 1); + RETVAL_ASCII_STRING(md5str, ZSTR_DUPLICATE); } } /* }}} */ http://cvs.php.net/viewvc.cgi/php-src/ext/standard/sha1.c?r1=1.17r2=1.18diff_format=u Index: php-src/ext/standard/sha1.c diff -u php-src/ext/standard/sha1.c:1.17 php-src/ext/standard/sha1.c:1.18 --- php-src/ext/standard/sha1.c:1.17Thu Mar 2 13:12:45 2006 +++ php-src/ext/standard/sha1.c Sun Sep 24 17:09:46 2006 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: sha1.c,v 1.17 2006/03/02 13:12:45 dmitry Exp $ */ +/* $Id: sha1.c,v 1.18 2006/09/24 17:09:46 pollita Exp $ */ #include php.h @@ -36,7 +36,7 @@ *sha1str = '\0'; } -/* {{{ proto string sha1(string str [, bool raw_output]) +/* {{{ proto string sha1(string str [, bool raw_output]) U Calculate the sha1 hash of a string */ PHP_FUNCTION(sha1) { @@ -47,7 +47,7 @@ PHP_SHA1_CTX context; unsigned char digest[20]; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, s|b, arg, arg_len, raw_output) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, S|b, arg, arg_len, raw_output) == FAILURE) { return; } @@ -59,7 +59,7 @@ RETURN_STRINGL((char*)digest, 20, 1); } else { make_sha1_digest(sha1str, digest); - RETVAL_ASCII_STRING(sha1str, 1); + RETVAL_ASCII_STRING(sha1str, ZSTR_DUPLICATE); } } @@ -67,7 +67,7 @@ /* }}} */ -/* {{{ proto string sha1_file(string filename [, bool raw_output]) +/* {{{ proto string sha1_file(string filename [, bool raw_output]) U Calculate the sha1 hash of given filename */ PHP_FUNCTION(sha1_file) { @@ -81,7 +81,7 @@ int n; php_stream*stream; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, s|b, arg, arg_len, raw_output) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, S|b, arg, arg_len, raw_output) == FAILURE) { return; } @@ -108,7 +108,7 @@ RETURN_STRINGL((char*)digest, 20, 1); } else { make_sha1_digest(sha1str, digest); - RETVAL_ASCII_STRING(sha1str, 1); + RETVAL_ASCII_STRING(sha1str, ZSTR_DUPLICATE); } } /* }}} */ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/standard type.c
pollita Sun Sep 24 18:23:47 2006 UTC Modified files: /php-src/ext/standard type.c Log: PHP6 Updates http://cvs.php.net/viewvc.cgi/php-src/ext/standard/type.c?r1=1.42r2=1.43diff_format=u Index: php-src/ext/standard/type.c diff -u php-src/ext/standard/type.c:1.42 php-src/ext/standard/type.c:1.43 --- php-src/ext/standard/type.c:1.42Fri Mar 17 23:00:20 2006 +++ php-src/ext/standard/type.c Sun Sep 24 18:23:47 2006 @@ -16,12 +16,12 @@ +--+ */ -/* $Id: type.c,v 1.42 2006/03/17 23:00:20 andrei Exp $ */ +/* $Id: type.c,v 1.43 2006/09/24 18:23:47 pollita Exp $ */ #include php.h #include php_incomplete_class.h -/* {{{ proto string gettype(mixed var) +/* {{{ proto string gettype(mixed var) U Returns the type of the variable */ PHP_FUNCTION(gettype) { @@ -91,7 +91,7 @@ } /* }}} */ -/* {{{ proto bool settype(mixed var, string type) +/* {{{ proto bool settype(mixed var, string type) U Set the type of the variable */ PHP_FUNCTION(settype) { @@ -115,6 +115,8 @@ convert_to_double(*var); } else if (!strcasecmp(new_type, string)) { convert_to_string(*var); + } else if (!strcasecmp(new_type, unicode)) { + convert_to_unicode(*var); } else if (!strcasecmp(new_type, array)) { convert_to_array(*var); } else if (!strcasecmp(new_type, object)) { @@ -136,7 +138,7 @@ } /* }}} */ -/* {{{ proto int intval(mixed var [, int base]) +/* {{{ proto int intval(mixed var [, int base]) U Get the integer value of a variable using the optional base for the conversion */ PHP_FUNCTION(intval) { @@ -168,22 +170,21 @@ } /* }}} */ -/* {{{ proto float floatval(mixed var) +/* {{{ proto float floatval(mixed var) U Get the float value of a variable */ PHP_FUNCTION(floatval) { - zval **num; + double retval; - if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, num) == FAILURE) { - WRONG_PARAM_COUNT; + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, d, retval) == FAILURE) { + return; } - RETVAL_ZVAL(*num, 1, 0); - convert_to_double(return_value); + RETURN_DOUBLE(retval); } /* }}} */ -/* {{{ proto string strval(mixed var) +/* {{{ proto string strval(mixed var) U Get the string value of a variable */ PHP_FUNCTION(strval) { @@ -211,29 +212,41 @@ static void php_is_type(INTERNAL_FUNCTION_PARAMETERS, int type) { - zval **arg; + zval *arg; - if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, arg) == FAILURE) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, Only one argument expected); - RETURN_FALSE; + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, z, arg) == FAILURE) { + return; } - if (Z_TYPE_PP(arg) == type) { + if (Z_TYPE_P(arg) == type) { if (type == IS_OBJECT) { zend_class_entry *ce; - if(Z_OBJ_HT_PP(arg)-get_class_entry == NULL) { - /* if there's no get_class_entry it's not a PHP object, so it can't be INCOMPLETE_CLASS */ + + if(Z_OBJ_HT_P(arg)-get_class_entry == NULL) { + /* if there's no get_class_entry it's not a PHP object, so it can't be INCOMPLETE_CLASS */ RETURN_TRUE; } - ce = Z_OBJCE_PP(arg); - /* FIXME: Unicode support??? */ - if (!strcmp(ce-name.s, INCOMPLETE_CLASS)) { - RETURN_FALSE; + ce = Z_OBJCE_P(arg); + + if (ce-name_length != sizeof(INCOMPLETE_CLASS) - 1) { + /* We can get away with this because INCOMPLETE_CLASS is ascii and has a 1:1 relationship with unicode */ + RETURN_TRUE; + } else if (UG(unicode)) { + U_STRING_DECL(uIncompleteClass, INCOMPLETE_CLASS, sizeof(INCOMPLETE_CLASS) - 1); + U_STRING_INIT(uIncompleteClass, INCOMPLETE_CLASS, sizeof(INCOMPLETE_CLASS) - 1); + + if (!memcmp(ce-name.u, uIncompleteClass, UBYTES(sizeof(INCOMPLETE_CLASS { + RETURN_FALSE; + } + } else { + if (!memcmp(ce-name.s, INCOMPLETE_CLASS, sizeof(INCOMPLETE_CLASS))) { + RETURN_FALSE; + } } } if (type == IS_RESOURCE) { char *type_name; - type_name = zend_rsrc_list_get_rsrc_type(Z_LVAL_PP(arg) TSRMLS_CC); +
[PHP-CVS] cvs: php-src /ext/standard file.c
pollita Sun Sep 24 20:01:29 2006 UTC Modified files: /php-src/ext/standard file.c Log: PHP6 Update for get_meta_tags() -- What a silly function... http://cvs.php.net/viewvc.cgi/php-src/ext/standard/file.c?r1=1.454r2=1.455diff_format=u Index: php-src/ext/standard/file.c diff -u php-src/ext/standard/file.c:1.454 php-src/ext/standard/file.c:1.455 --- php-src/ext/standard/file.c:1.454 Fri Sep 22 21:48:33 2006 +++ php-src/ext/standard/file.c Sun Sep 24 20:01:29 2006 @@ -21,7 +21,7 @@ +--+ */ -/* $Id: file.c,v 1.454 2006/09/22 21:48:33 pollita Exp $ */ +/* $Id: file.c,v 1.455 2006/09/24 20:01:29 pollita Exp $ */ /* Synced with php 3.0 revision 1.218 1999-06-16 [ssb] */ @@ -353,7 +353,7 @@ #define PHP_META_UNSAFE .\\+*?[^]$() -/* {{{ proto array get_meta_tags(string filename [, bool use_include_path]) +/* {{{ proto array get_meta_tags(string filename [, bool use_include_path]) U Extracts all meta tag content attributes from a file and returns an array */ PHP_FUNCTION(get_meta_tags) @@ -383,7 +383,7 @@ RETURN_FALSE; } } - md.stream = php_stream_open_wrapper(filename, rb, + md.stream = php_stream_open_wrapper(filename, rt, (use_include_path ? USE_PATH : 0) | REPORT_ERRORS, NULL); if (filename_type == IS_UNICODE) { @@ -393,6 +393,31 @@ RETURN_FALSE; } + if (md.stream-readbuf_type == IS_UNICODE) { + /* Either stream auto-applied encoding (which http:// wrapper does do) +* Or the streams layer unicodified it for us */ + zval *filterparams; + php_stream_filter *filter; + + /* Be lazy and convert contents to utf8 again +* This could be made more efficient by detecting if +* it's being upconverted from utf8 and cancelling all conversion +* rather than reconverting, but this is a silly function anyway */ + + MAKE_STD_ZVAL(filterparams); + array_init(filterparams); + add_ascii_assoc_long(filterparams, error_mode, UG(from_error_mode)); + add_ascii_assoc_unicode(filterparams, subst_char, UG(from_subst_char), 1); + filter = php_stream_filter_create(unicode.to.utf8, filterparams, 0 TSRMLS_CC); + zval_ptr_dtor(filterparams); + + if (!filter) { + php_stream_close(md.stream); + RETURN_FALSE; + } + php_stream_filter_append(md.stream-readfilters, filter); + } + array_init(return_value); tok_last = TOK_EOF; @@ -473,9 +498,9 @@ /* For BC */ php_strtolower(name, strlen(name)); if (have_content) { - add_assoc_string(return_value, name, value, 0); + add_assoc_utf8_string(return_value, name, value, 0); } else { - add_assoc_string(return_value, name, , 1); + add_assoc_utf8_string(return_value, name, , 1); } efree(name); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/standard file.c /main php_streams.h /main/streams plain_wrapper.c streams.c
pollita Sun Sep 24 20:33:14 2006 UTC Modified files: /php-src/main php_streams.h /php-src/main/streams streams.c plain_wrapper.c /php-src/ext/standard file.c Log: PHP6 Updates for popen() and related functionality http://cvs.php.net/viewvc.cgi/php-src/main/php_streams.h?r1=1.114r2=1.115diff_format=u Index: php-src/main/php_streams.h diff -u php-src/main/php_streams.h:1.114 php-src/main/php_streams.h:1.115 --- php-src/main/php_streams.h:1.114Fri Sep 22 19:54:30 2006 +++ php-src/main/php_streams.h Sun Sep 24 20:33:14 2006 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: php_streams.h,v 1.114 2006/09/22 19:54:30 pollita Exp $ */ +/* $Id: php_streams.h,v 1.115 2006/09/24 20:33:14 pollita Exp $ */ #ifndef PHP_STREAMS_H #define PHP_STREAMS_H @@ -561,6 +561,7 @@ PHPAPI int php_unregister_url_stream_wrapper(char *protocol TSRMLS_DC); PHPAPI int php_register_url_stream_wrapper_volatile(char *protocol, php_stream_wrapper *wrapper TSRMLS_DC); PHPAPI int php_unregister_url_stream_wrapper_volatile(char *protocol TSRMLS_DC); +PHPAPI void php_stream_fix_encoding(php_stream *stream, const char *mode, php_stream_context *context TSRMLS_DC); PHPAPI php_stream *_php_stream_open_wrapper_ex(char *path, char *mode, int options, char **opened_path, php_stream_context *context STREAMS_DC TSRMLS_DC); PHPAPI php_stream_wrapper *php_stream_locate_url_wrapper(const char *path, char **path_for_open, int options TSRMLS_DC); PHPAPI void *php_stream_locate_eol(php_stream *stream, zstr zbuf, int buf_len TSRMLS_DC); http://cvs.php.net/viewvc.cgi/php-src/main/streams/streams.c?r1=1.136r2=1.137diff_format=u Index: php-src/main/streams/streams.c diff -u php-src/main/streams/streams.c:1.136 php-src/main/streams/streams.c:1.137 --- php-src/main/streams/streams.c:1.136Fri Sep 22 19:54:30 2006 +++ php-src/main/streams/streams.c Sun Sep 24 20:33:14 2006 @@ -19,7 +19,7 @@ +--+ */ -/* $Id: streams.c,v 1.136 2006/09/22 19:54:30 pollita Exp $ */ +/* $Id: streams.c,v 1.137 2006/09/24 20:33:14 pollita Exp $ */ #define _GNU_SOURCE #include php.h @@ -2285,6 +2285,32 @@ } /* }}} */ +/* {{{ php_stream_fix_encoding + * Sets read/write encoding on a stream based on the fopen mode, context options, and INI setting */ +PHPAPI void php_stream_fix_encoding(php_stream *stream, const char *mode, php_stream_context *context TSRMLS_DC) +{ + /* Output encoding on text mode streams defaults to utf8 unless specified in context parameter */ + if (stream strchr(mode, 't') UG(unicode)) { + /* Only apply implicit unicode.to. filter if the wrapper didn't do it for us */ + if ((php_stream_filter_product(stream-writefilters, IS_UNICODE) == IS_UNICODE) + (strchr(mode, 'w') || strchr(mode, 'a') || strchr(mode, '+'))) { + char *encoding = (context context-output_encoding) ? context-output_encoding : UG(stream_encoding); + + /* UTODO: (Maybe?) Allow overriding the default error handlers on a per-stream basis via context params */ + php_stream_encoding_apply(stream, 1, encoding, UG(from_error_mode), UG(from_subst_char)); + } + + /* Only apply implicit unicode.from. filter if the wrapper didn't do it for us */ + if ((stream-readbuf_type == IS_STRING) (strchr(mode, 'r') || strchr(mode, '+'))) { + char *encoding = (context context-input_encoding) ? context-input_encoding : UG(stream_encoding); + + /* UTODO: (Maybe?) Allow overriding the default error handlers on a per-stream basis via context params */ + php_stream_encoding_apply(stream, 0, encoding, UG(to_error_mode), NULL); + } + } +} +/* }}} */ + /* {{{ php_stream_open_wrapper_ex */ PHPAPI php_stream *_php_stream_open_wrapper_ex(char *path, char *mode, int options, char **opened_path, php_stream_context *context STREAMS_DC TSRMLS_DC) @@ -2387,25 +2413,8 @@ } } - /* Output encoding on text mode streams defaults to utf8 unless specified in context parameter */ - if (stream strchr(implicit_mode, 't') UG(unicode)) { - /* Only apply implicit unicode.to. filter if the wrapper didn't do it for us */ - if ((php_stream_filter_product(stream-writefilters, IS_UNICODE) == IS_UNICODE) - (strchr(implicit_mode, 'w') || strchr(implicit_mode, 'a') || strchr(implicit_mode, '+'))) { - char *encoding = (context context-output_encoding) ? context-output_encoding : UG(stream_encoding); - /* UTODO: (Maybe?) Allow overriding the default error handlers on a per-stream basis via
[PHP-CVS] cvs: php-src /ext/standard file.c
pollita Sun Sep 24 21:40:45 2006 UTC Modified files: /php-src/ext/standard file.c Log: PHP6 Updates for rmdir/mkdir/rename http://cvs.php.net/viewvc.cgi/php-src/ext/standard/file.c?r1=1.456r2=1.457diff_format=u Index: php-src/ext/standard/file.c diff -u php-src/ext/standard/file.c:1.456 php-src/ext/standard/file.c:1.457 --- php-src/ext/standard/file.c:1.456 Sun Sep 24 20:33:14 2006 +++ php-src/ext/standard/file.c Sun Sep 24 21:40:44 2006 @@ -21,7 +21,7 @@ +--+ */ -/* $Id: file.c,v 1.456 2006/09/24 20:33:14 pollita Exp $ */ +/* $Id: file.c,v 1.457 2006/09/24 21:40:44 pollita Exp $ */ /* Synced with php 3.0 revision 1.218 1999-06-16 [ssb] */ @@ -1485,6 +1485,7 @@ /* {{{ php_mkdir */ +/* DEPRECATED APIs: Use php_stream_mkdir() instead */ PHPAPI int php_mkdir_ex(char *dir, long mode, int options TSRMLS_DC) { int ret; @@ -1506,43 +1507,65 @@ } /* }}} */ -/* {{{ proto bool mkdir(string pathname [, int mode [, bool recursive [, resource context]]]) +/* {{{ proto bool mkdir(string pathname [, int mode [, bool recursive [, resource context]]]) U Create a directory */ PHP_FUNCTION(mkdir) { + char *dir; + int dir_len; + zend_uchar dir_type; zval *zcontext = NULL; long mode = 0777; - int dir_len; zend_bool recursive = 0; - char *dir; php_stream_context *context; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, s|lbr, dir, dir_len, mode, recursive, zcontext) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, t|lbr, dir, dir_len, dir_type, mode, recursive, zcontext) == FAILURE) { RETURN_FALSE; } context = php_stream_context_from_zval(zcontext, 0); - RETURN_BOOL(php_stream_mkdir(dir, mode, (recursive ? PHP_STREAM_MKDIR_RECURSIVE : 0) | REPORT_ERRORS, context)); + if (dir_type == IS_UNICODE) { + if (FAILURE == php_stream_path_encode(NULL, dir, dir_len, (UChar*)dir, dir_len, REPORT_ERRORS, context)) { + RETURN_FALSE; + } + } + + RETVAL_BOOL(php_stream_mkdir(dir, mode, (recursive ? PHP_STREAM_MKDIR_RECURSIVE : 0) | REPORT_ERRORS, context)); + + if (dir_type == IS_UNICODE) { + efree(dir); + } } /* }}} */ -/* {{{ proto bool rmdir(string dirname[, resource context]) +/* {{{ proto bool rmdir(string dirname[, resource context]) U Remove a directory */ PHP_FUNCTION(rmdir) { char *dir; + int dir_len; + zend_uchar dir_type; zval *zcontext = NULL; php_stream_context *context; - int dir_len; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, s|r, dir, dir_len, zcontext) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, t|r, dir, dir_len, dir_type, zcontext) == FAILURE) { RETURN_FALSE; } context = php_stream_context_from_zval(zcontext, 0); - RETURN_BOOL(php_stream_rmdir(dir, REPORT_ERRORS, context)); + if (dir_type == IS_UNICODE) { + if (FAILURE == php_stream_path_encode(NULL, dir, dir_len, (UChar*)dir, dir_len, REPORT_ERRORS, context)) { + RETURN_FALSE; + } + } + + RETVAL_BOOL(php_stream_rmdir(dir, REPORT_ERRORS, context)); + + if (dir_type == IS_UNICODE) { + efree(dir); + } } /* }}} */ @@ -1639,40 +1662,65 @@ } /* }}} */ -/* {{{ proto bool rename(string old_name, string new_name[, resource context]) +/* {{{ proto bool rename(string old_name, string new_name[, resource context]) U Rename a file */ PHP_FUNCTION(rename) { char *old_name, *new_name; int old_name_len, new_name_len; + zend_uchar old_name_type, new_name_type; + zend_uchar free_old_name = 0, free_new_name = 0; zval *zcontext = NULL; php_stream_wrapper *wrapper; php_stream_context *context; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, ss|r, old_name, old_name_len, new_name, new_name_len, zcontext) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, tt|r, old_name, old_name_len, old_name_type, new_name, new_name_len, new_name_type, zcontext) == FAILURE) { RETURN_FALSE; } + context = php_stream_context_from_zval(zcontext, 0); + RETVAL_FALSE; + + if (old_name_type == IS_UNICODE) { + if (FAILURE == php_stream_path_encode(NULL, old_name, old_name_len, (UChar*)old_name, old_name_len, REPORT_ERRORS, context)) { + goto rename_cleanup; + } + free_old_name = 1; + } + wrapper = php_stream_locate_url_wrapper(old_name, NULL, 0 TSRMLS_CC); if (!wrapper || !wrapper-wops) { php_error_docref(NULL TSRMLS_CC, E_WARNING, Unable
[PHP-CVS] cvs: php-src /ext/standard fsock.c
pollita Sun Sep 24 21:43:42 2006 UTC Modified files: /php-src/ext/standard fsock.c Log: PHP6 Update: fsockopen/psfockopen http://cvs.php.net/viewvc.cgi/php-src/ext/standard/fsock.c?r1=1.123r2=1.124diff_format=u Index: php-src/ext/standard/fsock.c diff -u php-src/ext/standard/fsock.c:1.123 php-src/ext/standard/fsock.c:1.124 --- php-src/ext/standard/fsock.c:1.123 Sun Feb 19 04:29:41 2006 +++ php-src/ext/standard/fsock.cSun Sep 24 21:43:41 2006 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: fsock.c,v 1.123 2006/02/19 04:29:41 andi Exp $ */ +/* $Id: fsock.c,v 1.124 2006/09/24 21:43:41 pollita Exp $ */ #include php.h #include php_globals.h @@ -98,7 +98,7 @@ if (zerrstr errstr) { /* no need to dup; we need to efree buf anyway */ zval_dtor(zerrstr); - ZVAL_STRING(zerrstr, errstr, 0); + ZVAL_RT_STRING(zerrstr, errstr, ZSTR_AUTOFREE); } else if (!zerrstr errstr) { efree(errstr); @@ -116,14 +116,14 @@ /* }}} */ -/* {{{ proto resource fsockopen(string hostname, int port [, int errno [, string errstr [, float timeout]]]) +/* {{{ proto resource fsockopen(string hostname, int port [, int errno [, string errstr [, float timeout]]]) U Open Internet or Unix domain socket connection */ PHP_FUNCTION(fsockopen) { php_fsockopen_stream(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0); } /* }}} */ -/* {{{ proto resource pfsockopen(string hostname, int port [, int errno [, string errstr [, float timeout]]]) +/* {{{ proto resource pfsockopen(string hostname, int port [, int errno [, string errstr [, float timeout]]]) U Open persistent Internet or Unix domain socket connection */ PHP_FUNCTION(pfsockopen) { -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/standard base64.c
pollita Mon Sep 25 01:27:11 2006 UTC Modified files: /php-src/ext/standard base64.c Log: base64 functions are basicly binary-only ops http://cvs.php.net/viewvc.cgi/php-src/ext/standard/base64.c?r1=1.48r2=1.49diff_format=u Index: php-src/ext/standard/base64.c diff -u php-src/ext/standard/base64.c:1.48 php-src/ext/standard/base64.c:1.49 --- php-src/ext/standard/base64.c:1.48 Mon Jun 26 22:17:42 2006 +++ php-src/ext/standard/base64.c Mon Sep 25 01:27:11 2006 @@ -15,7 +15,7 @@ | Author: Jim Winstead [EMAIL PROTECTED] | +--+ */ -/* $Id: base64.c,v 1.48 2006/06/26 22:17:42 bjori Exp $ */ +/* $Id: base64.c,v 1.49 2006/09/25 01:27:11 pollita Exp $ */ #include string.h @@ -203,7 +203,7 @@ } /* }}} */ -/* {{{ proto string base64_encode(string str) +/* {{{ proto string base64_encode(string str) U Encodes string using MIME base64 algorithm */ PHP_FUNCTION(base64_encode) { @@ -211,7 +211,7 @@ unsigned char *result; int str_len, ret_length; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, s, str, str_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, S, str, str_len) == FAILURE) { return; } result = php_base64_encode((unsigned char*)str, str_len, ret_length); @@ -224,7 +224,7 @@ /* }}} */ -/* {{{ proto string base64_decode(string str[, bool strict]) +/* {{{ proto string base64_decode(string str[, bool strict]) U Decodes string using MIME base64 algorithm */ PHP_FUNCTION(base64_decode) { -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php