Skip to content

[Bug] php2cpg generate cpg error [php2cpg] #5697

Description

@icepng

Describe the bug
I got NotImplementError,

scala.NotImplementedError: unexpected expression 'PhpListExpr(List(Some(PhpArrayItem(None,PhpVariable(PhpNameExpr(to,PhpAttributes(Some(477),Some(477),None,16740,16743)),PhpAttributes(Some(477),Some(477),None,16740,16743)),false,false,PhpAttributes(Some(477),Some(477),None,16740,16743))), Some(PhpArrayItem(None,PhpVariable(PhpNameExpr(type,PhpAttributes(Some(477),Some(477),None,16745,16750)),PhpAttributes(Some(477),Some(477),None,16745,16750)),false,false,PhpAttributes(Some(477),Some(477),None,16745,16750))), Some(PhpArrayItem(None,PhpVariable(PhpNameExpr(path,PhpAttributes(Some(477),Some(477),None,16752,16757)),PhpAttributes(Some(477),Some(477),None,16752,16757)),false,false,PhpAttributes(Some(477),Some(477),None,16752,16757)))),PhpAttributes(Some(477),Some(477),None,16734,16759))' of type class io.joern.php2cpg.parser.Domain$PhpListExpr                                                                                                                                                    at io.joern.php2cpg.astcreation.AstForExpressionsCreator.astForExpr(AstForExpressionsCreator.scala:55)                                                                                                at io.joern.php2cpg.astcreation.AstForExpressionsCreator.astForExpr$(AstForExpressionsCreator.scala:18)                                                                                               at io.joern.php2cpg.astcreation.AstCreator.astForExpr(AstCreator.scala:18)

the error code is:

foreach ( self::$domain_map as $from => list( $to, $type, $path ) ) {
			$data['domainMap'][ $from ] = ( 'core' === $type ? '' : "{$type}/" ) . $to;
			if ( '' !== $path ) {
				$data['domainPaths'][ $from ] = trailingslashit( $path );
			}
		}

To Reproduce
Steps to reproduce the behavior:

  1. run php2cpg to generage cpg: php2cpg test.php -o test.cpg
  2. get the error above

Desktop (please complete the following information):

  • OS: ubuntu 22.04
  • Joern Version: 4.0.443
  • Java version: openjdk 17.0.16 2025-07-15
  • PHP 8.1.2-1ubuntu2.22 (cli) (built: Jul 15 2025 12:11:22) (NTS)

class-assets.php

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions