Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Development Code Fragment feature is not working #345

Open
chrisyue opened this issue Feb 5, 2016 · 13 comments
Open

Development Code Fragment feature is not working #345

chrisyue opened this issue Feb 5, 2016 · 13 comments
Milestone

Comments

@chrisyue
Copy link

chrisyue commented Feb 5, 2016

$ phpmd --version
PHPMD 2.3.2

$ phpmd path/to/File.php text design

the exit code is 0, but the File.php does contain var_dump and print_r

and the other features in design are working i think (I only test checking die/exit, goto, eval)

@ravage84 ravage84 added the Bug label Feb 5, 2016
@ravage84 ravage84 added this to the 2.3.3 milestone Feb 5, 2016
@ravage84 ravage84 modified the milestones: 2.3.3, 2.4.2 Mar 8, 2016
@manuelpichler manuelpichler modified the milestones: 2.4.2, 2.4.3 Mar 10, 2016
@manuelpichler
Copy link
Contributor

Can you please provide a reproducable file for this issue

@chrisyue
Copy link
Author

@manuelpichler here is the file content:

<?php

namespace AppBundle\Controller\Front;

use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request;

/**
 * @Route("/hotsale")
 */
class HotSaleController extends Controller
{
    /**
     * @Route("/", name="front_hotsale_index", methods={"GET"})
     */
    public function indexAction(Request $request)
    {
        $hotsales = $this->getDoctrine()->getRepository('AppBundle:HotSale')
            ->createQueryBuilder('h')
            ->select('h, v')
            ->join('h.video', 'v')
            ->orderBy('h.sequence')
            ->getQuery()
            ->getResult();

        var_dump($hotsales);

        $banners = $this->get('app.banner.file_manager')->findAll();

        return $this->render('front/hotsale/index.html.twig', compact('hotsales', 'banners'));
    }
}

and I also found it maybe related to the namespace, because it can work after I remove the line of namespace declaration.

@chrisyue
Copy link
Author

Maybe PHPMD thinks var_dump is AppBundle\Controller\Front\var_dump?

@ravage84
Copy link
Member

@chrisyue can you reduce the example to the following and still confirm the issue?

<?php

namespace AppBundle\Controller\Front;

class Foo
{
    public function testFoo()
    {
        var_dump($hotsales = '');
    }
}

@chrisyue
Copy link
Author

@ravage84 same issue, won't work until I remove namespace.

And it is also strange that it shows the message The method Foo::testFoo() calls the typical debug function var_dump() which is mostly only used during development. twice, it should show only once? Maybe it's another issue, I don't know..

@ravage84 ravage84 modified the milestones: 2.4.3, 2.4.4 Apr 25, 2016
@torkiljohnsen
Copy link

I can confirm this issue.

@manuelpichler
Copy link
Contributor

Works in the latest version that will be release today.

@chilion
Copy link

chilion commented Mar 14, 2017

Any clue when this will be fixed? Our builds are not failing while they should now :octocat:

@ravage84
Copy link
Member

@chilion have you updated PHPMD and PDepend to the newest version? With which version of these tools are you seeing this issue, still?

@chilion
Copy link

chilion commented Mar 14, 2017

@ravage84 phpmd version 2.6.0 && pdepend version 2.5.0

@qkdreyer
Copy link

qkdreyer commented Dec 5, 2017

Still an issue for me :

image

@stepansib
Copy link

Same for me(
phpmd 2.6.0

@kylekatarnls kylekatarnls removed this from the 2.7.1 milestone Oct 19, 2019
@kylekatarnls kylekatarnls added this to the 2.8.1 milestone Oct 19, 2019
@kylekatarnls kylekatarnls modified the milestones: 2.8.1, 2.8.2 Dec 27, 2019
@kylekatarnls kylekatarnls modified the milestones: 2.8.2, 2.8.3 Feb 25, 2020
@kylekatarnls kylekatarnls modified the milestones: 2.8.3, 2.10.0 May 3, 2020
@kylekatarnls kylekatarnls modified the milestones: 2.10.0, 2.11.0 Apr 11, 2021
@kylekatarnls kylekatarnls modified the milestones: 2.11.0, 2.12.0 Nov 27, 2021
@rk-mxp
Copy link

rk-mxp commented Feb 1, 2022

To add to this, because I noticed that too:
A print_r is not detected, but a \print_r is. So I guess #345 (comment) is on the right track.

@kylekatarnls kylekatarnls modified the milestones: 2.12.0, 2.13.0 Jun 19, 2022
@kylekatarnls kylekatarnls modified the milestones: 2.13.0, 2.14.0 Sep 10, 2022
@kylekatarnls kylekatarnls modified the milestones: 2.14.0, 2.15.0 Sep 27, 2023
@kylekatarnls kylekatarnls modified the milestones: 2.15.0, 2.16.0 Dec 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

9 participants