kphp icon indicating copy to clipboard operation
kphp copied to clipboard

Confusing error message when using a constant of a nonexistent class

Open i582 opened this issue 5 years ago • 0 comments

Code Example

<?php

use Some\NonExisting;

function f() {
    $a = NonExisting::C;
    echo $a;
}

f();

Actual Behavior

cfg doesnt handle this type of operation: 19
Output
Compilation error at stage: Calc control flow graph, gen by cfg.cpp:1017
 script.php:6  in f
   $a = NonExisting::C;

cfg doesnt handle this type of operation: 19


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Fatal error at stage: Calc control flow graph, gen by cfg.cpp:1018
 script.php:6  in f
   $a = NonExisting::C;

Assertion 0 failed

Compilation failed.
It is probably happened due to incorrect or unsupported PHP input.
But it is still bug in compiler.
[pid 9515] [time 1619890522] SIGABRT caught, terminating program
[pid 9515] [time 1619890522] errno = No such file or directory
[pid 9515] [time 1619890522] 
------- Register Values -------
[pid 9515] [time 1619890522] RIP=0x00007FDCF3D0618B RSP=0x00007FFFD5571F90 RBP=0x00007FFFD55722E0 RDI=0x0000000000000002 RSI=0x00007FFFD5571F90 RDX=0x0000000000000000 RCX=0x0000000000000008 R8=0x0000000000000000 R9=0x00007FFFD5571F90 R10=0x0000000000000008 RBX=0x00007FDCF3C91780 RAX=0x0000000000000000 CR2=0x0000000000000000 R11=0x0000000000000008 R12=0x0000000000000000 R13=0x0000000000000000 R14=0x00007FFFD5575EB0 R15=0x0000000000000003 
[pid 9515] [time 1619890522] 
------- Stack Backtrace -------
/mnt/c/projects/books/kphp/objs/bin/kphp2cpp(_Z15print_backtracev+0x57)[0xc834b0]
/mnt/c/projects/books/kphp/objs/bin/kphp2cpp[0xc83aef]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x15420)[0x7fdcf4232420]
/lib/x86_64-linux-gnu/libc.so.6(gsignal+0xcb)[0x7fdcf3d0618b]
/lib/x86_64-linux-gnu/libc.so.6(abort+0x12b)[0x7fdcf3ce5859]
/mnt/c/projects/books/kphp/objs/bin/kphp2cpp(_Z20on_compilation_errorPKcS0_iS0_12AssertLevelT+0x28e)[0xc1c42e]
/mnt/c/projects/books/kphp/objs/bin/kphp2cpp(_ZN3cfg3CFG10create_cfgE13VertexAdaptorIL9Operation1EEPNS_4NodeES5_bb+0x3ab0)[0xa94386]
/mnt/c/projects/books/kphp/objs/bin/kphp2cpp(_ZN3cfg3CFG10create_cfgE13VertexAdaptorIL9Operation1EEPNS_4NodeES5_bb+0x104e)[0xa91924]
/mnt/c/projects/books/kphp/objs/bin/kphp2cpp(_ZN3cfg3CFG10create_cfgE13VertexAdaptorIL9Operation1EEPNS_4NodeES5_bb+0x1de)[0xa90ab4]
/mnt/c/projects/books/kphp/objs/bin/kphp2cpp(_ZN3cfg3CFG10create_cfgE13VertexAdaptorIL9Operation1EEPNS_4NodeES5_bb+0x3812)[0xa940e8]
/mnt/c/projects/books/kphp/objs/bin/kphp2cpp(_ZN3cfg3CFG16process_functionE2IdI12FunctionDataE+0x174)[0xa97012]
/mnt/c/projects/books/kphp/objs/bin/kphp2cpp(_ZN9CFGBeginF7executeE2IdI12FunctionDataER10DataStreamI14FunctionAndCFGE+0xb9)[0xa97a73]
/mnt/c/projects/books/kphp/objs/bin/kphp2cpp(_ZN4PipeI9CFGBeginF10DataStreamI2IdI12FunctionDataEES1_I14FunctionAndCFGEE13process_inputEOS4_+0x57)[0xb809f9]
/mnt/c/projects/books/kphp/objs/bin/kphp2cpp(_ZN16PipeWithProgressI9CFGBeginF10DataStreamI2IdI12FunctionDataEES1_I14FunctionAndCFGEE13process_inputEOS4_+0x3d)[0xb80979]
/mnt/c/projects/books/kphp/objs/bin/kphp2cpp(_ZN8PipeTaskI4PipeI9CFGBeginF10DataStreamI2IdI12FunctionDataEES2_I14FunctionAndCFGEEE7executeEv+0x5d)[0xb9e609]
/mnt/c/projects/books/kphp/objs/bin/kphp2cpp(_ZN18OneThreadScheduler7executeEv+0xd0)[0xb4b724]
/mnt/c/projects/books/kphp/objs/bin/kphp2cpp(_Z16compiler_executeP16CompilerSettings+0xbc0)[0xb6cba5]
/mnt/c/projects/books/kphp/objs/bin/kphp2cpp(main+0x2ab7)[0x9136c6]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf3)[0x7fdcf3ce70b3]
/mnt/c/projects/books/kphp/objs/bin/kphp2cpp(_start+0x2e)[0x90f8be]
[pid 9515] [time 1619890522] -------------------------------
[pid 9515] [time 1619890522] kphp2cpp compiled at May  1 2021 13:56:06 MSK by gcc 9.3.0 64-bit after commit 95e0d620f88898643c39f83839836adbebe8ea00 [pid 9515] [time 1619890522] 

Process finished with exit code 1

Expected Behavior

Class NonExisting was not found.

i582 avatar May 01 '21 17:05 i582