php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #20373 T_OBJECT_OPERATOR parse error should not happen
Submitted: 2002-11-11 17:35 UTC Modified: 2003-01-02 18:38 UTC
Votes:3
Avg. Score:4.3 ± 0.9
Reproduced:3 of 3 (100.0%)
Same Version:1 (33.3%)
Same OS:2 (66.7%)
From: rkb at femkant dot dk Assigned:
Status: No Feedback Package: Scripting Engine problem
PHP Version: 4CVS-2002-11-11 OS: Linux
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: rkb at femkant dot dk
New email:
PHP Version: OS:

 

 [2002-11-11 17:35 UTC] rkb at femkant dot dk
The following script produces a "Parse error, unexpected 
T_OBJECT_OPERATOR in ..." message: 
 
class A {} 
 
class B { 
    var $name = "A"; 
	 
    function test() { 
        new $this->name; 
    } 
} 
 
The following change will succeed: 
- new $this->name; 
+ $tmp = $this->name; 
+ new $tmp; 
 

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-12-08 16:28 UTC] iliaa@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php4-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php4-win32-latest.zip


 [2003-01-02 18:38 UTC] sniper@php.net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.


 [2003-11-20 02:14 UTC] jonny at sanriowasteland dot net
I tested the code givin with PHP5 beta 2, and everything works as expected.
 [2006-01-28 02:24 UTC] h4lfl1ng at inbox dot com
PHP Version 4.4.2

<?php
mysql_connect("localhost", "username", "password") or die(mysql_error());
mysql_select_db("database") or die(mysql_error());

$doc = new DOMDocument();
@$doc->loadHTML(file_get_contents('filewithlinks.html'));

$links = $doc->getElementsByTagName('a');

for ($i = 0; $i < $links->length; $i++) {
  $value = addslashes($links->item($i)->nodeValue);
  $href = addslashes($links->item($i)->getAttribute('href'));
  
        mysql_query("INSERT INTO bookmarks(url, title) VALUES('$href', '$value' ) ")
        or die(mysql_error());  
    
}
    echo $i . " Bookmarks Imported";
    
?>

I get the same error. On line 11 & 12 where $value & $href exist.

Parse error: syntax error, unexpected T_OBJECT_OPERATOR in ...

It works in PHP5, but not in php4.4.2
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Oct 16 01:01:28 2024 UTC