Skip to content
This repository has been archived by the owner on Jan 2, 2019. It is now read-only.

add defined test on some constants to avoid PHP Notice error when using c... #174

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

metfan
Copy link

@metfan metfan commented Apr 29, 2013

I experienced some "PHP Notice constant xxx already defined in..."
I added defined() test on these constants.

@MarkBaker
Copy link
Member

Under what circumstances have you experienced these errors? The autoloader should ensure that the file is only ever included once... if you're getting "Already defined" errors for those constants, then it's symptomatic of a more serious problem with the autoloader, and I'd rather fix that than "patch over" the problem with an if !defined test to see if the constants are already defined

@metfan
Copy link
Author

metfan commented Apr 29, 2013

I had this problem when I launch functionnal test under PHPUnit with @runTestsInSeparateProcesses
I use PHPExcel in Symfony2 application with liuggio/ExcelBundle

@MarkBaker
Copy link
Member

Ah, that explains it... our own unit tests always use the autoloader, so we don't see that issue

@metfan
Copy link
Author

metfan commented Apr 30, 2013

Do you me to add defined() control on all constants?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants