Bug #80575 [NEW]: //Type casting of mysqli object to array produces null on every field

From: Date: Sat, 02 Jan 2021 16:43:09 +0000
Subject: Bug #80575 [NEW]: //Type casting of mysqli object to array produces null on every field
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-231335@lists.php.net to get a copy of this message
From:             sapphirerx5700xt at gmail dot com
Operating system: Windwos 10 pro x 64bit 20H2
PHP version:      8.0.0
Package:          Scripting Engine problem
Bug Type:         Bug
Bug description://Type casting of mysqli object to array produces null on every field

Description:
------------
My php version is 8.0.0 ,mysql version is 8.0.22, apache version is
2.4.46

Output is as follows  
object(mysqli)#8 (18) {
  ["affected_rows"]=>
  int(0)
  ["client_info"]=>
  string(13) "mysqlnd 8.0.0"
  ["client_version"]=>
  int(80000)
  ["connect_errno"]=>
  int(0)
  ["connect_error"]=>
  NULL
  ["errno"]=>
  int(0)
  ["error"]=>
  string(0) ""
  ["error_list"]=>
  array(0) {
  }
etc
.......

after type casting everything returns null 

array(18) {
  ["affected_rows"]=>
  NULL
  ["client_info"]=>
  NULL
  ["client_version"]=>
  NULL
  ["connect_errno"]=>
  NULL
  ["connect_error"]=>
  NULL
  ["errno"]=>
  NULL
  ["error"]=>
  NULL
  ["error_list"]=>
  NULL
etc
....

Test script:
---------------
//Type casting of mysqli object to array produces null on every field on
var_dump() and print_r()

$db =
mysqli_connect(hostname:'localhost',username:'root',password:'',database:'tables',port:3306);

echo "<pre>";    // We get output in this case even with var_dump
print_r($db);
echo "</pre>";

echo "<pre>";
print_r((array) $db);  // All fields show null even with var_dump
echo "</pre>";


-- 
Edit bug report at https://bugs.php.net/bug.php?id=80575&edit=1
-- 
Fix committed:                    https://bugs.php.net/fix.php?id=80575&r=fixed
Fixed in release:                 https://bugs.php.net/fix.php?id=80575&r=alreadyfixed
Need backtrace:                   https://bugs.php.net/fix.php?id=80575&r=needtrace
Need Reproduce Script:            https://bugs.php.net/fix.php?id=80575&r=needscript
Try newer version:                https://bugs.php.net/fix.php?id=80575&r=oldversion
Not developer issue:              https://bugs.php.net/fix.php?id=80575&r=support
Expected behavior:                https://bugs.php.net/fix.php?id=80575&r=notwrong
Not enough info:                  https://bugs.php.net/fix.php?id=80575&r=notenoughinfo
Submitted twice:                  https://bugs.php.net/fix.php?id=80575&r=submittedtwice
register_globals:                 https://bugs.php.net/fix.php?id=80575&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=80575&r=phptooold
Daylight Savings:                 https://bugs.php.net/fix.php?id=80575&r=dst
IIS Stability:                    https://bugs.php.net/fix.php?id=80575&r=isapi
Install GNU Sed:                  https://bugs.php.net/fix.php?id=80575&r=gnused
Floating point limitations:       https://bugs.php.net/fix.php?id=80575&r=float
No Zend Extensions:               https://bugs.php.net/fix.php?id=80575&r=nozend
MySQL Configuration Error:        https://bugs.php.net/fix.php?id=80575&r=mysqlcfg


Thread (4 messages)

« previous php.bugs (#231335) next »