Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 311333 - Constants with namespace can not be recognized rightly.
Summary: Constants with namespace can not be recognized rightly.
Status: CLOSED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: PDT (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: PHP Core CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-05-03 02:06 EDT by Zhongwei Zhao CLA
Modified: 2020-05-14 11:18 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Zhongwei Zhao CLA 2010-05-03 02:06:45 EDT
A constant with the format "\a\b\TEST" can be recognized as a php constant in method PhpElementConciliator.concile().
Comment 1 Zhongwei Zhao CLA 2010-05-03 03:22:01 EDT
Add the following method to class PhpElementConciliatorTest


	public void testConcileGlobalConstant() {
		PHPVersion oldversion = ProjectOptions.getPhpVersion(project1);
		boolean versionChanged = false;
		try {
			if (PHPVersion.PHP5_3 != oldversion) {
				PHPCoreTests.setProjectPhpVersion(project1, PHPVersion.PHP5_3);
				versionChanged = true;
			}

		} catch (CoreException e) {
		}

		try {
			IFile file = null;
			try {
				file = setFileContent("<?php namespace NS;define(\"CONSTANT\", \"Hello world.\"); echo \\NS\\CONSTANT;?>");
			} catch (CoreException e) {
				fail(e.getMessage());
			}

			assertNotNull(file);

			Program program = createProgram(file);

			assertNotNull(program);

			// select the function declaration.
			int start = 20;
			ASTNode selectedNode = locateNode(program, start, 0);
			assertNotNull(selectedNode);

			assertEquals(PhpElementConciliator.CONCILIATOR_CONSTANT,
					PhpElementConciliator.concile(selectedNode));

			start = 28;
			selectedNode = locateNode(program, start, 0);
			assertNotNull(selectedNode);

			assertEquals(PhpElementConciliator.CONCILIATOR_CONSTANT,
					PhpElementConciliator.concile(selectedNode));

			start = 51;
			selectedNode = locateNode(program, start, 0);
			assertNotNull(selectedNode);

			assertEquals(PhpElementConciliator.CONCILIATOR_CONSTANT,
					PhpElementConciliator.concile(selectedNode));

			start = 64;
			selectedNode = locateNode(program, start, 0);
			assertNotNull(selectedNode);

			assertEquals(PhpElementConciliator.CONCILIATOR_CONSTANT,
					PhpElementConciliator.concile(selectedNode));
		} finally {
			if (versionChanged) {
				ProjectOptions.setPhpVersion(oldversion, project1);
				PHPCoreTests.waitForAutoBuild();
				PHPCoreTests.waitForIndexer();
			}
		}
	}

	
the code above will break the unit tests,and I think we need support php5.3 in class PhpElementConciliatorTest.
Comment 2 Zhongwei Zhao CLA 2010-05-04 07:10:38 EDT
Sorry there is class PhpElementConciliatorV5_3Test for php5.3.
Comment 3 Zhongwei Zhao CLA 2010-05-06 01:11:26 EDT
fixed in head
Comment 4 Zhongwei Zhao CLA 2010-05-06 01:17:25 EDT
fixed in head
Comment 5 Gadi Goldbarg CLA 2010-05-27 07:49:16 EDT
Closing regarding Zhao`s comment #2

Closed by
Teodor Kirkov
teodor.k@zend.com