Find forgotten variables dump in PHP source code.

Overview

PHP VarDump Check

This repository is abandoned.

Suggested alternative: https://github.com/php-parallel-lint/PHP-Var-Dump-Check


PHP console application for find forgotten variable dump. Support PHP build in method print_r, var_dump and var_export method and also method from Tracy debugger, Ladybug, Symfony, Laravel, Doctrine and Zend Framework.

Install

Just create a composer.json file and run the php composer.phar install command to install it:

{
    "require-dev": {
        "jakub-onderka/php-var-dump-check": "~0.3"
    }
}

For colored output install suggested package jakub-onderka/php-console-highlighter.

Usage and example output

$ ./vendor/bin/var-dump-check --no-colors --tracy .
...................X...

Checked 23 files in 0.1 second, dump found in 1 file

------------------------------------------------------------
Forgotten dump 'var_dump' found in ./test.php:36
    34|         $functionsToCheck = $this->prepareFunctionCheck($this->settings->functionsToCheck);
    35|
  > 36| 	    var_dump($functionsToCheck);
    37|
    38|         foreach ($tokens as $key => $token) {

Options for run

  • none - check dump: var_dump, var_export, print_r
  • --ladybug - check dump: ladybug_dump, ladybug_dump_die, ld, ldd
  • --tracy - check dump: dump, bdump, Debugger::dump, Debugger::barDump
  • --zend - check dump: Zend_Debug::dump, \Zend\Debug\Debug::dump
  • --doctrine - check dump: Doctrine::dump, \Doctrine\Common\Util\Debug::dump
  • --symfony - check dump: dump, VarDumper::dump, VarDumper::setHandler, VarDumper::dd
  • --laravel - check dump: dd, dump
  • --no-colors - disable colors from output
  • --exclude folder/ - exclude folder/ from check
  • --extensions php,phpt,php7 - map file extensions for check

Recommended setting for usage with Symfony framework

For run from command line:

$ ./vendor/bin/var-dump-check --symfony --exclude app --exclude vendor .

or setting for ANT:

<condition property="var-dump-check" value="${basedir}/bin/var-dump-check.bat" else="${basedir}/bin/var-dump-check">
    <os family="windows"/>
</condition>

<target name="var-dump-check" description="Run PHP VarDump check">
    <exec executable="${var-dump-check}" failonerror="true">
        <arg line='--exclude ${basedir}/app/' />
        <arg line='--exclude ${basedir}/vendor/' />
        <arg line='${basedir}' />
    </exec>
</target>

Build Status Downloads this Month Latest stable

Comments
  • New release?

    New release?

    Last version of the package is v0.2 which is released on Mar 13, 2015. The README states that there are options such as --symfony, --laravel, --doctrine but in the latest release these options are not available. Do you plan to release a new version with the latest changes in the master branch?

    opened by malios 6
  • Add the Symfony Vardumper dd() helper method introduced in 4.1

    Add the Symfony Vardumper dd() helper method introduced in 4.1

    https://symfony.com/doc/current/components/var_dumper.html#the-dump-function

    The VarDumper component also provides a dd() ("dump and die") helper function. This function dumps the variables using dump() and immediately ends the execution of the script (using exit). New in version 4.1: The dd() helper method was introduced in Symfony 4.1.

    opened by antograssiot 4
  • Bug in check count dumps

    Bug in check count dumps

    For test

        ...
        public function __construct()
        {   
            $settings = new PhpVarDumpCheck\Settings();
            $settings->functionsToCheck = array_merge($settings->functionsToCheck, array(
                PhpVarDumpCheck\Settings::DEBUGGER_DUMP,
                PhpVarDumpCheck\Settings::DEBUGGER_DUMP_SHORTCUT,
            )); 
            $this->uut = new PhpVarDumpCheck\Checker($settings);
        } 
    
        public function testCheck_tracyDebugDump()
        {   
            $content = <<<PHP
    <?php
    Debugger::dump(\$var);
    OtherClass::dump(\$var);
    PHP;
            $result = $this->uut->check($content);
            $this->assertCount(1, $result);
        }
        ...
    

    is failure output (from PHPUnit)

    There were 1 failures:
    
    1) TracyTest::testCheck_tracyDebugDump
    Failed asserting that actual size 2 matches expected size 1.
    
    opened by grogy 2
  • Check Doctrine dump

    Check Doctrine dump

    Doctrine has its own dump method, which strips a lot of internal information and recursions.

    \Doctrine\Common\Util\Debug::dump($var);
    

    Is there a chance this could be included into this nice tool?

    opened by seaneble 1
  • Added configuration file for Travis-CI

    Added configuration file for Travis-CI

    Please add this library to Travis-CI.

    I think tests on Travis are elementary for users of library. After I can send next pull-requests:

    • modify readme (Travis)
    • add next tests and support for actual Tracy
    • add new features (search dumps in Latte templates, etc.)
    opened by grogy 1
  • Expanding Laravel preset

    Expanding Laravel preset

    Hi,

    Very nice tool, good job man. :)

    Laravel also has a dump helper, but it's currently not being detected with the Laravel preset.

    https://laravel.com/docs/5.7/helpers#method-dump

    Also, the Laravel preset doesn't seem to pick up on dd() in Blade files. When used as {{ dd($foo) }}

    Is this something you would be interested in adding to the current preset?

    opened by jasperjorna 0
  • Feature request: Check symfony VarDumper

    Feature request: Check symfony VarDumper

    In Symfony 2.6 added VarDumper. http://symfony.com/blog/new-in-symfony-2-6-vardumper-component Dump function can be in Twig or source code. If you forget to remove featuring production environment, it would be a exception.

    Thanks.

    opened by agentsib 0
  • Add --custom-function parameter to check

    Add --custom-function parameter to check

    In one of the projects that I have been working for a while, there are some legacy dump functions created and used frequently by the team. A sample function is;

    function pre_dump( $var ) { echo '<pre>'; var_dump( $var ); echo '</pre>'; } The check can not be able to find the usage of such kind of functions. A sample usage might be;

    $ ./vendor/bin/var-dump-check --no-colors --tracy --custom-function pre_dump,echo_dump .

    I have created a pull request for this case.

    https://github.com/JakubOnderka/PHP-Var-Dump-Check/pull/32

    opened by umutphp 1
  • Add --custom-function parameter to check.

    Add --custom-function parameter to check.

    In one of the projects that I have been working for a while, there are some legacy dump functions created and used frequently by the team. A sample function is;

    function pre_dump( $var ) { echo '<pre>'; var_dump( $var ); echo '</pre>'; }

    The check can not be able to find the usage of this kind of functions. With this pull request, user can give the names of such kind of custom debug functions to the check function with "--custom-function" parameter.

    opened by umutphp 5
  • Check dump in Latte templates

    Check dump in Latte templates

    Idea: check forgotten dumps from Latte templates. Example of use is in documentation http://doc.nette.org/en/2.2/default-macros#toc-variable-dumping.

    How it implement? That will not do with PHP tokens. Use regular expressions?

    opened by grogy 2
Releases(v0.3)
  • v0.3(Sep 29, 2018)

    • Added support for Symfony VarDumper (#16)
    • Added support for Laravel dd function (#20)
    • Added support for Doctrine dump (#22)
    • Added support for Tracy (#27)
    • Dropped support for PHP 5.3 and for HHVM
    • Automatic testing for PHP 7.1-7.2
    • Converted to PSR-4 standard
    Source code(tar.gz)
    Source code(zip)
Owner
Jakub Onderka
Jakub Onderka
YCOM Impersonate. Login as selected YCOM user 🧙‍♂️in frontend.

YCOM Impersonate Login as selected YCOM user in frontend. Features: Backend users with admin rights or YCOM[] rights, can be automatically logged in v

Friends Of REDAXO 17 Sep 12, 2022
Preferences are configuration variables that are user-managed for which we cannot rely upon container parameters or environment variables.

Preferences Preferences are configuration variables that are meant to be user managed for which we cannot rely upon container parameters or environmen

Makina Corpus 1 Feb 7, 2022
Find undefined and unused variables with the PHP Codesniffer static analysis tool.

PHP_CodeSniffer VariableAnalysis Plugin for PHP_CodeSniffer static analysis tool that adds analysis of problematic variable use. Warns if variables ar

Payton Swick 116 Dec 14, 2022
The SensioLabs DeprecationDetector runs a static code analysis against your project's source code to find usages of deprecated methods, classes and interfaces

SensioLabs DeprecationDetector CAUTION: This package is abandoned and will no longer receive any updates. The SensioLabs DeprecationDetector runs a st

QOSSMIC GmbH 389 Nov 24, 2022
Enable ray(), dd() and dump() in all PHP files on your system

Enable ray(), dd() and dump() in all PHP files on your system Ray is a wonderful desktop application that can help you debug applications faster. It c

Spatie 190 Dec 13, 2022
Dump masked information from your database

Laravel Masked DB Dump A database dumping package that allows you to replace and mask columns while dumping your database. Installation You can instal

Beyond Code 95 Jan 2, 2023
Iran decoration platform is an open source Php web application where you can find your job as a freelancer working in people home in decoration positions and others.

Iran-Decoration Platform Iran decoration platform is an open source Php web application where you can find your job as a freelancer working in people

AmirHossein Mohammadi 8 Dec 14, 2022
This is a library to serialize PHP variables in JSON format

This is a library to serialize PHP variables in JSON format. It is similar of the serialize() function in PHP, but the output is a string JSON encoded. You can also unserialize the JSON generated by this tool and have you PHP content back.

Zumba 118 Dec 12, 2022
A simple library to increase the power of your environment variables.

Environment A simple library (with all methods covered by php unit tests) to increase the power of your environment variables, contribute with this pr

João Paulo Cercal 56 Feb 8, 2022
This library implements a fuzzer for PHP, which can be used to find bugs in libraries

PHP Fuzzer This library implements a fuzzer for PHP, which can be used to find bugs in libraries (particularly parsing libraries) by feeding them "ran

Nikita Popov 341 Dec 25, 2022
JSONFinder - a library that can find json values in a mixed text or html documents, can filter and search the json tree, and converts php objects to json without 'ext-json' extension.

JSONFinder - a library that can find json values in a mixed text or html documents, can filter and search the json tree, and converts php objects to json without 'ext-json' extension.

Eboubaker Eboubaker 2 Jul 31, 2022
Simple library that abstracts different metrics collectors. I find this necessary to have a consistent and simple metrics (functional) API that doesn't cause vendor lock-in.

Metrics Simple library that abstracts different metrics collectors. I find this necessary to have a consistent and simple metrics API that doesn't cau

Benjamin Eberlei 311 Nov 20, 2022
Hi Im L, I found a box that I believe it's contain Kira's real ID. for open that box we need to find three keys. let's start looking for them

DeathNote ctf Description are you smart enaugh to help me capturing the three keys for open the box that contain the real ID of kira? Let's start solv

Hamza Elansari 4 Nov 28, 2022
VoteSwiper helps citizens to find a political party that matches their own views in a playful way.

VoteSwiper / WahlSwiper - Website VoteSwiper (in Germany better known as WahlSwiper) is a cross-platform voting advice app for Android, iOS and web br

MOVACT 9 Aug 15, 2022
IgAnalyzer - Find non-followers and potential stalkers.

igAnalyzer Features Shows mutual followers, non-followers and non-followings via pie chart Shows monthly followers via area chart Shows followers via

LIII 6 Sep 9, 2022
As many Magento patches as I can find!

Magento Resources and Links I have been looking for a good repository for all resources for Magento and I thought I will start putting them here for n

Brent W. Peterson 271 Dec 22, 2022
Magento commands to find translations that are present in one CSV file but not in another, and to translate CSV dicts with DeepL

Hyvä Themes - Magento translation CSV comparison command hyva-themes/magento2-i18n-csv-diff This module adds the bin/magento i18n:diff-csv and i18n:tr

Hyvä 6 Oct 26, 2022
Magento 2 Megamenu extension is an indispensable component, and plays the role of website navigation to help customers easily categorize and find information

Mageno 2 Mega Menu (Magicmenu) helps you create neat and smart navigation menus to display the main categories on your website.

https://magepow.com 35 Dec 1, 2022
ScrimAZ is a plugin made to help find cheaters.

ScrimAZ is an anti-cheat made to find hackers.

Sayaka 1 Jul 24, 2022