Zend Framework

Check to see if DOM extension is available

Details

  • Type: Improvement Improvement
  • Status: Open Open
  • Priority: Minor Minor
  • Resolution: Unresolved
  • Affects Version/s: 1.0.1
  • Fix Version/s: None
  • Component/s: Zend_Gdata
  • Labels:
    None

Description

If PHP was compiled with '--disable-dom', then various classes relied upon by the Zend_Gdata module will not exist and things will break. Right now, this manifests as a "Class 'DOMDocument' not found" error.

Rather than let this happen, a check should be made to see if the DOM extension is loaded, and if it isn't print a descriptive error message to help users understand the problem.

Activity

Hide
Bill Karwin added a comment -

That's a fine idea, but for what it's worth DOM is usually enabled by default. We have used the PHP binary distribution from php.net and Zend Core as our benchmarks for what extensions are built and enabled by default. In both of those distros, DOM is enabled. In such cases, our standard in the past is not to require checks for the extension.

This is mentioned in our [draft coding standards|
http://framework.zend.com/wiki/display/ZFDEV/PHP+Coding+Standard+%28draft%29#PHPCodingStandard%28draft%29-PHPExtensions].

Show
Bill Karwin added a comment - That's a fine idea, but for what it's worth DOM is usually enabled by default. We have used the PHP binary distribution from php.net and Zend Core as our benchmarks for what extensions are built and enabled by default. In both of those distros, DOM is enabled. In such cases, our standard in the past is not to require checks for the extension. This is mentioned in our [draft coding standards| http://framework.zend.com/wiki/display/ZFDEV/PHP+Coding+Standard+%28draft%29#PHPCodingStandard%28draft%29-PHPExtensions].
Hide
Trevor Johns added a comment -

I had previously thought that the DOM extension was safe too.

I just helped a user over at Joyent with this issue. It turns out that they're rolling out a new setup that has many extensions installed but disabled by default for performance reasons. The list of affected extensions is posted here. It's simple enough to re-enable an extension – just modify the configuration in php.ini. However, the error message returned isn't very helpful in pointing users in that direction.

I'm not so sure going by what's in the binary distributions is the best policy, as I'm sure many hosting providers compile their own custom build.

Show
Trevor Johns added a comment - I had previously thought that the DOM extension was safe too. I just helped a user over at Joyent with this issue. It turns out that they're rolling out a new setup that has many extensions installed but disabled by default for performance reasons. The list of affected extensions is posted here. It's simple enough to re-enable an extension – just modify the configuration in php.ini. However, the error message returned isn't very helpful in pointing users in that direction. I'm not so sure going by what's in the binary distributions is the best policy, as I'm sure many hosting providers compile their own custom build.
Hide
Thomas Weidner added a comment -

Assigned to Ryan

Show
Thomas Weidner added a comment - Assigned to Ryan

People

Vote (0)
Watch (1)

Dates

  • Created:
    Updated: