random_compat: Global namespace collision "Error"

As soon as I upgraded from ramsey/uuid 3.2 to 3.3 via composer, my servers started reporting the following PHP Fatal error:

PHP Fatal error: Call to undefined method Error::GetXML() in [script name]

Downgrading to 3.2, which also removes the prerequisite paragonie/random_compat v2.0.2, fixed the issue.

Issue appears to be in paragonie/random_compat extending Exception with the global name Error.

 // We can't really avoid making this extend Exception in PHP 5.
class Error extends Exception

See: https://github.com/paragonie/random_compat/blob/master/lib/error_polyfill.php

Cheers.

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 16 (8 by maintainers)

Most upvoted comments

If you’re using PostgreSQL and client-side code to generate UUIDs, then you probably won’t run into the collision problem. The collision problem occurs when you are using OpenSSL in PHP running in an forked environment (i.e. Apache, FPM) to generate UUIDs.