php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #7833 Array and class works strange
Submitted: 2000-11-15 12:40 UTC Modified: 2000-12-30 19:57 UTC
From: jens at unfaehig dot de Assigned:
Status: Closed Package: Scripting Engine problem
PHP Version: 4.0.3pl1 OS: Linux
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: jens at unfaehig dot de
New email:
PHP Version: OS:

 

 [2000-11-15 12:40 UTC] jens at unfaehig dot de
I have a class called "foo" with a function "bar".

I define
  $test[1] = new foo;

When I try to use
  $test[1]->bar();
I get an error "Call to a member function on a non-object ".

I would consider this being a bug. 

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-11-21 08:42 UTC] stas@php.net
Could you please give short script example that doesn't work
(including the class, etc.)?
 [2000-11-21 09:30 UTC] jens at unfaehig dot de
<?
class cd_r{
  var $id;
  var $description;
  var $text; 
  var $size; 
  var $count; 

 

  function list_txt(){
   }

  function html_desc(){ }



$temp= new cd_r;
$temp->id='potato_arm_nonus';
$temp->description='Debian GNU/Linux 2.2 rev0 (Potato) f?r arm, offizielle Binary-CDs, mit non-US';
$temp->size=3;
$temp->html_desc="<b>".$temp->description."</b><br/>.$temp->text;
$sets[$i]=$temp;



and then later:

$sets[1]->list_txt();

I have shortened some things, esp. I have deleted the bodies of the member functions of the class.

The bug seems to be known, it is described as a comment in the online docs under www.php3.de (this is the mirrored php.net, isn't it?) in the article about classes.
 [2000-11-21 09:37 UTC] stas@php.net
After correcting numerous syntax errors in your code and
after assuming $i is 1, works like charm for me. What is
value of $i?

Please, just make a full script, ensure that it is
syntactically correct but doesn't run and post it.
 [2000-12-30 19:57 UTC] sniper@php.net
No feedback.

--Jani
 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Wed Jul 15 16:00:01 2026 UTC