php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #68550 calling a field using an object type.
Submitted: 2014-12-05 09:47 UTC Modified: 2014-12-05 11:12 UTC
From: rahulagr12345 at yahoo dot com Assigned:
Status: Not a bug Package: PHP Language Specification
PHP Version: 5.4.35 OS: Any
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
8 - 1 = ?
Subscribe to this entry?

 
 [2014-12-05 09:47 UTC] rahulagr12345 at yahoo dot com
Description:
------------
Hi Sir,

I want to know that if i am calling a field using object having a dot[.] in it. leads to problem for me.

Test script:
---------------
field name in database is "pa.ab".

If we fetch data from database using mysql_fetch_object like 

"$database->pa.ab" It will read it as "$database->pa". 

First of all i want to know is this an bug, error or my mistake on it.

and if it an issue to be handle differently then how to handle such cases.

Expected result:
----------------
$database->pa.ab will be read and return the same value as in database

Actual result:
--------------
$database->pa will read by programm and nothing is returned.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2014-12-05 11:12 UTC] ajf@php.net
-Status: Open +Status: Not a bug
 [2014-12-05 11:12 UTC] ajf@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

This isn't a bug. PHP identifiers can't have dots in them, since that's the concatenation operator.

You probably want to do $database->{"pa.ab"}
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 25 02:01:30 2024 UTC