force_c_ext.php 503 B

1234567891011121314
  1. <?php
  2. // We have to test this because the command-line argument will fail silently
  3. // if the extension could not be loaded:
  4. // php -dextension=ext/google/protobuf/modules/protouf.so
  5. if (!extension_loaded("protobuf")) {
  6. throw new Exception("Protobuf extension not loaded");
  7. }
  8. spl_autoload_register(function($class) {
  9. if (strpos($class, "Google\\Protobuf") === 0) {
  10. throw new Exception("When using the C extension, we should not load runtime class: " . $class);
  11. }
  12. }, true, true);