File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / ext / mbstring / tests / bug26639.phpt
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Tue Feb 21 23:47:57 2012 UTC (12 years, 5 months ago) by misho
Branches: php, MAIN
CVS tags: v5_4_3elwix, v5_4_29p0, v5_4_29, v5_4_20p0, v5_4_20, v5_4_17p0, v5_4_17, v5_3_10, HEAD
php

--TEST--
Bug #26639 (mb_convert_variables() clutters variables beyond the references)
--SKIPIF--
<?php extension_loaded('mbstring') or die('skip mbstring not available'); ?>
--FILE--
<?php
$a = "あいうえお";
$b = $a;
mb_convert_variables("EUC-JP", "Shift_JIS", $b);
debug_zval_dump($a);
debug_zval_dump($b);
unset($a);
unset($b);

$a = "あいうえお";
$b = &$a;
mb_convert_variables("EUC-JP", "Shift_JIS", $b);
debug_zval_dump($a);
debug_zval_dump($b);
unset($a);
unset($b);

$a = "あいうえお";
$b = array($a);
$c = $b;
mb_convert_variables("EUC-JP", "Shift_JIS", $c);
debug_zval_dump($b);
debug_zval_dump($c);
unset($a);
unset($b);
unset($c);

$a = "あいうえお";
$b = array(&$a);
$c = $b;
mb_convert_variables("EUC-JP", "Shift_JIS", $c);
debug_zval_dump($b);
debug_zval_dump($c);
unset($a);
unset($b);
unset($c);

$a = "あいうえお";
$b = array($a);
$c = &$b;
mb_convert_variables("EUC-JP", "Shift_JIS", $c);
debug_zval_dump($b);
debug_zval_dump($c);
unset($a);
unset($b);
unset($c);

$a = "あいうえお";
$b = array(&$a);
$c = &$b;
mb_convert_variables("EUC-JP", "Shift_JIS", $c);
debug_zval_dump($b);
debug_zval_dump($c);
unset($a);
unset($b);
unset($c);

$a = array(array("あいうえお"));
$b = $a;
$c = $b;
mb_convert_variables("EUC-JP", "Shift_JIS", $c);
debug_zval_dump($b);
debug_zval_dump($c);
unset($a);
unset($b);
unset($c);
?>
--EXPECT--
string(10) "あいうえお" refcount(2)
string(10) "、「、、、ヲ、ィ、ェ" refcount(2)
string(10) "、「、、、ヲ、ィ、ェ" refcount(1)
string(10) "、「、、、ヲ、ィ、ェ" refcount(1)
array(1) refcount(2){
  [0]=>
  string(10) "あいうえお" refcount(2)
}
array(1) refcount(2){
  [0]=>
  string(10) "、「、、、ヲ、ィ、ェ" refcount(1)
}
array(1) refcount(2){
  [0]=>
  &string(10) "あいうえお" refcount(2)
}
array(1) refcount(2){
  [0]=>
  string(10) "、「、、、ヲ、ィ、ェ" refcount(1)
}
array(1) refcount(1){
  [0]=>
  string(10) "、「、、、ヲ、ィ、ェ" refcount(2)
}
array(1) refcount(1){
  [0]=>
  string(10) "、「、、、ヲ、ィ、ェ" refcount(2)
}
array(1) refcount(1){
  [0]=>
  string(10) "、「、、、ヲ、ィ、ェ" refcount(2)
}
array(1) refcount(1){
  [0]=>
  string(10) "、「、、、ヲ、ィ、ェ" refcount(2)
}
array(1) refcount(3){
  [0]=>
  array(1) refcount(1){
    [0]=>
    string(10) "あいうえお" refcount(1)
  }
}
array(1) refcount(2){
  [0]=>
  array(1) refcount(1){
    [0]=>
    string(10) "、「、、、ヲ、ィ、ェ" refcount(1)
  }
}

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>