Edit report at https://bugs.php.net/bug.php?id=71164&edit=1
ID: 71164
Updated by: [email protected]
Reported by: deemdouxla at gmail dot com
Summary: Array to string convertion error
-Status: Open
+Status: Not a bug
Type: Bug
Package: *General Issues
Operating System: Windows 10 x64 Bit
PHP Version: 7.0.1
Block user comment: N
Private report: N
New Comment:
Expressions like $obj->$arr[0] are evaluated differently in PHP 7 than before.
https://wiki.php.net/rfc/uniform_variable_syntax
Use $obj->{$arr[0]} instead.
Previous Comments:
------------------------------------------------------------------------
[2015-12-19 04:50:01] deemdouxla at gmail dot com
Description:
------------
PHP 7.0.1 Thread Safe on Windows Throws String convertion error.
This happened when I tried to access database object
Test script:
---------------
$obj = $db->results();
$arr = ['tbfield1', 'tbfield2', 'tbfield3'];
// Get column tbfield1
$getColumnArray = $obj->$arr[0]; // Then PHP 7.0.1 throws error String convertion error
Expected result:
----------------
Return array of column from PHP stdClass
Actual result:
--------------
ErrorException: Array to string conversion
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=71164&edit=1
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.