Skip to content

Commit bcb945d

Browse files
authored
Guard browser PHP runner without a client (#1723)
1 parent f2ce655 commit bcb945d

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

packages/wordpress-plugin/assets/browser-runtime.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1921,10 +1921,10 @@ try {
19211921
throw runtimeError( 'validate', 'php_code_missing', 'PHP code is required.' );
19221922
}
19231923

1924-
if ( ! options.forceRequest && typeof client.run === 'function' ) {
1924+
if ( ! options.forceRequest && typeof client?.run === 'function' ) {
19251925
return await runPhpDirect( client, code, options );
19261926
}
1927-
if ( options.forceRequest && typeof client?.writeFile !== 'function' && typeof client.run === 'function' ) {
1927+
if ( options.forceRequest && typeof client?.writeFile !== 'function' && typeof client?.run === 'function' ) {
19281928
return await runPhpDirect( client, code, options );
19291929
}
19301930

@@ -1944,7 +1944,7 @@ try {
19441944
try {
19451945
response = await playgroundRequest( client, request );
19461946
} catch ( error ) {
1947-
if ( options.forceRequest && typeof client.run === 'function' && isPlaygroundStructuredCloneError( error ) ) {
1947+
if ( options.forceRequest && typeof client?.run === 'function' && isPlaygroundStructuredCloneError( error ) ) {
19481948
return await runPhpDirect( client, code, options );
19491949
}
19501950

0 commit comments

Comments
 (0)