kraghuba                Sat Sep 29 09:08:25 2007 UTC

  Added files:                 
    /php-src/ext/standard/tests/strings join_variation6.phpt 
                                        join_error.phpt 
                                        join_variation1.phpt 
                                        join_basic.phpt 
                                        join_variation2.phpt 
                                        join_variation3.phpt 
                                        join_variation4.phpt 
                                        join_variation5.phpt 
  Log:
  New testcases for join() function
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/strings/join_variation6.phpt?view=markup&rev=1.1
Index: php-src/ext/standard/tests/strings/join_variation6.phpt
+++ php-src/ext/standard/tests/strings/join_variation6.phpt
--TEST--
Test join() function : usage variations - binary safe
--INI--
--FILE--
<?php
/* Prototype  : string join( string $glue, array $pieces )
 * Description: Join array elements with a string
 * Source code: ext/standard/string.c
 * Alias of function: implode()
*/

/*
 * check the working of join() when given binary inputs given
*/

echo "*** Testing join() : usage variationsi - binary safe ***\n";

$glues = array(
  ",".chr(0)." ",
  b", "
);

$pieces = array("Red", "Green", "White", 1);
var_dump( join($glues[0], $pieces) );
var_dump( join($glues[1], $pieces) );
 
echo "Done\n";
?>
--EXPECTF--
*** Testing join() : usage variationsi - binary safe ***
string(23) "Red,
string(20) "Red, Green, White, 1"
Done
--UEXPECTF--
*** Testing join() : usage variationsi - binary safe ***
unicode(23) "Red,
string(20) "Red, Green, White, 1"
Done

http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/strings/join_error.phpt?view=markup&rev=1.1
Index: php-src/ext/standard/tests/strings/join_error.phpt
+++ php-src/ext/standard/tests/strings/join_error.phpt
--TEST--
Test join() function : error conditions(Bug#42789) 
--FILE--
<?php
/* Prototype  : string join( string $glue, array $pieces )
 * Description: Join array elements with a string
 * Source code: ext/standard/string.c
 * Alias of function: implode()
*/

echo "*** Testing join() : error conditions ***\n";

// Zero argument
echo "\n-- Testing join() function with Zero arguments --\n";
var_dump( join() );

// More than expected number of arguments
echo "\n-- Testing join() function with more than expected no. of arguments 
--\n";
$glue = 'string_val';
$pieces = array(1, 2);
$extra_arg = 10;

var_dump( join($glue, $pieces, $extra_arg) );

// Less than expected number of arguments 
echo "\n-- Testing join() with less than expected no. of arguments --\n";
$glue = 'string_val';
 
var_dump( join($glue));

echo "Done\n";
?>
--EXPECTF--
*** Testing join() : error conditions ***

-- Testing join() function with Zero arguments --

Warning: Wrong parameter count for join() in %s on line %d
NULL

-- Testing join() function with more than expected no. of arguments --

Warning: Wrong parameter count for join() in %s on line %d
NULL

-- Testing join() with less than expected no. of arguments --

Warning: join(): Argument to join must be an array in %s on line %d
bool(false)
Done
--UEXPECTF--
*** Testing join() : error conditions ***

-- Testing join() function with Zero arguments --

Warning: Wrong parameter count for join() in %s on line %d
NULL

-- Testing join() function with more than expected no. of arguments --

Warning: Wrong parameter count for join() in %s on line %d
NULL

-- Testing join() with less than expected no. of arguments --

Warning: join(): Argument to join must be an array in %s on line %d
bool(false)
Done

http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/strings/join_variation1.phpt?view=markup&rev=1.1
Index: php-src/ext/standard/tests/strings/join_variation1.phpt
+++ php-src/ext/standard/tests/strings/join_variation1.phpt
--TEST--
Test join() function : usage variations - unexpected values for 'glue' argument
--FILE--
<?php
/* Prototype  : string join( string $glue, array $pieces )
 * Description: Join array elements with a string
 * Source code: ext/standard/string.c
 * Alias of function: implode()
*/

/*
 * testing join() by passing different unexpected values for glue argument
*/

echo "*** Testing join() : usage variations ***\n";
// initialize all required variables
$pieces = array("element1", "element2");

// get an unset variable
$unset_var = 'string_val';
unset($unset_var);

// get a resource variable
$fp = fopen(__FILE__, "r");

// define a class
class test
{
   var $t = 10;
   function __toString() {
     return  "testObject";
   }
}

// array with different values
$values =  array (

  // integer values
  0,
  1,
  12345,
  -2345,

  // float values
  10.5,
  -10.5,
  10.5e10,
  10.6E-10,
  .5,

  // array values
  array(),
  array(0),
  array(1),
  array(1, 2),
  array('color' => 'red', 'item' => 'pen'),

  // boolean values
  true,
  false,
  TRUE,
  FALSE,

  // objects
  new test(),

  // empty string
  "",
  '',

  // null vlaues
  NULL,
  null,
  
  // resource variable
  $fp,

  // undefined variable
  @$undefined_var,

  // unset variable
  @$unset_var
);


// loop through each element of the array and check the working of join()
// when $glue arugment is supplied with different values
echo "\n--- Testing join() by supplying different values for 'glue' argument 
---\n";
$counter = 1;
for($index = 0; $index < count($values); $index ++) {
  echo "-- Iteration $counter --\n";
  $glue = $values [$index];

  var_dump( join($glue, $pieces) );

  $counter ++;
}

echo "Done\n";
?>
--EXPECTF--
*** Testing join() : usage variations ***

--- Testing join() by supplying different values for 'glue' argument ---
-- Iteration 1 --
string(17) "element10element2"
-- Iteration 2 --
string(17) "element11element2"
-- Iteration 3 --
string(21) "element112345element2"
-- Iteration 4 --
string(21) "element1-2345element2"
-- Iteration 5 --
string(20) "element110.5element2"
-- Iteration 6 --
string(21) "element1-10.5element2"
-- Iteration 7 --
string(28) "element1105000000000element2"
-- Iteration 8 --
string(23) "element11.06E-9element2"
-- Iteration 9 --
string(19) "element10.5element2"
-- Iteration 10 --

Notice: Array to string conversion in %s on line %d
string(0) ""
-- Iteration 11 --

Notice: Array to string conversion in %s on line %d
string(1) "0"
-- Iteration 12 --

Notice: Array to string conversion in %s on line %d
string(1) "1"
-- Iteration 13 --

Notice: Array to string conversion in %s on line %d
string(7) "1Array2"
-- Iteration 14 --

Notice: Array to string conversion in %s on line %d
string(11) "redArraypen"
-- Iteration 15 --
string(17) "element11element2"
-- Iteration 16 --
string(16) "element1element2"
-- Iteration 17 --
string(17) "element11element2"
-- Iteration 18 --
string(16) "element1element2"
-- Iteration 19 --
string(26) "element1testObjectelement2"
-- Iteration 20 --
string(16) "element1element2"
-- Iteration 21 --
string(16) "element1element2"
-- Iteration 22 --
string(16) "element1element2"
-- Iteration 23 --
string(16) "element1element2"
-- Iteration 24 --
string(30) "element1Resource id #%delement2"
-- Iteration 25 --
string(16) "element1element2"
-- Iteration 26 --
string(16) "element1element2"
Done
--UEXPECTF--
*** Testing join() : usage variations ***

--- Testing join() by supplying different values for 'glue' argument ---
-- Iteration 1 --
unicode(17) "element10element2"
-- Iteration 2 --
unicode(17) "element11element2"
-- Iteration 3 --
unicode(21) "element112345element2"
-- Iteration 4 --
unicode(21) "element1-2345element2"
-- Iteration 5 --
unicode(20) "element110.5element2"
-- Iteration 6 --
unicode(21) "element1-10.5element2"
-- Iteration 7 --
unicode(28) "element1105000000000element2"
-- Iteration 8 --
unicode(23) "element11.06E-9element2"
-- Iteration 9 --
unicode(19) "element10.5element2"
-- Iteration 10 --

Notice: Array to string conversion in %s on line %d
unicode(0) ""
-- Iteration 11 --

Notice: Array to string conversion in %s on line %d
unicode(1) "0"
-- Iteration 12 --

Notice: Array to string conversion in %s on line %d
unicode(1) "1"
-- Iteration 13 --

Notice: Array to string conversion in %s on line %d
unicode(7) "1Array2"
-- Iteration 14 --

Notice: Array to string conversion in %s on line %d
unicode(11) "redArraypen"
-- Iteration 15 --
unicode(17) "element11element2"
-- Iteration 16 --
unicode(16) "element1element2"
-- Iteration 17 --
unicode(17) "element11element2"
-- Iteration 18 --
unicode(16) "element1element2"
-- Iteration 19 --
unicode(26) "element1testObjectelement2"
-- Iteration 20 --
unicode(16) "element1element2"
-- Iteration 21 --
unicode(16) "element1element2"
-- Iteration 22 --
unicode(16) "element1element2"
-- Iteration 23 --
unicode(16) "element1element2"
-- Iteration 24 --
unicode(30) "element1Resource id #%delement2"
-- Iteration 25 --
unicode(16) "element1element2"
-- Iteration 26 --
unicode(16) "element1element2"
Done

http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/strings/join_basic.phpt?view=markup&rev=1.1
Index: php-src/ext/standard/tests/strings/join_basic.phpt
+++ php-src/ext/standard/tests/strings/join_basic.phpt
--TEST--
Test join() function : basic functionality 
--FILE--
<?php
/* Prototype  : string join( string $glue, array $pieces )
 * Description: Join array elements with a string
 * Source code: ext/standard/string.c
 * Alias of function: implode()
*/

echo "*** Testing join() : basic functionality ***\n";

// Initialize all required variables
$glue = ',';
$pieces = array(1, 2, 3, 4);

// pieces as arry with numeric values
var_dump( join($glue, $pieces) );

// pieces as array with strings values
$glue = ", "; // multiple car as glue
$pieces = array("Red", "Green", "Blue", "Black", "White");
var_dump( join($glue, $pieces) );

// pices as associative array (numeric values)
$pieces = array("Hour" => 10, "Minute" => 20, "Second" => 40);
$glue = ':';
var_dump( join($glue, $pieces) );

// pices as associative array (string/numeric values)
$pieces = array("Day" => 'Friday', "Month" => "September", "Year" => 2007);
$glue = "/";
var_dump( join($glue, $pieces) );

echo "Done\n";
?>
--EXPECTF--
*** Testing join() : basic functionality ***
string(7) "1,2,3,4"
string(30) "Red, Green, Blue, Black, White"
string(8) "10:20:40"
string(21) "Friday/September/2007"
Done
--UEXPECTF--
*** Testing join() : basic functionality ***
unicode(7) "1,2,3,4"
unicode(30) "Red, Green, Blue, Black, White"
unicode(8) "10:20:40"
unicode(21) "Friday/September/2007"
Done

http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/strings/join_variation2.phpt?view=markup&rev=1.1
Index: php-src/ext/standard/tests/strings/join_variation2.phpt
+++ php-src/ext/standard/tests/strings/join_variation2.phpt
--TEST--
Test join() function : usage variations - unexpected values for 'pieces' 
argument(Bug#42789)
--FILE--
<?php
/* Prototype  : string join( string $glue, array $pieces )
 * Description: Join array elements with a string
 * Source code: ext/standard/string.c
 * Alias of function: implode()
*/

/*
 * test join() by passing different unexpected value for pieces argument
*/

echo "*** Testing join() : usage variations ***\n";
// initialize all required variables
$glue = '::';

// get an unset variable
$unset_var = array(1, 2);
unset($unset_var);

// get a resouce variable
$fp = fopen(__FILE__, "r");

// define a class
class test
{
  var $t = 10;
  var $p = 10;
  function __toString() {
    return "testObject";
  }
}

// array with different values
$values =  array (

  // integer values
  0,
  1,
  12345,
  -2345,

  // float values
  10.5,
  -10.5,
  10.5e10,
  10.6E-10,
  .5,

  // boolean values
  true,
  false,
  TRUE,
  FALSE,

  // string values
  "string",
  'string',

  // objects
  new test(),

  // empty string
  "",
  '',

  // null vlaues
  NULL,
  null,

  // resource variable
  $fp,
 
  // undefined variable
  @$undefined_var,

  // unset variable
  @$unset_var
);


// loop through each element of the array and check the working of join()
// when $pieces arugment is supplied with different values
echo "\n--- Testing join() by supplying different values for 'pieces' argument 
---\n";
$counter = 1;
for($index = 0; $index < count($values); $index ++) {
  echo "-- Iteration $counter --\n";
  $pieces = $values [$index];

  var_dump( join($glue, $pieces) );

  $counter ++;
}

echo "Done\n";
?>
--EXPECTF--
*** Testing join() : usage variations ***

--- Testing join() by supplying different values for 'pieces' argument ---
-- Iteration 1 --

Warning: join(): Bad arguments in %s on line %d
NULL
-- Iteration 2 --

Warning: join(): Bad arguments in %s on line %d
NULL
-- Iteration 3 --

Warning: join(): Bad arguments in %s on line %d
NULL
-- Iteration 4 --

Warning: join(): Bad arguments in %s on line %d
NULL
-- Iteration 5 --

Warning: join(): Bad arguments in %s on line %d
NULL
-- Iteration 6 --

Warning: join(): Bad arguments in %s on line %d
NULL
-- Iteration 7 --

Warning: join(): Bad arguments in %s on line %d
NULL
-- Iteration 8 --

Warning: join(): Bad arguments in %s on line %d
NULL
-- Iteration 9 --

Warning: join(): Bad arguments in %s on line %d
NULL
-- Iteration 10 --

Warning: join(): Bad arguments in %s on line %d
NULL
-- Iteration 11 --

Warning: join(): Bad arguments in %s on line %d
NULL
-- Iteration 12 --

Warning: join(): Bad arguments in %s on line %d
NULL
-- Iteration 13 --

Warning: join(): Bad arguments in %s on line %d
NULL
-- Iteration 14 --

Warning: join(): Bad arguments in %s on line %d
NULL
-- Iteration 15 --

Warning: join(): Bad arguments in %s on line %d
NULL
-- Iteration 16 --

Warning: join(): Bad arguments in %s on line %d
NULL
-- Iteration 17 --

Warning: join(): Bad arguments in %s on line %d
NULL
-- Iteration 18 --

Warning: join(): Bad arguments in %s on line %d
NULL
-- Iteration 19 --

Warning: join(): Bad arguments in %s on line %d
NULL
-- Iteration 20 --

Warning: join(): Bad arguments in %s on line %d
NULL
-- Iteration 21 --

Warning: join(): Bad arguments in %s on line %d
NULL
-- Iteration 22 --

Warning: join(): Bad arguments in %s on line %d
NULL
-- Iteration 23 --

Warning: join(): Bad arguments in %s on line %d
NULL
Done
--UEXPECTF--
*** Testing join() : usage variations ***

--- Testing join() by supplying different values for 'pieces' argument ---
-- Iteration 1 --

Warning: join(): Bad arguments in %s on line %d
NULL
-- Iteration 2 --

Warning: join(): Bad arguments in %s on line %d
NULL
-- Iteration 3 --

Warning: join(): Bad arguments in %s on line %d
NULL
-- Iteration 4 --

Warning: join(): Bad arguments in %s on line %d
NULL
-- Iteration 5 --

Warning: join(): Bad arguments in %s on line %d
NULL
-- Iteration 6 --

Warning: join(): Bad arguments in %s on line %d
NULL
-- Iteration 7 --

Warning: join(): Bad arguments in %s on line %d
NULL
-- Iteration 8 --

Warning: join(): Bad arguments in %s on line %d
NULL
-- Iteration 9 --

Warning: join(): Bad arguments in %s on line %d
NULL
-- Iteration 10 --

Warning: join(): Bad arguments in %s on line %d
NULL
-- Iteration 11 --

Warning: join(): Bad arguments in %s on line %d
NULL
-- Iteration 12 --

Warning: join(): Bad arguments in %s on line %d
NULL
-- Iteration 13 --

Warning: join(): Bad arguments in %s on line %d
NULL
-- Iteration 14 --

Warning: join(): Bad arguments in %s on line %d
NULL
-- Iteration 15 --

Warning: join(): Bad arguments in %s on line %d
NULL
-- Iteration 16 --

Warning: join(): Bad arguments in %s on line %d
NULL
-- Iteration 17 --

Warning: join(): Bad arguments in %s on line %d
NULL
-- Iteration 18 --

Warning: join(): Bad arguments in %s on line %d
NULL
-- Iteration 19 --

Warning: join(): Bad arguments in %s on line %d
NULL
-- Iteration 20 --

Warning: join(): Bad arguments in %s on line %d
NULL
-- Iteration 21 --

Warning: join(): Bad arguments in %s on line %d
NULL
-- Iteration 22 --

Warning: join(): Bad arguments in %s on line %d
NULL
-- Iteration 23 --

Warning: join(): Bad arguments in %s on line %d
NULL
Done

http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/strings/join_variation3.phpt?view=markup&rev=1.1
Index: php-src/ext/standard/tests/strings/join_variation3.phpt
+++ php-src/ext/standard/tests/strings/join_variation3.phpt
--TEST--
Test join() function : usage variations - different values for 'pieces' argument
--FILE--
<?php
/* Prototype  : string join( string $glue, array $pieces )
 * Description: Join array elements with a string
 * Source code: ext/standard/string.c
 * Alias of function: implode()
*/

/*
 * test join() by giving different pieces values 
*/

echo "*** Testing join() : usage variations ***\n";

$pieces_arrays = array (
  array(1, 2), // array with default keys and numrice values
  array(1.1, 2.2), // array with default keys & float values
  array( array(2), array(1)), // sub arrays
  array(false,true), // array with default keys and boolean values
  array(), // empty array
  array(NULL), // array with NULL
  array("a","aaaa","b","bbbb","c","ccccc"),
  
  // associative arrays
  array(1 => "one", 2 => "two", 3 => "three"),  // explicit numeric keys, 
string values
  array("one" => 1, "two" => 2, "three" => 3 ),  // string keys & numeric values
  array( 1 => 10, 2 => 20, 4 => 40, 3 => 30),  // explicit numeric keys and 
numeric values
  array( "one" => "ten", "two" => "twenty", "three" => "thirty"),  // string 
key/value
  array("one" => 1, 2 => "two", 4 => "four"),  //mixed
  
  // associative array, containing null/empty/boolean values as key/value
  array(NULL => "NULL", null => "null", "NULL" => NULL, "null" => null),
  array(true => "true", false => "false", "false" => false, "true" => true),
  array("" => "emptyd", '' => 'emptys', "emptyd" => "", 'emptys' => ''),
  array(1 => '', 2 => "", 3 => NULL, 4 => null, 5 => false, 6 => true),
  array('' => 1, "" => 2, NULL => 3, null => 4, false => 5, true => 6),
  
  // array with repetative keys
  array("One" => 1, "two" => 2, "One" => 10, "two" => 20, "three" => 3)
);

// a multichar glue value
$glue = "], [";

// loop through each $pieces_arrays element and call join()
$iteration = 1;
for($index = 0; $index < count($pieces_arrays); $index ++) {
  echo "-- Iteration $iteration --\n";
  var_dump( join($glue, $pieces_arrays[$index]) );
  $iteration ++;
}
 
echo "Done\n";
?>
--EXPECTF--
*** Testing join() : usage variations ***
-- Iteration 1 --
string(6) "1], [2"
-- Iteration 2 --
string(10) "1.1], [2.2"
-- Iteration 3 --

Notice: Array to string conversion in %s on line %d

Notice: Array to string conversion in %s on line %d
string(14) "Array], [Array"
-- Iteration 4 --
string(5) "], [1"
-- Iteration 5 --
string(0) ""
-- Iteration 6 --
string(0) ""
-- Iteration 7 --
string(36) "a], [aaaa], [b], [bbbb], [c], [ccccc"
-- Iteration 8 --
string(19) "one], [two], [three"
-- Iteration 9 --
string(11) "1], [2], [3"
-- Iteration 10 --
string(20) "10], [20], [40], [30"
-- Iteration 11 --
string(23) "ten], [twenty], [thirty"
-- Iteration 12 --
string(16) "1], [two], [four"
-- Iteration 13 --
string(12) "null], [], ["
-- Iteration 14 --
string(22) "true], [false], [], [1"
-- Iteration 15 --
string(14) "emptys], [], ["
-- Iteration 16 --
string(21) "], [], [], [], [], [1"
-- Iteration 17 --
string(11) "4], [5], [6"
-- Iteration 18 --
string(13) "10], [20], [3"
Done
--UEXPECTF--
*** Testing join() : usage variations ***
-- Iteration 1 --
unicode(6) "1], [2"
-- Iteration 2 --
unicode(10) "1.1], [2.2"
-- Iteration 3 --

Notice: Array to string conversion in %s on line %d

Notice: Array to string conversion in %s on line %d
unicode(14) "Array], [Array"
-- Iteration 4 --
unicode(5) "], [1"
-- Iteration 5 --
unicode(0) ""
-- Iteration 6 --
unicode(0) ""
-- Iteration 7 --
unicode(36) "a], [aaaa], [b], [bbbb], [c], [ccccc"
-- Iteration 8 --
unicode(19) "one], [two], [three"
-- Iteration 9 --
unicode(11) "1], [2], [3"
-- Iteration 10 --
unicode(20) "10], [20], [40], [30"
-- Iteration 11 --
unicode(23) "ten], [twenty], [thirty"
-- Iteration 12 --
unicode(16) "1], [two], [four"
-- Iteration 13 --
unicode(12) "null], [], ["
-- Iteration 14 --
unicode(22) "true], [false], [], [1"
-- Iteration 15 --
unicode(14) "emptys], [], ["
-- Iteration 16 --
unicode(21) "], [], [], [], [], [1"
-- Iteration 17 --
unicode(11) "4], [5], [6"
-- Iteration 18 --
unicode(13) "10], [20], [3"
Done

http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/strings/join_variation4.phpt?view=markup&rev=1.1
Index: php-src/ext/standard/tests/strings/join_variation4.phpt
+++ php-src/ext/standard/tests/strings/join_variation4.phpt
--TEST--
Test join() function : usage variations - different values for 'glue' argument
--FILE--
<?php
/* Prototype  : string join( string $glue, array $pieces )
 * Description: Join array elements with a string
 * Source code: ext/standard/string.c
 * Alias of function: implode()
*/

/*
 * test join() by passing different glue arguments
*/

echo "*** Testing join() : usage variations ***\n";

$glues = array (
  "TRUE",
  true,
  false,
  array("key1", "key2"),
  "",
  " ",
  "string\x00between",
  -1.566599999999999,
  NULL,
  -0,
  '\0'
);

$pieces = array (
  2,
  0,
  -639,
  -1.3444,
  true,
  "PHP",
  false,
  NULL,
  "",
  " ",
  6999.99999999,
  "string\x00with\x00...\0"
);
/* loop through  each element of $glues and call join */
$counter = 1;
for($index = 0; $index < count($glues); $index ++) {
  echo "-- Iteration $counter --\n";
  var_dump( join($glues[$index], $pieces) );
  $counter++;
}

echo "Done\n";
?>
--EXPECTF--
*** Testing join() : usage variations ***
-- Iteration 1 --
string(91) "2TRUE0TRUE-639TRUE-1.3444TRUE1TRUEPHPTRUETRUETRUETRUE 
TRUE6999.99999999TRUEstring
-- Iteration 2 --
string(58) "2101-6391-1.3444111PHP1111 16999.999999991string
-- Iteration 3 --
string(47) "20-639-1.34441PHP 6999.99999999string
-- Iteration 4 --

Notice: Array to string conversion in %s on line %d
string(13) "key1Arraykey2"
-- Iteration 5 --
string(47) "20-639-1.34441PHP 6999.99999999string
-- Iteration 6 --
string(58) "2 0 -639 -1.3444 1 PHP      6999.99999999 string
-- Iteration 7 --
string(201) "2string
-- Iteration 8 --
string(124) 
"2-1.56660-1.5666-639-1.5666-1.3444-1.56661-1.5666PHP-1.5666-1.5666-1.5666-1.5666
 -1.56666999.99999999-1.5666string
-- Iteration 9 --
string(47) "20-639-1.34441PHP 6999.99999999string
-- Iteration 10 --
string(58) "2000-6390-1.3444010PHP0000 06999.999999990string
-- Iteration 11 --
string(69) "2\00\0-639\0-1.3444\01\0PHP\0\0\0\0 \06999.99999999\0string
Done
--UEXPECTF--
*** Testing join() : usage variations ***
-- Iteration 1 --
unicode(91) "2TRUE0TRUE-639TRUE-1.3444TRUE1TRUEPHPTRUETRUETRUETRUE 
TRUE6999.99999999TRUEstring
-- Iteration 2 --
unicode(58) "2101-6391-1.3444111PHP1111 16999.999999991string
-- Iteration 3 --
unicode(47) "20-639-1.34441PHP 6999.99999999string
-- Iteration 4 --

Notice: Array to string conversion in %s on line %d
unicode(13) "key1Arraykey2"
-- Iteration 5 --
unicode(47) "20-639-1.34441PHP 6999.99999999string
-- Iteration 6 --
unicode(58) "2 0 -639 -1.3444 1 PHP      6999.99999999 string
-- Iteration 7 --
unicode(201) "2string
-- Iteration 8 --
unicode(124) 
"2-1.56660-1.5666-639-1.5666-1.3444-1.56661-1.5666PHP-1.5666-1.5666-1.5666-1.5666
 -1.56666999.99999999-1.5666string
-- Iteration 9 --
unicode(47) "20-639-1.34441PHP 6999.99999999string
-- Iteration 10 --
unicode(58) "2000-6390-1.3444010PHP0000 06999.999999990string
-- Iteration 11 --
unicode(69) "2\00\0-639\0-1.3444\01\0PHP\0\0\0\0 \06999.99999999\0string
Done

http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/strings/join_variation5.phpt?view=markup&rev=1.1
Index: php-src/ext/standard/tests/strings/join_variation5.phpt
+++ php-src/ext/standard/tests/strings/join_variation5.phpt
--TEST--
Test join() function : usage variations - sub array as argument 
--FILE--
<?php
/* Prototype  : string join( string $glue, array $pieces )
 * Description: Join array elements with a string
 * Source code: ext/standard/string.c
 * Alias of function: implode()
*/

/*
 * test join() by passing pieces as array containing sub array(s)
*/

echo "*** Testing implode() : usage variations - sub arrays ***\n";
$sub_array = array(array(1,2,3,4), array(1 => "one", 2 => "two"), "PHP", 50);

// pieces as array containing sub array
var_dump( join("TEST", $sub_array) );

// glue as array & pieces as array containing sub array
var_dump( join(array(1, 2, 3, 4), $sub_array) );

// numeric value as glue, pieces as array containg subarray
var_dump( join(2, $sub_array) );

// using direclty the sub_array inside an array as pieces
var_dump( join(", ", $sub_array[0]) );
var_dump( join(", ", $sub_array[1]) );

echo "Done\n";
?>
--EXPECTF--
*** Testing implode() : usage variations - sub arrays ***

Notice: Array to string conversion in %s on line %d

Notice: Array to string conversion in %s on line %d
string(27) "ArrayTESTArrayTESTPHPTEST50"

Notice: Array to string conversion in %s on line %d
string(19) "1Array2Array3Array4"

Notice: Array to string conversion in %s on line %d

Notice: Array to string conversion in %s on line %d
string(18) "Array2Array2PHP250"
string(10) "1, 2, 3, 4"
string(8) "one, two"
Done
--UEXPECTF--
*** Testing implode() : usage variations - sub arrays ***

Notice: Array to string conversion in %s on line %d

Notice: Array to string conversion in %s on line %d
unicode(27) "ArrayTESTArrayTESTPHPTEST50"

Notice: Array to string conversion in %s on line %d
unicode(19) "1Array2Array3Array4"

Notice: Array to string conversion in %s on line %d

Notice: Array to string conversion in %s on line %d
unicode(18) "Array2Array2PHP250"
unicode(10) "1, 2, 3, 4"
unicode(8) "one, two"
Done

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

Reply via email to