php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #46337 unwanted reaction of compiler engine
Submitted: 2008-10-18 17:44 UTC Modified: 2008-10-18 19:25 UTC
From: webmaster at adriaportal dot com Assigned:
Status: Not a bug Package: Scripting Engine problem
PHP Version: 5.2.6 OS: Windows NT 5.2 build 3790
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: webmaster at adriaportal dot com
New email:
PHP Version: OS:

 

 [2008-10-18 17:44 UTC] webmaster at adriaportal dot com
Description:
------------
Error by using method with name use(); 
!!!! No error with method name changed to _use() !!!!


Reproduce code:
---------------
<?php

class Block {

 private $block = "";
 private $value = "";
 private $name  = "";
 private $out   = "";
 
 function __construct($blockName) {
  $this->name = $blockName;
 }

 public function use() {
  $this->value = $this->block;
  $this->out   = "";
 }

}

?>


Expected result:
----------------
No error.

The word USE is very USED by programming. Here is used in a class block of code as name of method, bud here is a conflict with may by documented keyword use in PHP. The namespace use this keyword.

Actual result:
--------------
Parse error: syntax error, unexpected T_USE, expecting T_STRING in C:\webs\test\bug.php on line 15


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-10-18 18:00 UTC] felipe@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


 [2008-10-18 19:21 UTC] webmaster at adriaportal dot com
I'm cannot english language so good, only pasiv, but why is conflict when word 'use' in this fall is called as part of a structure, a closed block, and the syntax is here $instance->method() and this is different as method() or method. This is a bad isolation of programm blocks. In Java can you write:

public class Use {
 public static void main(String[] args) {
  Use use = new Use();
  use.use();
 }
 public Use() {
 }
 public void use() {
 }
}

And this class work without any problem. And cherio, i'm must work to.
 [2008-10-18 19:25 UTC] webmaster at adriaportal dot com
I'm cannot english language so good, only pasiv, but why is conflict when word 'use' in this fall is called as part of a structure, a closed block, and the syntax is here $instance->method() and this is different as method() or method. This is a bad isolation of programm blocks. In Java can you write:

public class Use {
 public static void main(String[] args) {
  Use use = new Use();
  use.use();
 }
 public Use() {
 }
 public void use() {
 }
}

And this class work without any problem. And cherio, i'm must work to.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Thu Jul 17 14:04:04 2025 UTC