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