Built-In PHP Functions Are Not Recognized

Follow

Applies To:

[ Zend Studio 7.0.0 ]
[ All operating systems ]

Symptom

When importing Zend Studio for Eclipse 6.x projects into the workspace of Zend Studio 7.0.0, the standard PHP functions, such as print_r(), explode(), count(), etc. are not recognized as valid functions. Warnings appear in Problems view and in the annotation bar: "Call to undefined function".

Technical Details

This happens because Zend Studio 7.0.0 fails to create a full set of files that define the behavior of a PHP Project. Specifically, the file called '.buildpath' must reside in the project root. This file defines which code libraries are loaded for the project in question. The library that is responsible for built-in PHP functions is called PHP Language Library. In a "healthy" PHP Project this library is displayed in PHP Explorer view:

The projects imported from Zend Studio for Eclipse 6.x don't have this library, or the library entry is displayed empty.

This problem will be fixed in the next version of Zend Studio.

Resolution / Workaround

To workaround this problem the user needs to manually add relevant content into the '.buildpath' file.

  1. Close the project (Project | Close Project).
  2. Open the '.buildpath' file that resides in the project's root directory with a text editor. If the file does not exist, create it.
  3. Paste the correct contents into the '.buildpath' file:
.buildpath contents for a PHP Project
<?xml version="1.0" encoding="UTF-8"?>
<buildpath>
    <buildpathentry kind="src" path=""/>
    <buildpathentry kind="con" path="org.eclipse.php.core.LANGUAGE"/>
</buildpath>

 

.buildpath contents for a Zend Framework Project
<?xml version="1.0" encoding="UTF-8"?>
<buildpath>
    <buildpathentry kind="src" path=""/>
    <buildpathentry kind="con" path="org.eclipse.php.core.LANGUAGE"/>
    <buildpathentry kind="con" path="org.zend.php.framework.CONTAINER"/>
</buildpath>
  1. Save the file.
  2. Open your project (Project | Open Project).
  3. Rebuild the project (Project | Clean).

After the build process finishes, you should see no warnings for standard PHP functions.

 

Note:
Starting with Zend Studio 7.0.1 you can import projects from Zend Studio for Eclipse 6.x using the designated wizard - File | Import, Zend Imports | Import from Zend Studio for Eclipse 6.x.

 


Excerpt: When importing Zend Studio for Eclipse 6.x projects into the workspace of Zend Studio 7.0.0, the standard PHP functions, such as print_r(), explode(), count(), etc. are not recognized as valid functions. This article provides a workaround for this problem.


Original Post Date: 2009-12-25 18:29:13

Alternative Description:

When importing Zend Studio for Eclipse 6.x projects into the workspace of Zend Studio 7.0.0, the standard PHP functions, such as print_r(), explode(), count(), etc. are not recognized as valid functions. This article provides a workaround for this problem.

_____
Tags: .buildpath,Apple OS X 10.7 (Lion),Apple OS X 10.8 (Mountain Lion),Apple OS X 10.9 (Mavericks),Build Path,Call to undefined function,Debian / Ubuntu,MacOS 10.6 and earlier,MS Windows 2003 Server,MS Windows 2008 Server,MS Windows 2012 Server,MS Windows 7,MS Windows 8,MS Windows XP,RedHat Enterprise Linux / CentOS,SUSE Linux Enterprise Server / OpenSUSE,Zend Studio 10.x,Zend Studio 11.x,Zend Studio 7.x,Zend Studio 8.x,Zend Studio 9.x,oldKB,attachment

Have more questions? Submit a request

Comments

Powered by Zendesk