diff options
| author | Ondřej Surý <ondrej@sury.org> | 2013-07-22 08:22:22 +0200 |
|---|---|---|
| committer | Ondřej Surý <ondrej@sury.org> | 2013-07-22 08:22:22 +0200 |
| commit | d837b4550418036e76d6adb3c7dad94b1e3a5a6a (patch) | |
| tree | 1f1c808039c898d7d891975d3788531a2a6550f1 /ext/standard | |
| parent | 706ac6417162d94eb701952d40df136cd9528b56 (diff) | |
| download | php-d837b4550418036e76d6adb3c7dad94b1e3a5a6a.tar.gz | |
New upstream version 5.5.1+dfsgupstream/5.5.1+dfsg
Diffstat (limited to 'ext/standard')
39 files changed, 480 insertions, 209 deletions
diff --git a/ext/standard/array.c b/ext/standard/array.c index 9bfb0887a..4f5209e2f 100644 --- a/ext/standard/array.c +++ b/ext/standard/array.c @@ -352,7 +352,7 @@ PHP_FUNCTION(count) /* Numbers are always smaller than strings int this function as it * anyway doesn't make much sense to compare two different data types. - * This keeps it consistant and simple. + * This keeps it consistent and simple. * * This is not correct any more, depends on what compare_func is set to. */ @@ -1041,7 +1041,7 @@ PHP_FUNCTION(max) static int php_array_walk(HashTable *target_hash, zval *userdata, int recursive TSRMLS_DC) /* {{{ */ { zval **args[3], /* Arguments to userland function */ - *retval_ptr, /* Return value - unused */ + *retval_ptr = NULL, /* Return value - unused */ *key=NULL; /* Entry key */ /* Set up known arguments */ @@ -2911,7 +2911,7 @@ static int zval_compare(zval **a, zval **b TSRMLS_DC) /* {{{ */ static int zval_user_compare(zval **a, zval **b TSRMLS_DC) /* {{{ */ { zval **args[2]; - zval *retval_ptr; + zval *retval_ptr = NULL; args[0] = (zval **) a; args[1] = (zval **) b; diff --git a/ext/standard/config.m4 b/ext/standard/config.m4 index fba423b19..2af2209f2 100644 --- a/ext/standard/config.m4 +++ b/ext/standard/config.m4 @@ -358,7 +358,29 @@ else AC_MSG_RESULT(no) fi -if test "$PHP_SAPI" = "cgi" || test "$PHP_SAPI" = "cli" || test "$PHP_SAPI" = "embed"; then +PHP_ENABLE_CHROOT_FUNC=no +case "$PHP_SAPI" in + embed) + PHP_ENABLE_CHROOT_FUNC=yes + ;; + + none) + for PROG in $PHP_BINARIES; do + case "$PROG" in + cgi|cli) + PHP_ENABLE_CHROOT_FUNC=yes + ;; + + *) + PHP_ENABLE_CHROOT_FUNC=no + break + ;; + esac + done + ;; +esac + +if test "$PHP_ENABLE_CHROOT_FUNC" = "yes"; then AC_DEFINE(ENABLE_CHROOT_FUNC, 1, [Whether to enable chroot() function]) fi diff --git a/ext/standard/image.c b/ext/standard/image.c index b3dade4a7..bd80f11de 100644 --- a/ext/standard/image.c +++ b/ext/standard/image.c @@ -112,7 +112,7 @@ static struct gfxinfo *php_handle_gif (php_stream * stream TSRMLS_DC) result->width = (unsigned int)dim[0] | (((unsigned int)dim[1])<<8); result->height = (unsigned int)dim[2] | (((unsigned int)dim[3])<<8); result->bits = dim[4]&0x80 ? ((((unsigned int)dim[4])&0x07) + 1) : 0; - result->channels = 3; /* allways */ + result->channels = 3; /* always */ return result; } diff --git a/ext/standard/info.c b/ext/standard/info.c index e8ba90807..32ef94e59 100644 --- a/ext/standard/info.c +++ b/ext/standard/info.c @@ -117,7 +117,11 @@ static void php_info_print_stream_hash(const char *name, HashTable *ht TSRMLS_DC zend_hash_internal_pointer_reset_ex(ht, &pos); while (zend_hash_get_current_key_ex(ht, &key, &len, NULL, 0, &pos) == HASH_KEY_IS_STRING) { - php_info_print(key); + if (!sapi_module.phpinfo_as_text) { + php_info_print_html_esc(key, len-1); + } else { + php_info_print(key); + } zend_hash_move_forward_ex(ht, &pos); if (zend_hash_get_current_key_ex(ht, &key, &len, NULL, 0, &pos) == HASH_KEY_IS_STRING) { php_info_print(", "); diff --git a/ext/standard/mail.c b/ext/standard/mail.c index 4c243f778..9499981f2 100644 --- a/ext/standard/mail.c +++ b/ext/standard/mail.c @@ -328,7 +328,7 @@ PHPAPI int php_mail(char *to, char *subject, char *message, char *headers, char sendmail = popen_ex(sendmail_cmd, "wb", NULL, NULL TSRMLS_CC); #else /* Since popen() doesn't indicate if the internal fork() doesn't work - * (e.g. the shell can't be executed) we explicitely set it to 0 to be + * (e.g. the shell can't be executed) we explicitly set it to 0 to be * sure we don't catch any older errno value. */ errno = 0; sendmail = popen(sendmail_cmd, "w"); diff --git a/ext/standard/pack.c b/ext/standard/pack.c index 672c06522..6e9489318 100644 --- a/ext/standard/pack.c +++ b/ext/standard/pack.c @@ -69,7 +69,7 @@ char machine_little_endian; /* Mapping of byte from char (8bit) to long for machine endian */ static int byte_map[1]; -/* Mappings of bytes from int (machine dependant) to int for machine endian */ +/* Mappings of bytes from int (machine dependent) to int for machine endian */ static int int_map[sizeof(int)]; /* Mappings of bytes from shorts (16bit) for all endian environments */ diff --git a/ext/standard/string.c b/ext/standard/string.c index f3f78100b..6a67efbd7 100644 --- a/ext/standard/string.c +++ b/ext/standard/string.c @@ -280,6 +280,7 @@ PHP_FUNCTION(hex2bin) result = php_hex2bin((unsigned char *)data, datalen, &newlen); if (!result) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Input string must be hexadecimal string"); RETURN_FALSE; } @@ -1581,7 +1582,7 @@ PHP_FUNCTION(pathinfo) const char *p; int idx; - /* Have we alrady looked up the basename? */ + /* Have we already looked up the basename? */ if (!have_basename && !ret) { php_basename(path, path_len, NULL, 0, &ret, &ret_len TSRMLS_CC); } diff --git a/ext/standard/tests/array/array_column_basic.phpt b/ext/standard/tests/array/array_column_basic.phpt index 7c30cdfd1..418f37387 100644 --- a/ext/standard/tests/array/array_column_basic.phpt +++ b/ext/standard/tests/array/array_column_basic.phpt @@ -178,7 +178,7 @@ array(3) { *** Testing multiple data types *** array(8) { [0]=> - object(stdClass)#1 (0) { + object(stdClass)#%d (0) { } [1]=> float(34.2345) @@ -197,7 +197,7 @@ array(8) { } array(8) { [1]=> - object(stdClass)#1 (0) { + object(stdClass)#%d (0) { } [2]=> float(34.2345) diff --git a/ext/standard/tests/array/array_key_exists_variation2.phpt b/ext/standard/tests/array/array_key_exists_variation2.phpt index a6e9cd2bb..69a1f0a6d 100644 --- a/ext/standard/tests/array/array_key_exists_variation2.phpt +++ b/ext/standard/tests/array/array_key_exists_variation2.phpt @@ -1,5 +1,5 @@ --TEST-- -Test array_key_exists() function : usage variations - Pass differnt data types to $search arg +Test array_key_exists() function : usage variations - Pass different data types to $search arg --FILE-- <?php /* Prototype : bool array_key_exists(mixed $key, array $search) diff --git a/ext/standard/tests/array/array_search_variation4.phpt b/ext/standard/tests/array/array_search_variation4.phpt index 04f3b9138..c247879cc 100644 --- a/ext/standard/tests/array/array_search_variation4.phpt +++ b/ext/standard/tests/array/array_search_variation4.phpt @@ -16,7 +16,7 @@ $file_handle = fopen(__FILE__, "r"); //directory type resource $dir_handle = opendir( dirname(__FILE__) ); -//store resources in array for comparision. +//store resources in array for comparison. $resources = array($file_handle, $dir_handle); // search for resouce type in the resource array diff --git a/ext/standard/tests/array/array_values_variation7.phpt b/ext/standard/tests/array/array_values_variation7.phpt index b71306456..660809357 100644 --- a/ext/standard/tests/array/array_values_variation7.phpt +++ b/ext/standard/tests/array/array_values_variation7.phpt @@ -9,7 +9,7 @@ Test array_values() function : usage variations - Internal order check /* * Check that array_values is re-assigning keys according to the internal order of the array, - * and is not dependant on the \$input argument's keys + * and is not dependent on the \$input argument's keys */ echo "*** Testing array_values() : usage variations ***\n"; diff --git a/ext/standard/tests/array/array_walk_closure.phpt b/ext/standard/tests/array/array_walk_closure.phpt new file mode 100644 index 000000000..4e22bb894 --- /dev/null +++ b/ext/standard/tests/array/array_walk_closure.phpt @@ -0,0 +1,251 @@ +--TEST-- +array_walk() closure tests +--FILE-- +<?php + +var_dump(array_walk()); + +$ar = false; +var_dump(array_walk($ar, $ar)); + +$ar = NULL; +var_dump(array_walk($ar, $ar)); + +$ar = ["one" => 1, "two"=>2, "three" => 3]; +var_dump(array_walk($ar, function(){ var_dump(func_get_args());})); + +echo "\nclosure with array\n"; +$ar = ["one" => 1, "two"=>2, "three" => 3]; +$user_data = ["sum" => 42]; +$func = function($value, $key, &$udata) { + var_dump($udata); + $udata["sum"] += $value; +}; + +var_dump(array_walk($ar, $func, $user_data)); +echo "End result:"; +var_dump($user_data["sum"]); + +echo "\nclosure with use\n"; +$ar = ["one" => 1, "two"=>2, "three" => 3]; +$user_data = ["sum" => 42]; +$func = function($value, $key) use (&$user_data) { + var_dump($user_data); + $user_data["sum"] += $value; +}; + +var_dump(array_walk($ar, $func, $user_data)); +echo "End result:"; +var_dump($user_data["sum"]); + + +echo "\nclosure with object\n"; +$ar = ["one" => 1, "two"=>2, "three" => 3]; +$user_data = (object)["sum" => 42]; +$func = function($value, $key, &$udata) { + var_dump($udata); + $udata->sum += $value; +}; + +var_dump(array_walk($ar, $func, $user_data)); +echo "End result:"; +var_dump($user_data->sum); + + + +echo "\nfunction with object\n"; +function sum_it_up_object($value, $key, $udata) +{ + var_dump($udata); + $udata->sum += $value; +} + +$ar = ["one" => 1, "two"=>2, "three" => 3]; +$user_data = (object)["sum" => 42]; + +var_dump(array_walk($ar, "sum_it_up_object", $user_data)); +echo "End result:"; +var_dump($user_data->sum); + + +echo "\nfunction with array\n"; +function sum_it_up_array($value, $key, $udata) +{ + var_dump($udata); + $udata['sum'] += $value; +} + +$ar = ["one" => 1, "two"=>2, "three" => 3]; +$user_data = ["sum" => 42]; + +var_dump(array_walk($ar, "sum_it_up_array", $user_data)); +echo "End result:"; +var_dump($user_data['sum']); + +echo "\nclosure and exception\n"; +$ar = ["one" => 1, "two"=>2, "three" => 3]; +try { + var_dump(array_walk($ar, function($v, $k) { if ($v == 2) throw new Exception; } )); +} catch (Exception $e) { + var_dump($e->getTrace()); +} + + +echo "Done\n"; +?> +--EXPECTF-- +Warning: array_walk() expects at least 2 parameters, 0 given in %s on line %d +NULL + +Warning: array_walk() expects parameter 1 to be array, boolean given in %s on line %d +NULL + +Warning: array_walk() expects parameter 1 to be array, null given in %s on line %d +NULL +array(2) { + [0]=> + int(1) + [1]=> + string(3) "one" +} +array(2) { + [0]=> + int(2) + [1]=> + string(3) "two" +} +array(2) { + [0]=> + int(3) + [1]=> + string(5) "three" +} +bool(true) + +closure with array +array(1) { + ["sum"]=> + int(42) +} +array(1) { + ["sum"]=> + int(43) +} +array(1) { + ["sum"]=> + int(45) +} +bool(true) +End result:int(42) + +closure with use +array(1) { + ["sum"]=> + int(42) +} +array(1) { + ["sum"]=> + int(43) +} +array(1) { + ["sum"]=> + int(45) +} +bool(true) +End result:int(48) + +closure with object +object(stdClass)#1 (1) { + ["sum"]=> + int(42) +} +object(stdClass)#1 (1) { + ["sum"]=> + int(43) +} +object(stdClass)#1 (1) { + ["sum"]=> + int(45) +} +bool(true) +End result:int(48) + +function with object +object(stdClass)#2 (1) { + ["sum"]=> + int(42) +} +object(stdClass)#2 (1) { + ["sum"]=> + int(43) +} +object(stdClass)#2 (1) { + ["sum"]=> + int(45) +} +bool(true) +End result:int(48) + +function with array +array(1) { + ["sum"]=> + int(42) +} +array(1) { + ["sum"]=> + int(42) +} +array(1) { + ["sum"]=> + int(42) +} +bool(true) +End result:int(42) + +closure and exception +array(2) { + [0]=> + array(2) { + ["function"]=> + string(9) "{closure}" + ["args"]=> + array(2) { + [0]=> + int(2) + [1]=> + string(3) "two" + } + } + [1]=> + array(4) { + ["file"]=> + string(%d) "%s" + ["line"]=> + int(%d) + ["function"]=> + string(10) "array_walk" + ["args"]=> + array(2) { + [0]=> + &array(3) { + ["one"]=> + int(1) + ["two"]=> + int(2) + ["three"]=> + int(3) + } + [1]=> + object(Closure)#2 (1) { + ["parameter"]=> + array(2) { + ["$v"]=> + string(10) "<required>" + ["$k"]=> + string(10) "<required>" + } + } + } + } +} +Done diff --git a/ext/standard/tests/array/bug34066.phpt b/ext/standard/tests/array/bug34066.phpt index 31f6b4c1d..023f4176f 100644 --- a/ext/standard/tests/array/bug34066.phpt +++ b/ext/standard/tests/array/bug34066.phpt @@ -123,7 +123,7 @@ Bug #34066 (recursive array_walk causes segfault) "ProceedKeyArticle" => "01", "ActionKey" => "00", "ContactCommissionArticle"=> "0,00", - "QuantDependantPriceKey"=> "", + "QuantdependentPriceKey"=> "", "Quant" => "1", "QuantUnit" => "", "Meas" => array( @@ -584,7 +584,7 @@ gen_xml(prefix=/Docs/Doc/DocItems/DocItem/) /Docs/Doc/DocItems/DocItem/ContactCommissionArticle=0,00 gen_xml(prefix=/Docs/Doc/DocItems/DocItem/) end gen_xml(prefix=/Docs/Doc/DocItems/DocItem/) -/Docs/Doc/DocItems/DocItem/QuantDependantPriceKey +/Docs/Doc/DocItems/DocItem/QuantdependentPriceKey gen_xml(prefix=/Docs/Doc/DocItems/DocItem/) end gen_xml(prefix=/Docs/Doc/DocItems/DocItem/) /Docs/Doc/DocItems/DocItem/Quant=1 diff --git a/ext/standard/tests/array/bug34066_1.phpt b/ext/standard/tests/array/bug34066_1.phpt index edc16efd0..6d0f7f84e 100644 --- a/ext/standard/tests/array/bug34066_1.phpt +++ b/ext/standard/tests/array/bug34066_1.phpt @@ -123,7 +123,7 @@ Bug #34066 (recursive array_walk causes segfault) "ProceedKeyArticle" => "01", "ActionKey" => "00", "ContactCommissionArticle"=> "0,00", - "QuantDependantPriceKey"=> "", + "QuantdependentPriceKey"=> "", "Quant" => "1", "QuantUnit" => "", "Meas" => array( @@ -543,7 +543,7 @@ gen_xml(prefix=/Docs/) /Docs/ContactCommissionArticle=0,00 gen_xml(prefix=/Docs/) end gen_xml(prefix=/Docs/) -/Docs/QuantDependantPriceKey +/Docs/QuantdependentPriceKey gen_xml(prefix=/Docs/) end gen_xml(prefix=/Docs/) /Docs/Quant=1 diff --git a/ext/standard/tests/array/in_array_variation4.phpt b/ext/standard/tests/array/in_array_variation4.phpt index b88a5a2d6..a27bb196b 100644 --- a/ext/standard/tests/array/in_array_variation4.phpt +++ b/ext/standard/tests/array/in_array_variation4.phpt @@ -19,7 +19,7 @@ $file_handle = fopen(__FILE__, "r"); //directory type resource $dir_handle = opendir( dirname(__FILE__) ); -//store resources in array for comparision. +//store resources in array for comparison. $resources = array($file_handle, $dir_handle); // search for resouce type in the resource array diff --git a/ext/standard/tests/array/uasort_object2.phpt b/ext/standard/tests/array/uasort_object2.phpt index cd32d8d94..889db9886 100644 --- a/ext/standard/tests/array/uasort_object2.phpt +++ b/ext/standard/tests/array/uasort_object2.phpt @@ -8,7 +8,7 @@ Test uasort() function : object functionality - sort diff. objects * /* - * This testcase tests uasort() functionality with differnt objects + * This testcase tests uasort() functionality with different objects * Objects of different classes: * simple class, * child class, diff --git a/ext/standard/tests/array/uasort_variation10.phpt b/ext/standard/tests/array/uasort_variation10.phpt index 809cb78f5..e0c5e72f7 100644 --- a/ext/standard/tests/array/uasort_variation10.phpt +++ b/ext/standard/tests/array/uasort_variation10.phpt @@ -11,7 +11,7 @@ Test uasort() function : usage variations - sort array with reference variables * Testing uasort() with 'array_arg' containing different reference variables */ -// comparision function +// comparison function /* Prototype : int cmp_function(mixed $value1, mixed $value2) * Parameters : $value1 and $value2 - values to be compared * Return value : 0 - if both values are same diff --git a/ext/standard/tests/array/uasort_variation4.phpt b/ext/standard/tests/array/uasort_variation4.phpt index c2844bfd2..0ed797fb8 100644 --- a/ext/standard/tests/array/uasort_variation4.phpt +++ b/ext/standard/tests/array/uasort_variation4.phpt @@ -12,7 +12,7 @@ Test uasort() function : usage variations - sort different numeric values * integer, octal, hexadecimal & float */ -// comparision function +// comparison function /* Prototype : int cmp_function(mixed $value1, mixed $value2) * Parameters : $value1 and $value2 - values to be compared * Return value : 0 - if both values are same diff --git a/ext/standard/tests/file/bug41874.phpt b/ext/standard/tests/file/bug41874.phpt index 827f486d4..8cc1ce2e6 100644 --- a/ext/standard/tests/file/bug41874.phpt +++ b/ext/standard/tests/file/bug41874.phpt @@ -6,9 +6,9 @@ if(substr(PHP_OS, 0, 3) != 'WIN' ) die('skip windows only test'); ?> --FILE-- <?php -$result = exec('cd 1:\non_existant; dir nonexistant'); +$result = exec('cd 1:\non_existent; dir nonexistent'); echo "$result"; -system('cd 1:\non_existant; dir nonexistant'); +system('cd 1:\non_existent; dir nonexistent'); ?> --EXPECT-- The system cannot find the drive specified. diff --git a/ext/standard/tests/file/bug41874_2.phpt b/ext/standard/tests/file/bug41874_2.phpt index 5d7b7cad8..bf76a749f 100644 --- a/ext/standard/tests/file/bug41874_2.phpt +++ b/ext/standard/tests/file/bug41874_2.phpt @@ -10,7 +10,7 @@ if(substr(PHP_OS, 0, 3) != 'WIN' ) { ?> --FILE-- <?php -$result = exec('cd 1:\\non_existant; dir nonexistant'); +$result = exec('cd 1:\\non_existent; dir nonexistent'); echo "$result"; ?> --EXPECT-- diff --git a/ext/standard/tests/file/bug41874_3.phpt b/ext/standard/tests/file/bug41874_3.phpt index 4d7b139ad..05095c6f1 100644 --- a/ext/standard/tests/file/bug41874_3.phpt +++ b/ext/standard/tests/file/bug41874_3.phpt @@ -10,7 +10,7 @@ if(substr(PHP_OS, 0, 3) != 'WIN' ) { ?> --FILE-- <?php -system('cd 1:\\non_existant; dir nonexistant'); +system('cd 1:\\non_existent; dir nonexistent'); ?> --EXPECT-- The system cannot find the drive specified.
\ No newline at end of file diff --git a/ext/standard/tests/file/file.inc b/ext/standard/tests/file/file.inc index c0f86e7c3..b3cd99e1c 100644 --- a/ext/standard/tests/file/file.inc +++ b/ext/standard/tests/file/file.inc @@ -575,13 +575,13 @@ Description: Compares two stat values, stat value should be obtained by stat/lstat $stat1 = first stat array $stat2 = second stat array - $op = type of the comparision to be perform between elements of stat1 and stat2 + $op = type of the comparison to be perform between elements of stat1 and stat2 "!=" compare for not equal "==" compare for equality ">" if each element of stat1 is > than stat2 "<" if each element of stat1 is < than stat2 $fields = contains the key of the elements that needs to be compared. - type of the comparision is based on $op argument value + type of the comparison is based on $op argument value $flag = specify true to dump the stat1 and stat2 */ diff --git a/ext/standard/tests/file/lchown_error.phpt b/ext/standard/tests/file/lchown_error.phpt index 979959e28..bacbd93c8 100644 --- a/ext/standard/tests/file/lchown_error.phpt +++ b/ext/standard/tests/file/lchown_error.phpt @@ -36,7 +36,7 @@ var_dump( lchown( $filename ) ); // More than expected arguments var_dump( lchown( $filename, $uid, 'foobar' ) ); -// Non-existant filename +// Non-existent filename var_dump( lchown( 'foobar_lchown.txt', $uid ) ); // Wrong argument types diff --git a/ext/standard/tests/file/symlink_to_symlink.phpt b/ext/standard/tests/file/symlink_to_symlink.phpt index b7554f9bd..8b7ff65cf 100644 --- a/ext/standard/tests/file/symlink_to_symlink.phpt +++ b/ext/standard/tests/file/symlink_to_symlink.phpt @@ -19,8 +19,8 @@ symlink(basename($prefix . "_file"), $prefix . "_link1"); symlink(basename($prefix . "_link1"), $prefix . "_link2"); // symlink to a non-existent path -@unlink($prefix . "_nonexistant"); -symlink(basename($prefix . "_nonexistant"), $prefix . "_link3"); +@unlink($prefix . "_nonexistent"); +symlink(basename($prefix . "_nonexistent"), $prefix . "_link3"); // symlink to a regular file using an absolute path symlink($prefix . "_file", $prefix . "_link4"); @@ -45,6 +45,6 @@ unlink($prefix . "_file"); --EXPECTF-- %unicode|string%(%d) "symlink_to_symlink.php_file" %unicode|string%(%d) "symlink_to_symlink.php_link1" -%unicode|string%(%d) "symlink_to_symlink.php_nonexistant" +%unicode|string%(%d) "symlink_to_symlink.php_nonexistent" %unicode|string%(%d) "%s/symlink_to_symlink.php_file" %unicode|string%(%d) "%s/symlink_to_symlink.php_link4" diff --git a/ext/standard/tests/file/userstreams.phpt b/ext/standard/tests/file/userstreams.phpt index b5a9707e9..d39898bbe 100644 --- a/ext/standard/tests/file/userstreams.phpt +++ b/ext/standard/tests/file/userstreams.phpt @@ -158,7 +158,7 @@ class mystream } if (@stream_wrapper_register("bogus", "class_not_exist")) { - die("Registered a non-existant class!!!???"); + die("Registered a non-existent class!!!???"); } echo "Not Registered\n"; diff --git a/ext/standard/tests/general_functions/dl-cve-2007-4887.phpt b/ext/standard/tests/general_functions/dl-cve-2007-4887.phpt index e242d45dc..c53b5153f 100644 --- a/ext/standard/tests/general_functions/dl-cve-2007-4887.phpt +++ b/ext/standard/tests/general_functions/dl-cve-2007-4887.phpt @@ -1,5 +1,12 @@ --TEST-- dl() filename length checks (CVE-2007-4887) +--SKIPIF-- +<?php +$enabled_sapi = array('cgi-fcgi', 'cli', 'embed', 'fpm'); +if (!in_array(php_sapi_name(), $enabled_sapi)) { + die('skip dl() is not enabled for ' . php_sapi_name()); +} +?> --INI-- enable_dl=1 --FILE-- diff --git a/ext/standard/tests/mail/ezmlm_hash_variation1.phpt b/ext/standard/tests/mail/ezmlm_hash_variation1.phpt index aa1e521e9..58957c84a 100644 --- a/ext/standard/tests/mail/ezmlm_hash_variation1.phpt +++ b/ext/standard/tests/mail/ezmlm_hash_variation1.phpt @@ -24,8 +24,8 @@ class sample { //getting the resource $file_handle = fopen(__FILE__, "r"); -// array with different values for $delimeter -$delimeters = array ( +// array with different values for $delimiter +$delimiters = array ( // integer values 0, @@ -68,13 +68,13 @@ $delimeters = array ( @$unset_var ); -// loop through with each element of the $delimeters array to test explode() function +// loop through with each element of the $delimiters array to test explode() function $count = 1; $string = "piece1 piece2 piece3 piece4 piece5 piece6"; $limit = 5; -foreach($delimeters as $delimeter) { +foreach($delimiters as $delimiter) { echo "-- Iteration $count --\n"; - var_dump( explode($delimeter, $string, $limit) ); + var_dump( explode($delimiter, $string, $limit) ); $count ++; } diff --git a/ext/standard/tests/strings/bug38322.phpt b/ext/standard/tests/strings/bug38322.phpt index 37f5a93f6..79f66f1fa 100644 --- a/ext/standard/tests/strings/bug38322.phpt +++ b/ext/standard/tests/strings/bug38322.phpt @@ -1,5 +1,5 @@ --TEST-- -Bug #38322 (reading past array in sscanf() leads to segfault/arbitary code execution) +Bug #38322 (reading past array in sscanf() leads to segfault/arbitrary code execution) --FILE-- <?php diff --git a/ext/standard/tests/strings/bug47322.phpt b/ext/standard/tests/strings/bug47322.phpt index e04b230ba..1fedc2937 100644 --- a/ext/standard/tests/strings/bug47322.phpt +++ b/ext/standard/tests/strings/bug47322.phpt @@ -1,5 +1,5 @@ --TEST-- -Bug #47322 (sscanf %d does't work) +Bug #47322 (sscanf %d doesn't work) --FILE-- <?php diff --git a/ext/standard/tests/strings/explode_error.phpt b/ext/standard/tests/strings/explode_error.phpt index f7342e7ad..e88b1b0c6 100644 --- a/ext/standard/tests/strings/explode_error.phpt +++ b/ext/standard/tests/strings/explode_error.phpt @@ -14,11 +14,11 @@ echo "\n-- Testing explode() function with no arguments --\n"; var_dump( explode() ); echo "\n-- Testing explode() function with more than expected no. of arguments --\n"; -$delimeter = " "; +$delimiter = " "; $string = "piece1 piece2 piece3 piece4 piece5 piece6"; $limit = 5; $extra_arg = 10; -var_dump( explode($delimeter, $string, $limit, $extra_arg) ); +var_dump( explode($delimiter, $string, $limit, $extra_arg) ); ?> ===Done=== diff --git a/ext/standard/tests/strings/explode_variation1.phpt b/ext/standard/tests/strings/explode_variation1.phpt index 9c9ce1169..f16f69bec 100644 --- a/ext/standard/tests/strings/explode_variation1.phpt +++ b/ext/standard/tests/strings/explode_variation1.phpt @@ -24,8 +24,8 @@ class sample { //getting the resource $file_handle = fopen(__FILE__, "r"); -// array with different values for $delimeter -$delimeters = array ( +// array with different values for $delimiter +$delimiters = array ( // integer values /*1*/ 0, @@ -68,13 +68,13 @@ $delimeters = array ( /*22*/ @$unset_var ); -// loop through with each element of the $delimeters array to test explode() function +// loop through with each element of the $delimiters array to test explode() function $count = 1; $string = "piece1 piece2 piece3 piece4 piece5 piece6"; $limit = 5; -foreach($delimeters as $delimeter) { +foreach($delimiters as $delimiter) { echo "-- Iteration $count --\n"; - var_dump( explode($delimeter, $string, $limit) ); + var_dump( explode($delimiter, $string, $limit) ); $count ++; } diff --git a/ext/standard/tests/strings/explode_variation2.phpt b/ext/standard/tests/strings/explode_variation2.phpt index 9e1f72c5a..4de4637ac 100644 --- a/ext/standard/tests/strings/explode_variation2.phpt +++ b/ext/standard/tests/strings/explode_variation2.phpt @@ -70,11 +70,11 @@ $strings = array ( // loop through with each element of the $strings array to test explode() function $count = 1; -$delimeter = " "; +$delimiter = " "; $limit = 5; foreach($strings as $string) { echo "-- Iteration $count --\n"; - var_dump( explode($delimeter, $string, $limit) ); + var_dump( explode($delimiter, $string, $limit) ); $count ++; } diff --git a/ext/standard/tests/strings/explode_variation3.phpt b/ext/standard/tests/strings/explode_variation3.phpt index 54d5222ca..2e8789310 100644 --- a/ext/standard/tests/strings/explode_variation3.phpt +++ b/ext/standard/tests/strings/explode_variation3.phpt @@ -24,7 +24,7 @@ class sample { //getting the resource $file_handle = fopen(__FILE__, "r"); -// array with different values for $delimeter +// array with different values for $delimiter $limits = array ( // integer values @@ -70,11 +70,11 @@ $limits = array ( // loop through with each element of the $limits array to test explode() function $count = 1; -$delimeter = " "; +$delimiter = " "; $string = "piece1 piece2 piece3 piece4 piece5 piece6"; foreach($limits as $limit) { echo "-- Iteration $count --\n"; - var_dump( explode($delimeter, $string, $limit) ); + var_dump( explode($delimiter, $string, $limit) ); $count ++; } diff --git a/ext/standard/tests/strings/implode1.phpt b/ext/standard/tests/strings/implode1.phpt Binary files differindex 4d3502f18..3997c54b5 100644 --- a/ext/standard/tests/strings/implode1.phpt +++ b/ext/standard/tests/strings/implode1.phpt diff --git a/ext/standard/tests/strings/strrchr_basic.phpt b/ext/standard/tests/strings/strrchr_basic.phpt index 1d4e50efd..b5bfe2d9c 100644 --- a/ext/standard/tests/strings/strrchr_basic.phpt +++ b/ext/standard/tests/strings/strrchr_basic.phpt @@ -34,7 +34,7 @@ var_dump( strrchr("Hello, World", "Hi") ); var_dump( strrchr("Hello, World", "o") ); var_dump( strrchr("Hello, World", "ooo") ); -var_dump( strrchr("Hello, World", "Zzzz") ); //non-existant needle in haystack +var_dump( strrchr("Hello, World", "Zzzz") ); //non-existent needle in haystack echo "*** Done ***"; ?> --EXPECTF-- diff --git a/ext/standard/tests/strings/substr_replace_error.phpt b/ext/standard/tests/strings/substr_replace_error.phpt index 7d3a695d4..fd314cbd9 100644 --- a/ext/standard/tests/strings/substr_replace_error.phpt +++ b/ext/standard/tests/strings/substr_replace_error.phpt @@ -26,7 +26,7 @@ echo "\n-- Testing substr_replace() function with start and length different typ var_dump(substr_replace($s1, "evening", array(5))); var_dump(substr_replace($s1, "evening", 5, array(8))); -echo "\n-- Testing substr_replace() function with start and length with a different number of elments --\n"; +echo "\n-- Testing substr_replace() function with start and length with a different number of elements --\n"; var_dump(substr_replace($s1, "evening", array(5, 1), array(8))); echo "\n-- Testing substr_replace() function with start and length as arrays but string not--\n"; @@ -58,7 +58,7 @@ string(12) "Good morning" Warning: substr_replace(): 'from' and 'len' should be of same type - numerical or array in %s on line %d string(12) "Good morning" --- Testing substr_replace() function with start and length with a different number of elments -- +-- Testing substr_replace() function with start and length with a different number of elements -- Warning: substr_replace(): 'from' and 'len' should have the same number of elements in %s on line %d string(12) "Good morning" diff --git a/ext/standard/url.c b/ext/standard/url.c index 94f6638d6..190b4665e 100644 --- a/ext/standard/url.c +++ b/ext/standard/url.c @@ -266,7 +266,7 @@ PHPAPI php_url *php_url_parse_ex(char const *str, int length) p = s; } else { /* memrchr is a GNU specific extension - Emulate for wide compatability */ + Emulate for wide compatibility */ for(p = e; *p != ':' && p >= s; p--); } diff --git a/ext/standard/url_scanner_ex.c b/ext/standard/url_scanner_ex.c index fe7378b9d..3a1f3abeb 100644 --- a/ext/standard/url_scanner_ex.c +++ b/ext/standard/url_scanner_ex.c @@ -519,48 +519,61 @@ state_next_arg: }; if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2); yych = *YYCURSOR; - if (yych <= ' ') { + if (yych <= '.') { if (yych <= '\f') { - if (yych <= 0x08) goto yy34; - if (yych <= '\v') goto yy30; - goto yy34; + if (yych <= 0x08) goto yy36; + if (yych <= '\v') goto yy32; + goto yy36; } else { - if (yych <= '\r') goto yy30; - if (yych <= 0x1F) goto yy34; - goto yy30; + if (yych <= '\r') goto yy32; + if (yych == ' ') goto yy32; + goto yy36; } } else { if (yych <= '@') { - if (yych != '>') goto yy34; + if (yych <= '/') goto yy28; + if (yych == '>') goto yy30; + goto yy36; } else { - if (yych <= 'Z') goto yy32; - if (yych <= '`') goto yy34; - if (yych <= 'z') goto yy32; - goto yy34; + if (yych <= 'Z') goto yy34; + if (yych <= '`') goto yy36; + if (yych <= 'z') goto yy34; + goto yy36; } } +yy28: ++YYCURSOR; - { passthru(STD_ARGS); handle_form(STD_ARGS); goto state_plain_begin; } + if ((yych = *YYCURSOR) == '>') goto yy39; +yy29: + { passthru(STD_ARGS); goto state_plain_begin; } yy30: ++YYCURSOR; - yych = *YYCURSOR; - goto yy37; yy31: - { passthru(STD_ARGS); goto state_next_arg; } + { passthru(STD_ARGS); handle_form(STD_ARGS); goto state_plain_begin; } yy32: ++YYCURSOR; - { --YYCURSOR; STATE = STATE_ARG; goto state_arg; } + yych = *YYCURSOR; + goto yy38; +yy33: + { passthru(STD_ARGS); goto state_next_arg; } yy34: ++YYCURSOR; - { passthru(STD_ARGS); goto state_plain_begin; } + { --YYCURSOR; STATE = STATE_ARG; goto state_arg; } yy36: + yych = *++YYCURSOR; + goto yy29; +yy37: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); yych = *YYCURSOR; -yy37: +yy38: if (yybm[0+yych] & 128) { - goto yy36; + goto yy37; } + goto yy33; +yy39: + ++YYCURSOR; + yych = *YYCURSOR; goto yy31; } @@ -606,28 +619,28 @@ state_arg: }; if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2); yych = *YYCURSOR; - if (yych <= '@') goto yy42; - if (yych <= 'Z') goto yy40; - if (yych <= '`') goto yy42; - if (yych >= '{') goto yy42; -yy40: + if (yych <= '@') goto yy44; + if (yych <= 'Z') goto yy42; + if (yych <= '`') goto yy44; + if (yych >= '{') goto yy44; +yy42: ++YYCURSOR; yych = *YYCURSOR; - goto yy45; -yy41: + goto yy47; +yy43: { passthru(STD_ARGS); handle_arg(STD_ARGS); STATE = STATE_BEFORE_VAL; goto state_before_val; } -yy42: +yy44: ++YYCURSOR; { passthru(STD_ARGS); STATE = STATE_NEXT_ARG; goto state_next_arg; } -yy44: +yy46: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); yych = *YYCURSOR; -yy45: +yy47: if (yybm[0+yych] & 128) { - goto yy44; + goto yy46; } - goto yy41; + goto yy43; } @@ -672,41 +685,41 @@ state_before_val: }; if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2); yych = *YYCURSOR; - if (yych == ' ') goto yy48; - if (yych == '=') goto yy50; - goto yy52; -yy48: + if (yych == ' ') goto yy50; + if (yych == '=') goto yy52; + goto yy54; +yy50: yych = *(YYMARKER = ++YYCURSOR); - if (yych == ' ') goto yy55; - if (yych == '=') goto yy53; -yy49: + if (yych == ' ') goto yy57; + if (yych == '=') goto yy55; +yy51: { --YYCURSOR; goto state_next_arg_begin; } -yy50: +yy52: ++YYCURSOR; yych = *YYCURSOR; - goto yy54; -yy51: + goto yy56; +yy53: { passthru(STD_ARGS); STATE = STATE_VAL; goto state_val; } -yy52: +yy54: yych = *++YYCURSOR; - goto yy49; -yy53: + goto yy51; +yy55: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); yych = *YYCURSOR; -yy54: +yy56: if (yybm[0+yych] & 128) { - goto yy53; + goto yy55; } - goto yy51; -yy55: + goto yy53; +yy57: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); yych = *YYCURSOR; - if (yych == ' ') goto yy55; - if (yych == '=') goto yy53; + if (yych == ' ') goto yy57; + if (yych == '=') goto yy55; YYCURSOR = YYMARKER; - goto yy49; + goto yy51; } @@ -717,139 +730,112 @@ state_val: { YYCTYPE yych; static const unsigned char yybm[] = { - 248, 248, 248, 248, 248, 248, 248, 248, - 248, 160, 160, 248, 248, 160, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, - 160, 248, 56, 248, 248, 248, 248, 200, - 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 0, 248, - 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, + 224, 224, 224, 224, 224, 224, 224, 224, + 224, 192, 192, 224, 224, 192, 224, 224, + 224, 224, 224, 224, 224, 224, 224, 224, + 224, 224, 224, 224, 224, 224, 224, 224, + 192, 224, 64, 224, 224, 224, 224, 128, + 224, 224, 224, 224, 224, 224, 224, 224, + 224, 224, 224, 224, 224, 224, 224, 224, + 224, 224, 224, 224, 224, 224, 0, 224, + 224, 224, 224, 224, 224, 224, 224, 224, + 224, 224, 224, 224, 224, 224, 224, 224, + 224, 224, 224, 224, 224, 224, 224, 224, + 224, 224, 224, 224, 224, 224, 224, 224, + 224, 224, 224, 224, 224, 224, 224, 224, + 224, 224, 224, 224, 224, 224, 224, 224, + 224, 224, 224, 224, 224, 224, 224, 224, + 224, 224, 224, 224, 224, 224, 224, 224, + 224, 224, 224, 224, 224, 224, 224, 224, + 224, 224, 224, 224, 224, 224, 224, 224, + 224, 224, 224, 224, 224, 224, 224, 224, + 224, 224, 224, 224, 224, 224, 224, 224, + 224, 224, 224, 224, 224, 224, 224, 224, + 224, 224, 224, 224, 224, 224, 224, 224, + 224, 224, 224, 224, 224, 224, 224, 224, + 224, 224, 224, 224, 224, 224, 224, 224, + 224, 224, 224, 224, 224, 224, 224, 224, + 224, 224, 224, 224, 224, 224, 224, 224, + 224, 224, 224, 224, 224, 224, 224, 224, + 224, 224, 224, 224, 224, 224, 224, 224, + 224, 224, 224, 224, 224, 224, 224, 224, + 224, 224, 224, 224, 224, 224, 224, 224, + 224, 224, 224, 224, 224, 224, 224, 224, + 224, 224, 224, 224, 224, 224, 224, 224, }; - if ((YYLIMIT - YYCURSOR) < 3) YYFILL(3); + if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2); yych = *YYCURSOR; if (yych <= ' ') { if (yych <= '\f') { - if (yych <= 0x08) goto yy63; - if (yych <= '\n') goto yy64; - goto yy63; + if (yych <= 0x08) goto yy65; + if (yych <= '\n') goto yy67; + goto yy65; } else { - if (yych <= '\r') goto yy64; - if (yych <= 0x1F) goto yy63; - goto yy64; + if (yych <= '\r') goto yy67; + if (yych <= 0x1F) goto yy65; + goto yy67; } } else { if (yych <= '&') { - if (yych != '"') goto yy63; + if (yych != '"') goto yy65; } else { - if (yych <= '\'') goto yy62; - if (yych == '>') goto yy64; - goto yy63; + if (yych <= '\'') goto yy64; + if (yych == '>') goto yy67; + goto yy65; } } yych = *(YYMARKER = ++YYCURSOR); - goto yy77; -yy61: - { handle_val(STD_ARGS, 0, ' '); goto state_next_arg_begin; } -yy62: - yych = *(YYMARKER = ++YYCURSOR); - goto yy69; + if (yych != '>') goto yy76; yy63: - yych = *++YYCURSOR; - goto yy67; -yy64: - ++YYCURSOR; { passthru(STD_ARGS); goto state_next_arg_begin; } -yy66: +yy64: + yych = *(YYMARKER = ++YYCURSOR); + if (yych == '>') goto yy63; + goto yy71; +yy65: ++YYCURSOR; - if (YYLIMIT <= YYCURSOR) YYFILL(1); yych = *YYCURSOR; + goto yy69; +yy66: + { handle_val(STD_ARGS, 0, ' '); goto state_next_arg_begin; } yy67: - if (yybm[0+yych] & 8) { - goto yy66; - } - goto yy61; + yych = *++YYCURSOR; + goto yy63; yy68: - YYMARKER = ++YYCURSOR; - if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2); + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); yych = *YYCURSOR; yy69: - if (yybm[0+yych] & 16) { + if (yybm[0+yych] & 32) { goto yy68; } - if (yych <= '&') goto yy72; - if (yych >= '(') goto yy61; - ++YYCURSOR; - if (yybm[0+(yych = *YYCURSOR)] & 8) { - goto yy66; - } -yy71: - { handle_val(STD_ARGS, 1, '\''); goto state_next_arg_begin; } -yy72: + goto yy66; +yy70: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); yych = *YYCURSOR; - if (yybm[0+yych] & 32) { - goto yy72; - } - if (yych <= '=') goto yy75; -yy74: - YYCURSOR = YYMARKER; - goto yy61; -yy75: - yych = *++YYCURSOR; - goto yy71; -yy76: - YYMARKER = ++YYCURSOR; - if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2); - yych = *YYCURSOR; -yy77: +yy71: if (yybm[0+yych] & 64) { - goto yy76; + goto yy70; } - if (yych <= '!') goto yy80; - if (yych >= '#') goto yy61; + if (yych <= '=') goto yy73; +yy72: + YYCURSOR = YYMARKER; + goto yy63; +yy73: ++YYCURSOR; - if (yybm[0+(yych = *YYCURSOR)] & 8) { - goto yy66; - } -yy79: - { handle_val(STD_ARGS, 1, '"'); goto state_next_arg_begin; } -yy80: + { handle_val(STD_ARGS, 1, '\''); goto state_next_arg_begin; } +yy75: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); yych = *YYCURSOR; +yy76: if (yybm[0+yych] & 128) { - goto yy80; + goto yy75; } - if (yych >= '>') goto yy74; + if (yych >= '>') goto yy72; ++YYCURSOR; - yych = *YYCURSOR; - goto yy79; + { handle_val(STD_ARGS, 1, '"'); goto state_next_arg_begin; } } diff --git a/ext/standard/url_scanner_ex.re b/ext/standard/url_scanner_ex.re index 760f725e9..f0dee8ebc 100644 --- a/ext/standard/url_scanner_ex.re +++ b/ext/standard/url_scanner_ex.re @@ -317,7 +317,7 @@ state_next_arg_begin: state_next_arg: start = YYCURSOR; /*!re2c - ">" { passthru(STD_ARGS); handle_form(STD_ARGS); goto state_plain_begin; } + [/]? [>] { passthru(STD_ARGS); handle_form(STD_ARGS); goto state_plain_begin; } [ \v\r\t\n]+ { passthru(STD_ARGS); goto state_next_arg; } alpha { --YYCURSOR; STATE = STATE_ARG; goto state_arg; } any { passthru(STD_ARGS); goto state_plain_begin; } @@ -343,7 +343,7 @@ state_val: /*!re2c ["] (any\[">])* ["] { handle_val(STD_ARGS, 1, '"'); goto state_next_arg_begin; } ['] (any\['>])* ['] { handle_val(STD_ARGS, 1, '\''); goto state_next_arg_begin; } - (any\[ \r\t\n>])+ { handle_val(STD_ARGS, 0, ' '); goto state_next_arg_begin; } + (any\[ \r\t\n>'"])+ { handle_val(STD_ARGS, 0, ' '); goto state_next_arg_begin; } any { passthru(STD_ARGS); goto state_next_arg_begin; } */ |
