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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: rahulagr12345 at yahoo dot com
New email:
PHP Version: OS:

 

 [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

Pull Requests

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-2025 The PHP Group
All rights reserved.
Last updated: Sun Jan 05 05:01:28 2025 UTC