From:             carsten_sttgt at gmx dot de
Operating system: Windows_NT
PHP version:      5.2.4
PHP Bug Type:     MySQLi related
Bug description:  can't call mysqli->set_charset() after mysql_init()

Description:
------------
Hello,

mysqli->set_charset() only works after mysqli->real_connect(), but not
after mysql_init().

BTW:
I don't understand, why there is no MYSQLI_SET_CHARSET_NAME for
mysqli->options()? Because that's the correct way, described in the MySQL C
API.

Regards,
Carsten


Reproduce code:
---------------
----- don't works -----
<?php
$mysqli = mysqli_init();

$mysqli->set_charset('utf8');
echo 'Charset is: ', $mysqli->character_set_name();

$mysqli->real_connect('localhost','root','','test');
?>


----- works -----
<?php
$mysqli = mysqli_init();

$mysqli->real_connect('localhost','root','','test');

$mysqli->set_charset('utf8');
echo 'Charset is: ', $mysqli->character_set_name();
?>


Expected result:
----------------
Charset is: utf8

Actual result:
--------------
Warning: mysqli::set_charset() [function.mysqli-set-charset]: invalid
object or resource mysqli in \test.php on line 4
Charset is:
Warning: mysqli::character_set_name()
[function.mysqli-character-set-name]: invalid object or resource mysqli in
\test.php on line 5

-- 
Edit bug report at http://bugs.php.net/?id=42902&edit=1
-- 
Try a CVS snapshot (PHP 4.4): 
http://bugs.php.net/fix.php?id=42902&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): 
http://bugs.php.net/fix.php?id=42902&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=42902&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=42902&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=42902&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=42902&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=42902&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=42902&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=42902&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=42902&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=42902&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=42902&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=42902&r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=42902&r=php3
Daylight Savings:             http://bugs.php.net/fix.php?id=42902&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=42902&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=42902&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=42902&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=42902&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=42902&r=mysqlcfg

Reply via email to