szepeviktor

szepeviktor

I make your #web application's life happy 📡 Consulting and 24/7 Operations 🏡 I'm on GitHub to blow off the steam by doing high quality work.

Member Since 10 years ago

G2RM+5M Budapest

Experience Points
260
follower
Lessons Completed
194
follow
Lessons Completed
1.8k
stars
Best Reply Awards
1.2k
repos

1693 contributions in the last year

Pinned
⚡ Tools and living docs 🧬 for Debian-based servers and Web Applications
⚡ ⚗️ Adds code analysis to Laravel improving developer productivity and code quality.
⚡ WordPress extensions for PHPStan ⛏️
⚡ Template for small PHP fixes or enhancements, WordPress plugins
⚡ WAF for WordPress 🔥 with 60+ security checks and weekly updates
⚡ Tools 🧰 for developing and running WordPress websites
Activity
Jan
18
22 hours ago
Activity icon
issue

szepeviktor issue comment nunomaduro/larastan

szepeviktor
szepeviktor

False positive: collect()->isNotEmpty() - If condition is always false

  • Larastan Version: 1.0.2
  • --level used: 6
  • Pull request with failing test:

Description

The following code produces If condition is always false., which is not true :) It seems it's the "return" part that confuses it

Laravel code where the issue was found

$c = collect();

if ($c->isNotEmpty()) {
    return $c;
}

$c->push(1);

// \PHPStan\dumpType($c) = Dumped type: Illuminate\Support\Collection
if ($c->isNotEmpty()) { // If condition is always false.
    return $c;
}
szepeviktor
szepeviktor

One solution can be to flag isNotEmpty method in our stubs are impure function.

Activity icon
issue

szepeviktor issue comment nunomaduro/larastan

szepeviktor
szepeviktor

False positive: collect()->isNotEmpty() - If condition is always false

  • Larastan Version: 1.0.2
  • --level used: 6
  • Pull request with failing test:

Description

The following code produces If condition is always false., which is not true :) It seems it's the "return" part that confuses it

Laravel code where the issue was found

$c = collect();

if ($c->isNotEmpty()) {
    return $c;
}

$c->push(1);

// \PHPStan\dumpType($c) = Dumped type: Illuminate\Support\Collection
if ($c->isNotEmpty()) { // If condition is always false.
    return $c;
}
szepeviktor
szepeviktor

The first if makes it sure for PHPStan that $c->isNotEmpty() is not true afterwards. So in the second if it is false for sure: thus not linked to the push.

Activity icon
issue

szepeviktor issue comment nunomaduro/larastan

szepeviktor
szepeviktor

False positive: collect()->isNotEmpty() - If condition is always false

  • Larastan Version: 1.0.2
  • --level used: 6
  • Pull request with failing test:

Description

The following code produces If condition is always false., which is not true :) It seems it's the "return" part that confuses it

Laravel code where the issue was found

$c = collect();

if ($c->isNotEmpty()) {
    return $c;
}

$c->push(1);

// \PHPStan\dumpType($c) = Dumped type: Illuminate\Support\Collection
if ($c->isNotEmpty()) { // If condition is always false.
    return $c;
}
szepeviktor
szepeviktor

Hello @Jellyfrog! 👋 AFAIK Larastan does not track the contents of a collection.

Activity icon
issue

szepeviktor issue comment stefenphelps/stefenphelps.com

szepeviktor
szepeviktor

Add all-allowing robots.txt

See other files downloaded without a link: https://github.com/szepeviktor/RootFiles

szepeviktor
szepeviktor

Yes, Google allows much more than standards as it is a money-oriented company.

Activity icon
issue

szepeviktor issue comment php-stubs/wordpress-stubs

szepeviktor
szepeviktor

Add GitHub Actions to automate updating stubs

It would be nice if this was done in a weekly or so GitHub action that could perhaps also be run manually if needed.

That would make maintenance a breeze.

I might take a stab at it if I find some spare time and if this is something you're interested in.

szepeviktor
szepeviktor

This is how it is done nowadays.

  • watch #announcements on WordPress Slack
  • wait for Packagist to refresh its cache
  • run ./release-latest-versions.sh
  • push to GitHub
  • check TravisCI
Activity icon
issue

szepeviktor issue comment php-stubs/wordpress-stubs

szepeviktor
szepeviktor

Update stubs for WordPress 5.8.3

szepeviktor
szepeviktor

BTW source/composer.json also needs to be updated 💡

push

szepeviktor push php-stubs/wordpress-stubs

szepeviktor
szepeviktor

Generate stubs for WordPress 4.7.22

szepeviktor
szepeviktor

Generate stubs for WordPress 4.8.18

szepeviktor
szepeviktor

Generate stubs for WordPress 4.9.19

szepeviktor
szepeviktor

Generate stubs for WordPress 5.0.15

szepeviktor
szepeviktor

Generate stubs for WordPress 5.1.12

szepeviktor
szepeviktor

Generate stubs for WordPress 5.2.14

szepeviktor
szepeviktor

Generate stubs for WordPress 5.3.11

szepeviktor
szepeviktor

Generate stubs for WordPress 5.4.9

szepeviktor
szepeviktor

Generate stubs for WordPress 5.5.8

szepeviktor
szepeviktor

Generate stubs for WordPress 5.6.7

szepeviktor
szepeviktor

Generate stubs for WordPress 5.7.5

szepeviktor
szepeviktor

Generate stubs for WordPress 5.8.3

szepeviktor
szepeviktor

Merge branch 'master' of github.com:php-stubs/wordpress-stubs

commit sha: b89861df498aee30137481a77ae6a5720ca191fb

push time in 9 hours ago
Activity icon
issue

szepeviktor issue comment php-stubs/wordpress-stubs

szepeviktor
szepeviktor

Add GitHub Actions to automate updating stubs

It would be nice if this was done in a weekly or so GitHub action that could perhaps also be run manually if needed.

That would make maintenance a breeze.

I might take a stab at it if I find some spare time and if this is something you're interested in.

szepeviktor
szepeviktor

That would make maintenance a breeze.

:) Excuse me! I like releasing stubs.

Activity icon
issue

szepeviktor issue comment php-stubs/wordpress-stubs

szepeviktor
szepeviktor

Update stubs for WordPress 5.8.3

szepeviktor
szepeviktor

Have you ran the release script checking all 4.7 4.8 4.9 5.0 5.1 5.2 5.3 5.4 5.5 5.6 5.7 5.8 5.9 versions?

pull request

szepeviktor pull request php-stubs/wordpress-stubs

szepeviktor
szepeviktor

Update stubs for WordPress 5.9

Based on RC 3, but not expecting any more changes.

Activity icon
issue

szepeviktor issue comment php-stubs/wordpress-stubs

szepeviktor
szepeviktor

Update stubs for WordPress 5.9

Based on RC 3, but not expecting any more changes.

szepeviktor
szepeviktor

Thank you Pascal for your work! This project is Composer-based. No guys 🔮 from the future allowed :) https://wordpress.org/download/releases/

Jan
17
1 day ago
Activity icon
issue

szepeviktor issue comment skaut/phan-wordpress-stubs

szepeviktor
szepeviktor

Added get_query_var()

szepeviktor
szepeviktor

Marek, you are working too much manually! :)

Activity icon
issue

szepeviktor issue comment woocommerce/woocommerce

szepeviktor
szepeviktor

Package cannot be installed on PHP 8

Prerequisites

  • I believe I have found a bug.
  • I have searched for similar bugs in both open and closed issues and cannot find a duplicate.

Describe the bug

The pelago/emogrifier package cannot be installed on PHP 8.

Expected behavior

Composer installs woocommerce/woocommerce and all of its dependencies, including pelago/emogrifier, successfully.

Actual behavior

Installation fails with the following message:

Problem 1
    - woocommerce/woocommerce[4.8.0-beta.1, ..., 4.9.2, 5.0.0-beta.1, ..., 5.4.0-rc.1] require pelago/emogrifier 3.1.0 -> satisfiable by pelago/emogrifier[v3.1.0].
    - woocommerce/woocommerce[3.9.0-beta.1, ..., 3.9.3, 4.0.0-beta.1, ..., 4.6.2] require composer/installers 1.7.0 -> satisfiable by composer/installers[v1.7.0].
    - inpsyde/product-woocommerce-logging dev-task/php72 conflicts with woocommerce/woocommerce 4.7.1.
    - inpsyde/product-woocommerce-logging dev-task/php72 conflicts with woocommerce/woocommerce 4.7.1-beta.1.
    - inpsyde/product-woocommerce-logging dev-task/php72 conflicts with woocommerce/woocommerce 4.7.0.
    - inpsyde/product-woocommerce-logging dev-task/php72 conflicts with woocommerce/woocommerce 4.7.0-rc.1.
    - inpsyde/product-woocommerce-logging dev-task/php72 conflicts with woocommerce/woocommerce 4.7.0-beta.2.
    - inpsyde/product-woocommerce-logging dev-task/php72 conflicts with woocommerce/woocommerce 4.7.0-beta.1.
    - pelago/emogrifier v3.1.0 requires php ^5.6 || ~7.0 || ~7.1 || ~7.2 || ~7.3 || ~7.4 -> your php version (8.0.5) does not satisfy that requirement.
    - composer/installers v1.7.0 requires composer-plugin-api ^1.0 -> found composer-plugin-api[2.0.0] but it does not match the constraint.
    - inpsyde/product-woocommerce-logging is present at version dev-task/php72 and cannot be modified by Composer
    - Root composer.json requires woocommerce/woocommerce ^3.9 || ^4.0 || ^5.0 -> satisfiable by woocommerce/woocommerce[3.9.0-beta.1, ..., 3.9.3, 4.0.0-beta.1, ..., 4.9.2, 5.0.0-beta.1, ..., 5.4.0-rc.1].

I actually allow ^3.9 | ^4.0 | ^5.0, and conflict with 4.7 due to #28320.

Steps to reproduce the bug

  1. In any Composer package, require woocommerce/woocommerce:5.4.0-rc.1;
  2. Ensure PHP 8.x;
  3. Attempt composer update;
  4. Observe symptom (actual behaviour).

Isolating the problem

  • I can reproduce this bug consistently using the steps above.

Remarks

pelago/emogrifier actually adds support for PHP 8 in 5.0.0, but this package only allows the specific version 3.1.0.

⚠️ For some reason, this is not visible in the build, as the pelago/emogrifier doesn't seem to be attempted by Composer at all. I'm not sure why this is exactly, but perhaps it has something to do with the fact that you are pretending to be on PHP 7.0 regardless of what version you are on actually. That way the builds do not prove that this package is actually installable on any version of PHP besides 7.0. Consider removing that: I understand that this is probably done in order to build the actual plugin, and this needs deps to be installed on the minimal supported version (7.0), but this isn't really a great way to do that, as this issue shows. What I would do is remove the platform override, and simply set it only during the actual building of the distributable plugin archive. That way the the tests will actually prove that stuff is installable, and you get to ship your plugin with deps that are guaranteed to run on your lowest required PHP version.

szepeviktor
szepeviktor

Hello Peter! Why do you encourage users to run on a several years and unsupported old PHP version?

Is this why? kép

pull request

szepeviktor pull request php-stubs/woocommerce-stubs

szepeviktor
szepeviktor

Generate stubs for WooCommerce 6.1.0

Generated by extracting https://downloads.wordpress.org/plugin/woocommerce.6.1.0.zip to source/woocommerce.

This is necessary because WooCommerce's package on Packagist is broken and not available.

See #12

Activity icon
issue

szepeviktor issue comment php-stubs/woocommerce-stubs

szepeviktor
szepeviktor

Generate stubs for WooCommerce 6.1.0

Generated by extracting https://downloads.wordpress.org/plugin/woocommerce.6.1.0.zip to source/woocommerce.

This is necessary because WooCommerce's package on Packagist is broken and not available.

See #12

Activity icon
issue

szepeviktor issue comment php-stubs/woocommerce-stubs

szepeviktor
szepeviktor

Generate stubs for WooCommerce 6.1.0

Generated by extracting https://downloads.wordpress.org/plugin/woocommerce.6.1.0.zip to source/woocommerce.

This is necessary because WooCommerce's package on Packagist is broken and not available.

See #12

szepeviktor
szepeviktor

About packaging: in WC releases two different commits may get the same tag :( Everything is highly unstable.

Activity icon
issue

szepeviktor issue comment php-stubs/woocommerce-stubs

szepeviktor
szepeviktor

Generate stubs for WooCommerce 6.1.0

Generated by extracting https://downloads.wordpress.org/plugin/woocommerce.6.1.0.zip to source/woocommerce.

This is necessary because WooCommerce's package on Packagist is broken and not available.

See #12

szepeviktor
szepeviktor

And there is https://github.com/woocommerce/woocommerce/issues/30027 ...

We lack rocket scientists and brain surgeons!!

Activity icon
issue

szepeviktor issue comment php-stubs/woocommerce-stubs

szepeviktor
szepeviktor

Generate stubs for WooCommerce 6.1.0

Generated by extracting https://downloads.wordpress.org/plugin/woocommerce.6.1.0.zip to source/woocommerce.

This is necessary because WooCommerce's package on Packagist is broken and not available.

See #12

szepeviktor
szepeviktor

It all begin with WC 5.9 ...

Activity icon
issue

szepeviktor issue comment php-stubs/woocommerce-stubs

szepeviktor
szepeviktor

Generate stubs for WooCommerce 6.1.0

Generated by extracting https://downloads.wordpress.org/plugin/woocommerce.6.1.0.zip to source/woocommerce.

This is necessary because WooCommerce's package on Packagist is broken and not available.

See #12

szepeviktor
szepeviktor

Thank you James for your work. #13 Please continue in OM4/woocommerce-stubs as this project is Composer based. Currently CI is not able to verify commits. I think Composer package is a low priority for the WC Team as barely anyone is installing WC with Composer.

Jan
16
2 days ago
Activity icon
issue

szepeviktor issue comment szepeviktor/phpstan-wordpress

szepeviktor
szepeviktor

Cannot redeclare wp_set_password()

Hello we have wordpress installed by composer. The composer installs it to two separate folders (wp where are all core files, wp-content etc.) And when installing something else(i.e. plugins etc.) they are installed to separate folder wp-content in root. Wordpress works good. But when trying to run phpStan there is an error Fatal error: Cannot redeclare wp_set_password() (previously declared in C:\wamp64\www\uw-kuppro\wp-content\vendor\roots\wp-password-bcrypt\wp-password-bcrypt.php:86) in C:\wamp64\www\uw-kuppro\wp-content\vendor\php-stubs\wordpress-s tubs\wordpress-stubs.php on line 109004 Script wp-content/vendor/bin/phpstan analyse --debug handling the phpstan event returned with error code 255 make: *** [Makefile:2: pre-commit] Error 255 I presume that it is because of the folder structure? Or problem is somewhere else? On another project(only plugin for WP) your phpStan rules works great. Thanks for your help. Michal Dolezal

Activity icon
issue

szepeviktor issue szepeviktor/phpstan-wordpress

szepeviktor
szepeviktor

Cannot redeclare wp_set_password()

Hello we have wordpress installed by composer. The composer installs it to two separate folders (wp where are all core files, wp-content etc.) And when installing something else(i.e. plugins etc.) they are installed to separate folder wp-content in root. Wordpress works good. But when trying to run phpStan there is an error Fatal error: Cannot redeclare wp_set_password() (previously declared in C:\wamp64\www\uw-kuppro\wp-content\vendor\roots\wp-password-bcrypt\wp-password-bcrypt.php:86) in C:\wamp64\www\uw-kuppro\wp-content\vendor\php-stubs\wordpress-s tubs\wordpress-stubs.php on line 109004 Script wp-content/vendor/bin/phpstan analyse --debug handling the phpstan event returned with error code 255 make: *** [Makefile:2: pre-commit] Error 255 I presume that it is because of the folder structure? Or problem is somewhere else? On another project(only plugin for WP) your phpStan rules works great. Thanks for your help. Michal Dolezal

Activity icon
issue

szepeviktor issue comment szepeviktor/phpstan-wordpress

szepeviktor
szepeviktor

Cannot redeclare wp_set_password()

Hello we have wordpress installed by composer. The composer installs it to two separate folders (wp where are all core files, wp-content etc.) And when installing something else(i.e. plugins etc.) they are installed to separate folder wp-content in root. Wordpress works good. But when trying to run phpStan there is an error Fatal error: Cannot redeclare wp_set_password() (previously declared in C:\wamp64\www\uw-kuppro\wp-content\vendor\roots\wp-password-bcrypt\wp-password-bcrypt.php:86) in C:\wamp64\www\uw-kuppro\wp-content\vendor\php-stubs\wordpress-s tubs\wordpress-stubs.php on line 109004 Script wp-content/vendor/bin/phpstan analyse --debug handling the phpstan event returned with error code 255 make: *** [Makefile:2: pre-commit] Error 255 I presume that it is because of the folder structure? Or problem is somewhere else? On another project(only plugin for WP) your phpStan rules works great. Thanks for your help. Michal Dolezal

szepeviktor
szepeviktor

I presume that it is because of the folder structure?

Hello Michal! 🇨🇿 It is talked about in a pinned issue and at the end of the README. https://github.com/szepeviktor/phpstan-wordpress/blob/master/README.md#dirty-corner-faq

You may also remove roots/wp-password-bcrypt just before static analysis.

Jan
15
3 days ago
Activity icon
issue

szepeviktor issue comment stefenphelps/stefenphelps.com

szepeviktor
szepeviktor

Scripts have CSP problem

No mustache generator on the front page. @stefenphelps 👨

Activity icon
delete
deleted time in 3 days ago
Activity icon
issue

szepeviktor issue comment stefenphelps/stefenphelps.com

szepeviktor
szepeviktor

Add all-allowing robots.txt

See other files downloaded without a link: https://github.com/szepeviktor/RootFiles

szepeviktor
szepeviktor

@stefenphelps 💡 This is invalid. https://stefenphelps.com/robots.txt To tell robots everything is allowed

User-agent: *
Disallow:

https://www.robotstxt.org/robotstxt.html

Activity icon
issue

szepeviktor issue stefenphelps/stefenphelps.com

szepeviktor
szepeviktor

Scripts have CSP problem

No mustache generator on the front page. @stefenphelps 👨

Previous