Giter Club home page Giter Club logo

epv's Introduction

phpBB

phpBB is a free open-source bulletin board written in PHP.

πŸ§‘πŸ»β€πŸ€πŸ»πŸ§‘πŸ½ Community

Get your copy of phpBB, find support and lots more on phpBB.com. Discuss the development on area51.

πŸ‘¨β€πŸ’» Contribute

  1. Create an account on phpBB.com
  2. Create a ticket (unless there already is one)
  3. Read our Coding guidelines and Git Contribution Guidelines
  4. Send us a pull request

πŸ—οΈ Setting up a development build of phpBB

To run an installation from the repo (and not from a pre-built package) on a local server, run the following commands:

  • Fork phpbb/phpbb to your GitHub account, then create a local clone of it:
    git clone https://github.com/your_github_name/phpbb.git
    
  • Install phpBB's dependencies (from the root of your phpbb repo):
    cd phpBB
    php ../composer.phar install
    

Alternatively, you can read:

πŸ““ Documentation

phpBB's Development Documentation contains all the information you'll need to learn about developing for phpBB's core, extensions and automated testing.

πŸ”¬ Automated Testing

We have unit and functional tests in order to prevent regressions. You can view the bamboo continuous integration here or check our GitHub Actions below:

Branch Description GitHub Actions
master Latest development version Tests
3.3.x Development of version 3.3.x Tests

πŸ“œ License

GNU General Public License v2

epv's People

Contributors

bantu avatar brunoais avatar davidiq avatar dependabot[bot] avatar derky avatar imattpro avatar kasimi avatar michaelcullum avatar nickvergessen avatar nicofuma avatar paul999 avatar senky avatar tierra avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

epv's Issues

Warning: preg_match(): Compilation failed: PCRE does not support

Hi

Currently I try to install EPV localy in a WAMP environment. Generally it works but the following error messsages appears:

`Warning: preg_match(): Compilation failed: PCRE does not support \L, \l, \N{name
}, \U, or \u at offset 19 in G:\programme\wamp\www\epv\src\Tests\Tests\epv_test_
validate_languages.php on line 61

Warning: preg_match(): Compilation failed: PCRE does not support \L, \l, \N{name
}, \U, or \u at offset 19 in G:\programme\wamp\www\epv\src\Tests\Tests\epv_test_
validate_languages.php on line 61

Warning: preg_match(): Compilation failed: PCRE does not support \L, \l, \N{name
}, \U, or \u at offset 19 in G:\programme\wamp\www\epv\src\Tests\Tests\epv_test_
validate_languages.php on line 61` .... and a lot more of these error .

Windows 7 Pro /64
WAMP Server 3.1.7 /64
Tested PHPs:
5.6.40: ok, but PCRE error
7.0.33: ok, but PCRE error
7.1.26: ok, but PCRE error
7.2.14: ok, but PCRE error
7.3.1: doesn't work: [31m Directory name must not be empty. [39m

Last year I tested EPV on a XAMPP server (7.2.9 /32), but the same problem with PCRE.

Limit license checks to extension license

If there's an asset or a dependency in the extension that has a file license.txt, EPV treats it as the extension's license and runs its checks on it.

Example: vendor/ext/styles/all/theme/assets/tinymce/license.txt

EPV should only check the license.txt in the extension's root folder.

Fatal error when parsing array value in language file

EPV expects an array literal to be used in the array_merge() call in language files:

$lang = array_merge($lang, [
    // some lang vars here
]);

When passing an array variable instead, a fatal error is thrown:

$strings = array(
    // some lang vars here
);

$lang = array_merge($lang, $strings);

Vendor names from IST starting with phpbb (i.e. phpbbde) result in Errors

Vendor names should be checked including the first dot, underscore or slash/backslash to see if it actually is phpbb. Otherwise vendornames such as phpbbnl or phpbbde will result in errors.

Error: The phpbb vendorname should only be used for official extensions in route names in ...ext\phpbbde\pastebin\config\routing.yml. Current service name: phpbbde_pastebin_main_controller
Error: The phpbb vendorname should only be used for official extensions in service names in ...ext\phpbbde\pastebin\config\services.yml. Current service name: phpbbde.pastebin.functions.pastebin
Error: The phpbb vendorname should only be used for official extensions in service names in ...ext\phpbbde\pastebin\config\services.yml. Current service name: phpbbde.pastebin.controller.main

Remove Progress Bars

The progress bars should be removed from the EPV. The output of the EPV will be much cleaner and easier for users to understand without them.

Fix namespace to include vendor

The namespace should start with a vendor (Phpbb/).

<MichaelC|Mobile> paul999: namespace for epv should be Phpbb/epv
<paul999> MichaelC|Mobile: why? ;)
<MichaelC|Mobile> because you should always use <vendor>/<package>/<sub-namespace>/<classname>
<MichaelC|Mobile> psr-0...
<MichaelC|Mobile> psr-0 aside, it's still good practice and prevents conflicts
<MichaelC|Mobile> and epv/stuff/stuff/class looks ugly
<paul999> and so does phpbb/epv/stuff/stuff/class ;)
<paul999> but add a ticket and I will see

Suggestion: support for .editorconfig

Hi

EPV is a helpful tool, I like it.

There is one thing I would to suggest: to support (or ignore) the file .editorconfig. This is another standard and directly supported by GitHub, so it should be accepted by EPV too.

Informations about this standard:

https://editorconfig.org/

There you can see also, that .editorconfig is supported directly by several IDE's and editor's. For some who have no native support for it, there exists plugins.

PHP Notice: Undefined property: PhpParser\Node\Expr\Variable::$parts

There's a PHP notice when EPV parses this code:

$func = 'is_int';
$arg = 1;
$result = $func($arg);

Both $result = is_int($arg); and $func($arg); work fine. The combination of a variable function and assignment is causing the notice. Full stracktrace:

PHP Notice:  Undefined property: PhpParser\Node\Expr\Variable::$parts in /epv/src/Tests/Tests/epv_test_validate_php_functions.php on line 366
PHP Stack trace:
PHP   1. {main}() /epv/src/EPV.php:0
PHP   2. Phpbb\Epv\Cli->run() /epv/src/EPV.php:30
PHP   3. Phpbb\Epv\Cli->doRun() /epv/vendor/symfony/console/Application.php:125
PHP   4. Phpbb\Epv\Cli->doRunCommand() /epv/vendor/symfony/console/Application.php:224
PHP   5. Phpbb\Epv\Command\ValidateCommand->run() /epv/vendor/symfony/console/Application.php:888
PHP   6. Phpbb\Epv\Command\ValidateCommand->execute() /epv/vendor/symfony/console/Command/Command.php:262
PHP   7. Phpbb\Epv\Tests\TestStartup->__construct() /epv/src/Command/ValidateCommand.php:72
PHP   8. Phpbb\Epv\Tests\TestStartup->runTests() /epv/src/Tests/TestStartup.php:62
PHP   9. Phpbb\Epv\Tests\TestRunner->runTests() /epv/src/Tests/TestStartup.php:125
PHP  10. Phpbb\Epv\Tests\Tests\epv_test_validate_php_functions->validateFile() /epv/src/Tests/TestRunner.php:94
PHP  11. Phpbb\Epv\Tests\Tests\epv_test_validate_php_functions->validate() /epv/src/Tests/Tests/epv_test_validate_php_functions.php:129
PHP  12. Phpbb\Epv\Tests\Tests\epv_test_validate_php_functions->parseNodes() /epv/src/Tests/Tests/epv_test_validate_php_functions.php:156
PHP  13. Phpbb\Epv\Tests\Tests\epv_test_validate_php_functions->parseNode() /epv/src/Tests/Tests/epv_test_validate_php_functions.php:252
PHP  14. Phpbb\Epv\Tests\Tests\epv_test_validate_php_functions->parseNode() /epv/src/Tests/Tests/epv_test_validate_php_functions.php:304
PHP  15. Phpbb\Epv\Tests\Tests\epv_test_validate_php_functions->parseNode() /epv/src/Tests/Tests/epv_test_validate_php_functions.php:304
PHP  16. Phpbb\Epv\Tests\Tests\epv_test_validate_php_functions->parseNode() /epv/src/Tests/Tests/epv_test_validate_php_functions.php:308
PHP  17. Phpbb\Epv\Tests\Tests\epv_test_validate_php_functions->parseNode() /epv/src/Tests/Tests/epv_test_validate_php_functions.php:304
PHP  18. Phpbb\Epv\Tests\Tests\epv_test_validate_php_functions->validateFunctionNames() /epv/src/Tests/Tests/epv_test_validate_php_functions.php:292

Add support for short array syntax in event $vars

Currently the php_exporter class checks for exactly array() for the event $vars variable.

preg_match('#^\$vars = array\(\'([a-zA-Z0-9_\' ,]+)\'\);$#', $line, $match);

while (ltrim($this->file_lines[$this->current_event_line - $current_vars_line], " \t") !== '$vars = array(')

So using the short array syntax ([], PHP >= 5.4) throws an error.

Fatal error: Can not find '$vars = array();'-line for event '{EVENT}' in file '{FILE}:{LINE}'. Are you using UNIX style linefeeds?

This works:

/**
 * Sample event.
 *
 * @event vendor.extension.event_name
 * @var int	var1
 * @var array	var2
 * @since 1.0.0
 */
$vars = array(
	'var1',
	'var2',
);
extract($this->dispatcher->trigger_event('vendor.extension.event_name', compact($vars)));

This gives the fatal error:

/**
 * Sample event.
 *
 * @event vendor.extension.event_name
 * @var int	var1
 * @var array	var2
 * @since 1.0.0
 */
$vars = [
	'var1',
	'var2',
];
extract($this->dispatcher->trigger_event('vendor.extension.event_name', compact($vars)));

Both examples are using a valid PHP code and considering that phpBB 3.2.x requires at least PHP 5.4, it should support the short syntax.

Move php_exporter to EPV

Remove the dependency on phpbb/phpbb by copying the php_exporter from phpBB to EPV itself. Having a dep on phpbb/phpbb causes issues on the website/other places.

Do not display full path in results.

When given an error, the full path to the offending file is outputted:

Error: The phpbb vendorname should only be used for official extensions in service names in /home/anthe/www/dev/customisation-db/files/contrib_temp/board_announcments_1_0_0/phpbb/googleanalytics/config/services.yml

It should strip the base path and simply output phpbb/googleanalytics/config/services.yml.

Typo = Fatal Error

epv/src/epv/Tests/TestStartup.php on line 117

$this->output->getMesageCount(Output::WARNING) should be
$this->output->getMessageCount(Output::WARNING) it's missing an 's'

Flood Limit

This is website side but hey ho.

A limit of 1 epv run every 30s - should probably use a db table for this (record time and github shortname in a table).

Can't find composer.json

latest epv fails running locally and in Travis CI - see execution below. I listed files in the cloned /tmp file and composer.json is there.

[myersware@web617 epv]$ php src/EPV.php run --git="https://github.com/myersjj/phpbbMapUsers"
Checkout https://github.com/myersjj/phpbbMapUsers from git on branch master.
Running Extension Pre Validator .

[Phpbb\Epv\Tests\Exception\TestException]
Can't find the composer.json file in /tmp/5a639c883e381.

run [--dir [DIR]] [--git [GIT]] [--github [GITHUB]] [--branch [BRANCH]] [--debug]

[myersware@web617 epv]$ ls /tmp/5a639c883e381
_ composer.phar docs LICENSE phpunit.phar tests
acp config event license.txt phpunit.xml travis
adm console ext.php mcp README.md ucp
composer.json controller geocoder migrations service.php vendor
composer.lock cron language notification styles
[myersware@web617 epv]$

Suggestion: full version information with --version

Hi Paul

It would be nice if EPV would output decent version information at the --version switch. "Console Tool" is not very meaningful. ^^

Example:
epv --version
Extension Pre Validator v0.0.11 by Paul Sohier (https://github.com/phpbb/epv)

Or something like that would be much more informative. Then I could also display the version information for EPV directly with --version, as with the other tools I am using for Ext Check. At the moment I have to use the static text by paul999 (https://github.com/phpbb/epv) for EPV and that is actually not in the spirit of the inventor.
EPV_ver_issue

EPV doesn't detect language and migration files in subfolders

Affected lines:

$dir is an array that usually looks like this: ['vendor', 'extname', 'language']. end($dir) returns language which makes the tryLoadFile() method successfully return a LangFile instance. However, a language file located in vendor/extname/language/sub/lang.php has a $dir of ['vendor', 'extname', 'language', 'sub']. end($dir) returns sub, resulting in a generic PHPFile instance to be returned. Similar problem for migration files.

At the moment I'm not sure how to fix this in a way that works locally as well as in production. Locally, the vendor/extname is missing, so $dir is just ['language'] and ['language', 'sub'], respectively. Any ideas?

The switch --no-ansi have no effect

This is no big thing, but I want to report it also.

If I understand this switch correctly, then it should supress the ANSI color codes. But with active --no-ansi switch, the output is still like this:

`←[37;41m ←[39;49m
←[37;41m Validation: FAILED ←[39;49m
←[37;41m Fatal: 15, Error: 0, Warning: 2, Notice: 0 ←[39;49m
←[37;41m ←[39;49m

←[32mTest results for extension:←[39m
←[33;1mWarning:←[39;22m←[33m Can't detect the file type for .editorconfig, handl
ing it as a binary file.←[39m
←[37;41;1mFatal error:←[39;49;22m←[37;41m Detected windows style newlines instea
d of UNIX newlines in \lukewcs\whowashere\acp\acp_whowashere_info.php←[39;49m
←[37;41;1mFatal error:←[39;49;22m←[37;41m Detected windows style newlines instea
d of UNIX newlines in \lukewcs\whowashere\acp\acp_whowashere_module.php←[39;49m
←[33;1mWarning:←[39;22m←[33m "GPL-2.0" is a deprecated SPDX license identifier,
use "GPL-2.0-only" instead. in \lukewcs\whowashere\composer.json←[39m` ....

I assume ←[32m as example is a ANSI color code?

The full EPV command line in this case is:

php src\EPV.php run --no-ansi --dir "g:\virtual\Users\Test\Documents\GitHub\lf-who-was-here\"

Support Symfony 3 / phpBB master branch

Tests using EPV in phpBB master branch fail because phpBB 3.3 uses Symfony 3.x... EPV is on Symfony 2.x.

https://travis-ci.org/VSEphpbb/abbc3/jobs/156994287#L801

Problem 1
    - Installation request for phpbb/epv dev-master -> satisfiable by phpbb/epv[dev-master].
    - phpbb/epv dev-master requires symfony/yaml ~2.3 -> satisfiable by symfony/yaml[2.3.x-dev, 2.4.x-dev, 2.5.x-dev, 2.6.x-dev, 2.7.x-dev, 2.8.x-dev, v2.3.0, v2.3.1, v2.3.10, v2.3.11, v2.3.12, v2.3.13, v2.3.14, v2.3.15, v2.3.16, v2.3.17, v2.3.18, v2.3.19, v2.3.2, v2.3.20, v2.3.21, v2.3.22, v2.3.23, v2.3.24, v2.3.25, v2.3.26, v2.3.27, v2.3.28, v2.3.29, v2.3.3, v2.3.30, v2.3.31, v2.3.32, v2.3.33, v2.3.34, v2.3.35, v2.3.36, v2.3.37, v2.3.38, v2.3.39, v2.3.4, v2.3.40, v2.3.41, v2.3.42, v2.3.5, v2.3.6, v2.3.7, v2.3.8, v2.3.9, v2.4.0, v2.4.0-BETA1, v2.4.0-BETA2, v2.4.0-RC1, v2.4.1, v2.4.10, v2.4.2, v2.4.3, v2.4.4, v2.4.5, v2.4.6, v2.4.7, v2.4.8, v2.4.9, v2.5.0, v2.5.0-BETA1, v2.5.0-BETA2, v2.5.0-RC1, v2.5.1, v2.5.10, v2.5.11, v2.5.12, v2.5.2, v2.5.3, v2.5.4, v2.5.5, v2.5.6, v2.5.7, v2.5.8, v2.5.9, v2.6.0, v2.6.0-BETA1, v2.6.0-BETA2, v2.6.1, v2.6.10, v2.6.11, v2.6.12, v2.6.13, v2.6.2, v2.6.3, v2.6.4, v2.6.5, v2.6.6, v2.6.7, v2.6.8, v2.6.9, v2.7.0, v2.7.0-BETA1, v2.7.0-BETA2, v2.7.1, v2.7.10, v2.7.11, v2.7.12, v2.7.13, v2.7.14, v2.7.15, v2.7.16, v2.7.17, v2.7.2, v2.7.3, v2.7.4, v2.7.5, v2.7.6, v2.7.7, v2.7.8, v2.7.9, v2.8.0, v2.8.0-BETA1, v2.8.1, v2.8.2, v2.8.3, v2.8.4, v2.8.5, v2.8.6, v2.8.7, v2.8.8, v2.8.9] 
but these conflict with your requirements or minimum-stability.

recognize .map files

It's become common these days to see a .map file accompany minified javascript, e.g.:
script.js
script.min.js
script.min.map

It might be worth recognizing the .map files so they don't trigger any warnings about being treated as a binary file.

EPV requires bcmath, but this is not installed on .com

@kasimi

$actualPercent = bcdiv($licenseSimilarity * 100, 1, 2);
==> This requires bcmath, but we don't have this installed. Would be nice if we can replace it with something that doesn't require bcmath.

Error we got;
PHP Fatal error: Call to undefined function Phpbb\Epv\Tests\Tests\bcdiv() in /community/vendor/phpbb/epv/src/Tests/Tests/epv_test_validate_directory_structure.php on line 58, referer: https://www.phpbb.com/customise/db/extension/phpbb_saml2/revision

Add check for event names

Event names should be in the form of vendor.name.eventname and vendor should not be core or phpbb.

prepare-epv.sh: No such file or directory

I have an issue with Travis config. all builds "fail" because it doesn't seem to find prepare-epv.sh although it's there (https://github.com/Sajaki/pbwowext/blob/develop32/travis/prepare-epv.sh).

This is the log.

 ../paybas/pbwowext/travis/prepare-epv.sh $EPV $NOTESTS

/home/travis/.travis/job_stages: line 57: ../paybas/pbwowext/travis/prepare-epv.sh: No such file or directory

The command "../paybas/pbwowext/travis/prepare-epv.sh $EPV $NOTESTS" failed and exited with 127 during .

Your build has been stopped.

do you have an idea?

Check for invalid depends_on() in migrations

EPV should check that depends_on() array's contain strings that always start with a slash.

So this is valid:

static public function depends_on()
{
    return array('\foo\bar', '\bar\foo');
}

And we should error for any missing leading slashes:

static public function depends_on()
{
    return array('foo\bar', '\bar\foo');
}

EPV Output formatting

EPV output formatting on phpbb.com needs some fixes. Error messages display in darkred, which is unreadable on the black background. Maybe the "Error:" can be salmon (light red) colored, and the error message be red instead of darkred.

epv_test_validate_php_functions.php can fail with strings

This test can fail with the message:

PHP Catchable fatal error: Object of class PhpParser\Node\Expr\BinaryOp\Concat could not be converted to string in /home/travis/build/phpBB3/phpBB/vendor/phpbb/epv/src/Tests/Tests/epv_test_validate_php_functions.php on line 390

The failure will happen when an extension has, for example, a string or a string concatenated method name variable in the method call, like:

$result = $this->{'validate_' . $name}();

The obvious solution on the ext dev's end is not to do string concatenation in the method call, like:

$method = 'validate_' . $name;
$result = $this->{$method}();

However, since this is not an illegal style of coding, EPV should not fail on the string concatenated version in the first example. It should be able to successfully test both conditions.

Reference: https://travis-ci.org/phpbb-extensions/ad-management/jobs/270466947#L594

Don't allow trigger_error() with a controller

I think that you shoud throw an error for each trigger_error found in a controller and a warning for each trigger_error found anywhere else and if an extension call trigger_error in a "Symfony Event" (i.e. KernelEvents::*) it should be denied

Wrong detection of packaging structure.

Hello, guys!

Today I've found that the EPV started to push errors Packaging structure doesn't meet the extension DB policies. even when all is OK.

I've explored the latest updates of the EPV and found out that this edit now causes wrong errors.

That's because $this->opendir may be not the same as the actual directory.
On my local tests opendir is a relative path, but $dir and $sp are absolute paths.
So str_replace() cannot delete the relative path from the absolute path properly.

The new code also works wrongly on Travis and on phpbb.com checker even for official extensions.

I suggest reverting back the edits linked above to the previous code:

                    $sp    = str_replace('\\', '/', $dir);
                    $split = explode('/', $sp);
                    $ns    = '';
                    if (sizeof($split) - 3 >= 0)
                    {
                        $ns .= $split[sizeof($split) - 3] . '/' . $split[sizeof($split) - 2];
                    }

                    if ($this->namespace != $ns)
                    {
                        $this->output->addMessage(Output::ERROR, 'Packaging structure doesn\'t meet the extension DB policies.');
                    }

Support Traits

This is the warning shown for Trait files :

Warning: IN_PHPBB is not defined in /path/traitName.php

If I add "IN_PHPBB" check after NameSpace,
This is the Err0r shown in Code Sniff :

FILE: /path/traitName.php
----------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
----------------------------------------------------------------------
 1 | WARNING | A file should declare new symbols (classes, functions,
   |         | constants, etc.) and cause no other side effects, or
   |         | it should execute logic with side effects, but should
   |         | not do both. The first symbol is defined on line 27
   |         | and the first side effect is on line 19.
   |         | (PSR1.Files.SideEffects.FoundWithSymbols)
----------------------------------------------------------------------

Which is du to "IN_PHPBB" check.

I think we can use PhpParser\Node\Stmt\Trait_ class for the check.

Best regards πŸ‘

EPV doesn't work with phpBB Master

Running EPV tests on extensions with phpBB master branch or maybe it's a PHP 8 thing, I don't know but:

Your requirements could not be resolved to an installable set of packages.

Problem 1
- Root composer.json requires phpbb/epv dev-master -> satisfiable by phpbb/epv[dev-master].
- phpbb/epv dev-master requires nikic/php-parser ~3.0 -> found nikic/php-parser[v3.0.0, ..., v3.1.5] but the package is fixed to v4.17.1 (lock file version) by a partial update and that version does not match. Make sure you list it as an argument for the update command.

Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to specific versions.
Error: Your requirements could not be resolved to an installable set of packages.

Problem 1
- Root composer.json requires phpbb/epv dev-master -> satisfiable by phpbb/epv[dev-master].
- phpbb/epv dev-master requires nikic/php-parser ~3.0 -> found nikic/php-parser[v3.0.0, ..., v3.1.5] but the package is fixed to v4.17.1 (lock file version) by a partial update and that version does not match. Make sure you list it as an argument for the update command.

Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to specific versions.

Installation failed, reverting ./composer.json and ./composer.lock to their original content.
Error: Process completed with exit code 2.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.