If this is a PHP5 package, I don't see why you're using
a) global constants
b) a singleton object in global namespace. Singletons are to prevent that.
c) The error stack shouldn't be global, an also should be instance-wise. What if I have 2 marc objects that give errors?
d) function &getSubfields - Am I wrong or are objects always passed by ref in PHP5? So the ampersand isn't necessary.
a, b, c) Most of these issues arise largely due to my use of (and undoubtedly my lack of understanding of) PEAR_Errorstack, based on how I have seen other packages implement error-handling with PEAR_Errorstack. For example, I have not yet been able to figure out how to use message templates with a singleton (http://pear.php.net/manual/en/core.pear.pear-errorstack.seterrormessagetemplate.php notes that setErrorMessage() cannot be called statically). At this point, I plan to revise the package to use PEAR_Exception (conforming with the RFC for error-handling in PHP 5 packages) before going stable; these issues will probably go away when I make that switch.
I will turn some of the currently defined global constants into class constants (e.g. FILE_MARC_LEADER_LEN) in the next iteration of this package. But the error codes will remain global constants until I finalize the error-handling for the package.
d) The reference thing was a bit of a hangover from when I first started developing this package. I had thought about creating a PHP 4/5 compatible package, but have since decided to make it a pure PHP 5 package instead. I have now removed all of the extraneous references from this package -- thanks!