1

Error picture

I have this code:

<?php
class Test2
{
    public function hello()
    {
        echo "hello";
    }
}

$t=new Test2(); //Class 'Test2' not found
echo $t->hello();`

Zend Studio gives me the error

Class 'Test2' not found

But as you can see, class Test2 does exist.

Here is a screenshot of the situation:

Error picture

Can someone help me solve this problem?
My Zend studio version is 13.61

If I automatically create a new class Test2 according to the error message, I will get another error: this class has been created. Besides, this Test2 is hand-made by me and can't be wrong. In my completely correct project, about 50% of the classes will prompt this error. So I created a new test php file to test the strange problem of recreating. This obvious problem really makes people collapse! I have more than 10 years of php work experience! Thank you very much for your answer.

This program is obviously no problem, it can also run normally in the browser! I think it is the Zend Studio's mistake, and I prefer ZendStudio,so i want to use it's latest version . This issue is only available in the 13.6.1 version. Zend studio 13 does not have this problem. But I want to use the latest version. I just ran it in the browser just now, to make sure that the output hello can be run normally. However, ZendStudio forces it into debug mode and generates a breakpoint on the first line of this file (test.php). I need to continue to execute to get the result: hello. This is another annoying part of ZendStudio. It is also a bug that needs to be solved. In fact, I have more than 18 years of programming experience. ZendStudo has also been used for a few years. This kind of problem happened for the first time. It is estimated to be a bug in zendstudio. But ZendStudio 13.6.1 seems to have been out for a year now? How could there be such a mistake? Can someone help me?

renqi chen
  • 11
  • 4
  • Welcome to Stack Overflow! I have edited your question. I have put the error message in text. In this particular case, the image is helpful, so I've added it. However, most of the time, an image of an error is not useful, because they are not indexed by search engines. So, I've made sure that the actual text of the error message is in your question. This should help people find the question. Also, good that you told us the product version - well done! Good luck, hope someone here can help you! – S.L. Barth is on codidact.com Aug 15 '18 at 10:25
  • Also... what happens if you click "Create class 'Test2'" ? And, maybe your Test2 class actually _does_ have a different name? Some characters look very similar, like "l" and "1". It's possible that your `Test2` class accidentally uses a foreign symbol, that looks (almost) exactly like another character. – S.L. Barth is on codidact.com Aug 15 '18 at 10:27
  • 1
    If I automatically create a new class Test2 according to the error message, I will get another error: this class has been created. Besides, this Test2 is hand-made by me and can't be wrong. In my completely correct project, about 50% of the classes will prompt this error. So I created a new test php file to test the strange problem of recreating. This obvious problem really makes people collapse! I have more than 10 years of php work experience! Thank you very much for your answer. – renqi chen Aug 16 '18 at 09:11
  • You're welcome. And good work on the edits! There's not much more than I can do for you, unfortunately. All we can do now is wait, and hope that somebody comes along who can help. Good luck! – S.L. Barth is on codidact.com Aug 16 '18 at 09:33

1 Answers1

0

I will suggest you start Zend Studio in a new Workspace(File | Switch Workspace | Others) and try the code. It shouldn't give any error. Here is the screenshot from my Machine(Zend Studio 13.6.1).

enter image description here

PGOEL
  • 566
  • 4
  • 12