How to guarantee that we are working with a safe UTF-8 string, no matter what a user may throw at us? [duplicate]

There’s little to no information online about how to properly handle multi-byte characters through the life cycle of a PHP script.

If we need to be certain that our $_POST data is valid UTF-8 and safe from invalid byte sequences, which function(s) should be used to guarantee this?

HTML 5

On the modern internet, HTML 5 is the standard and UTF-8 is the default (or only) encoding used.

What do we need to do as developers to tell the browser that we are using UTF-8 for both input and output, everywhere?

Role of the Browser

Is the browser supposed to do input character translation for us?

ie. if a user submits a textarea element as part of an
HTML 5 form that has Windows-1252 encoded characters pasted in from MS Word with curly quotes, is it the browser’s job to convert the Windows-1252 to UTF-8 on paste (without any javascript) and only send UTF-8 to the server?

PHP settings

Which settings need to be set in PHP, in general, to tell PHP that incoming POST and GET data should be UTF-8, and that output needs to be UTF-8?

PHP Default Behavior

Does PHP do any character encoding translation automatically when it sets up the internal $_GET and $_POST arrays?

Assume that a malicious person did not use a browser, but sends a deliberately malformed character string to the PHP endpoint directly.

Will PHP automatically replace malformed byte sequences with a substitution character, or will $_POST contain the raw bytes that could have dangerous sequences, and could be any encoding?

To put it another way, does PHP automatically strip malformed characters or is this the developer’s job?

User Input Sanitization

If the developer is responsible for assuring that the incoming user input is actually valid UTF-8 and not malformed UTF-8 or some other encoding, what tool(s) should be used?

PHP has an mb_scrub() function, but it seems that this function replaces invalid byte sequences with a simple question mark ? and not with the U+FFFD Unicode replacement character.

It seems you should be able to set the replacement character with
mb_substitute_character(0xFFFD);

But the man page says: “This setting affects mb_convert_encoding(), mb_convert_variables(), mb_output_handler(), and mb_send_mail().”

It doesn’t mention mb_scrub().

Question

So the question all of this is working towards is:

If we want to get our $_POST data and have it scrubbed of invalid byte sequences, and replace invalid bytes with 0xFFFD, what is the correct function(s) to do this, so we can be guaranteed that we are working with a safe UTF-8 string, no matter what a user may throw at us?

Outer loop not working in Nested-While-Loop [duplicate]

I have three tables blogs, comments and replies.

I have the blog_id primary key in the blogs tables, comment_id primary key in the comments tables, and reply_id primary key in the replies tables.

In the blogs table I have one column named as-

blog_id         int(11)

In the comments table I have the following columns-

comment_id         int(11),
comment_viewer_id  int(11),
comm_blog_id       int(11),
comment_message    longtext,
comment_on         datetime

In the replies table I have the following columns-

reply_id         int(11),
reply_viewer_id  int(11),
reply_blog_id    int(11),
reply_comm_id    int(11),
reply_message    longtext,
reply_on         datetime

Suppose I have a blog_id = "2", and
I have a comment_id = "5".

The query which I have used to fetch the comment_message is as follows:

SELECT * FROM `comments` 
INNER JOIN `blogs` 
ON comments.comm_blog_id = blogs.blog_id 
WHERE comments.comm_blog_id = '2' 
ORDER BY comments.comment_on 
DESC

The query which I have used to fetch the reply_message is as follows:

SELECT * FROM `replies` 
INNER JOIN `blogs` 
INNER JOIN `comments` 
ON replies.reply_blog_id = blogs.blog_id 
AND replies.reply_comm_id = comments.comment_id 
WHERE replies.reply_blog_id = '2' 
AND replies.reply_comm_id = '5' 
ORDER BY replies.reply_on 
DESC

The query that I have used to fetch the data from the database uses a while-loop inside the while-loop(i.e. Nested-While-Loop) inside the PHP as follow:

$sql_comm = "SELECT * FROM `comments` INNER JOIN `blogs` ON comments.comm_blog_id = blogs.blog_id WHERE comments.comm_blog_id = '2' ORDER BY comments.comment_on DESC";
            $result = mysqli_query($conn, $sql_comm);

            while ($row = mysqli_fetch_assoc($result)) {
                $comment_message = $row["comment_message"];

                echo '
                    <div class="comment_container">
                        <div class="comment_box">
                            <div class="comment_card">
                                <div class="user_details">
                                    <div class="user_dp">
                                        <img src="../img/users_img/black-soil.jpg" alt="">
                                    </div>
                                    <div class="user_name">
                                        <h3>@hello viewer</h3>
                                    </div>
                                </div>
                                <p>'.$comment_message.'</p>
                                <div class="comment_footer">
                                    <div class="like">
                                        <button type="submit">
                                            <i class="fa-regular fa-thumbs-up"></i>
                                        </button>
                                        <p>50</p>
                                    </div>
                                    <div class="dislike">
                                        <button type="submit">
                                            <i class="fa-regular fa-thumbs-down"></i>
                                        </button>
                                        <p>5</p>
                                    </div>
                                    <div class="reply">
                                        <button type="submit">
                                            <p>reply</p>
                                        </button>
                                        <p>0</p>
                                    </div>
                                </div>
                            </div>';


                            $sql_reply = "SELECT * FROM `replies` INNER JOIN `blogs` INNER JOIN `comments` ON replies.reply_blog_id = blogs.blog_id AND replies.reply_comm_id = comments.comment_id WHERE replies.reply_blog_id = '2' AND replies.reply_comm_id = '5' ORDER BY replies.reply_on DESC";
                            $result = mysqli_query($conn, $sql_reply);

                            while ($row = mysqli_fetch_assoc($result)) {
                            $reply_message = $row["reply_message"];
                                echo '
                                    <div class="comment_box">
                                        <div class="comment_card">
                                            <div class="user_details">
                                                <div class="user_dp">
                                                    <img src="../img/users_img/black-soil.jpg" alt="">
                                                </div>
                                                <div class="user_name">
                                                    <h3>@hello viewer</h3>
                                                </div>
                                            </div>
                                            <p>'.$reply_message.'</p>
                                            <div class="comment_footer">
                                                <div class="like">
                                                    <button type="submit">
                                                        <i class="fa-regular fa-thumbs-up"></i>
                                                    </button>
                                                    <p>50</p>
                                                </div>
                                                <div class="dislike">
                                                    <button type="submit">
                                                        <i class="fa-regular fa-thumbs-down"></i>
                                                    </button>
                                                    <p>5</p>
                                                </div>
                                                <div class="reply">
                                                    <button type="submit">
                                                        <p>reply</p>
                                                    </button>
                                                    <p>0</p>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                ';
                            }
                        ';
                    </div>
                </div>';
            }

Using the above query I have get multiple replies_comment but I have didn’t get multiple comment_message.

I want the result just like this-

Blog-1-Comment-1
   Blog-1-Comment-1-Reply-1
   Blog-1-Comment-1-Reply-2
   Blog-1-Comment-1-Reply-3

Blog-1-Comment-2
   Blog-1-Comment-2-Reply-1
   Blog-1-Comment-2-Reply-2

Blog-1-Comment-3

Blog-1-comment-4

Comment database table

Replies database table

I want the result just like this-

Blog-1-Comment-1
   Blog-1-Comment-1-Reply-1
   Blog-1-Comment-1-Reply-2
   Blog-1-Comment-1-Reply-3

Blog-1-Comment-2
   Blog-1-Comment-2-Reply-1
   Blog-1-Comment-2-Reply-2

Blog-1-Comment-3

Blog-1-comment-4

how can add functionality on the share button of the telegram in php bot

I’m facing a issue in the php telegram bot. In this bot i need to add some functionality like, when we open the bot and run the /start command then we received some caption or inline keyboard button. like this first image…

caption message and buttons

after that when we share this message to another user or contacts of the telegram users, using this share button (check this image for share button image)…
enter image description here.

when we click on this share button then a popup open which showing the list of telegram users from our contact list.

then we select one or more users to share this bot message to other users,

then we click on the send button after select few users to share.
enter image description here

when click on the send button then the bot message will forwarded to the selected user, but as when we share then we should get response in the bot then message was send, and after share we add some functionality that we will received some reward amount after share.

so in the php telegram bot, how i can add functionality that when i click on share and send to other users then we get some reward.

so how i can archive this functionality.

how i can add funcitonality on share button.

i try to get the inline query response, but still don’t get required functionality.

when we search and open the telegram bot then its showing a start button. as we click on this start button then its send a welcome message,

because as we click on the start button then its getting the command /start and we add functionality
that the telegram bot api received /start command and then send response the welcome message.

thus we want to get some reward or any other message or can be add or update some value in the database when we click on the share the welcome message to other contacts.

so tell me how i can add functionality on the share button.

Why Laravel routes registered in module custom service provider not available on url?

I’m refactoring backend part of existing Laravel 10 + Vue 3 SPA app to Modules that among other things contain route files that registered in module service provider:


class AuthenticationServiceProvider extends ServiceProvider
{
    public function boot(): void
    {
       $this->registerRoutes();
    }

    public function register()
    {
        // .....
    }

    protected function registerRoutes(): void
    {
        Route::middleware('api')
            ->prefix('api')
            ->namespace('App\Modules\Authentication\Http\Controllers\')
            ->group(__DIR__ . '/../Authentication/routes/api/auth.php');
    }
}


This is auth.php file:

Route::group(['middleware' => ['api.auth'], 'prefix' => 'auth'], function () {
    Route::post('register', [AuthenticationController::class, 'register'])->name('auth.register')->withoutMiddleware('api.auth');
    Route::post('login', [AuthenticationController::class, 'login'])->name('auth.login')->withoutMiddleware('api.auth');
    Route::get('refresh', [AuthenticationController::class, 'refresh'])->name('auth.refresh')->withoutMiddleware('api.auth');
    Route::get('logout', [AuthenticationController::class, 'logout'])->name('auth.logout');
    Route::get('get-authenticated', [AuthenticationController::class, 'getAuthenticated'])->name('customers.get-authenticated');
});

Module service provider is registered in Laravel config app.php file in providers array:

This is my web.php:

Route::any('{all}', function () {
    return view('welcome');
})
    ->where('all', '^(?!api).*$')
    ->where('all', '^(?!storage).*$');

Routes are registered and visible in php artisan route:list, but when I try test this route I can’t reach api/auth/login route and others

How to solve this problem?

My php script returns the json response to the browser correctly, but it doesn’t return anything to postman [closed]

My php script returns the json response to the browser correctly, but it doesn’t return anything to Postman and to the Kotlin app. Why? Thank you. Could someone please help me?
Here is the php code:

 ......
 $jsonData = ['status' => $status,'message' => $message, 'more' => $more];
 header('Content-type: application/json');
 echo(json_encode($jsonData));
 exit();

HMAC signature doesn’t match and accept from AROFLO API in PHP code but matches through Node.js

`We are having trouble executing the AROFLO API(which requires HMAC-SHA512 Key Authentication) endpoint for retrieving users with the PHP code, while it works fine through Node.js, which uses the crypto.createHmac(‘sha512’, secretKey).update(payload).digest(‘hex’);
method.
The error message we receive in the browser with the PHP script is:
{ “status”: “-99999”, “statusmessage”: “Authentication Failed – Signatures do not match” }

But we need to run the api requests in PHP only.
I have attached my php code below if anyone could solve this issue that would be great

I have tried running the code in PHP using the HMAC method, but I keep getting a “signature does not match” error from the AROFLO API response. I have verified that the payload strings and encoded authorization fields match between the Node.js and PHP code, and both sides use the same secret keys. Everything seems to be correct, without any extra whitespace or symbols.

I hope someone can help me fix this issue.

I create the HMAC in PHP:

function generateHMAC($payload, $secretKey) { // Decode the base64 encoded secret key $decodedKey = base64_decode($secretKey); $hmac = hash_hmac('sha512', $payload, $decodedKey, true); return bin2hex($hmac); } $payloadString = implode('+', $payload); $hash = generateHMAC($payloadString, $secretKey);

Then I create an HMAC in Node like below:
secret_key: ‘V3XtVWFWbEswcUtsdVF3TWZJLzdHMGxrTU85T2FlSzJ6YzFsT0FOcGJhR0OxGWUaN2MzWUtIM2AnT3dqSFhDksNaRmJpNCtpaVI3BSZucUpjVIEJclE9ZU==’,
HostIP: ‘89.11.22.98’,
uEncoded: ‘Kz5OScZQQAs7WIAgIBc=’,
pEncoded: ‘NDU8EGSoywF2M2nwdnVx’,
orgEncoded: ‘JPAQVywDTEwgXg==’,
accept: ‘text/json’, // or ‘text/xml’

payload.push(hostIP);
payload.push(urlPath);
payload.push(accept);
payload.push(Authorization);
payload.push(isotimestamp);
payload.push(VarString);

const hash = generateHMAC(payload.join('+'), secretKey);

const check = crypto.createHmac(‘sha512’, secretKey).update(payload).digest(‘hex’);

How to gret lastInsertId() after using a temp table [duplicate]

I am duplicating a row within a table. The primary key should auto update, so I remove that Primary Key value (MenuID) from the select in a temporary table and allow the insert to create a value for the new row.

This works fine, but I would like to access the lastInsertId() value (in php in this case). However I get an incorrect value back (I get 0). I suspect that is because I am using a temporary table. So how do I get the correct lastInsertId()?
my SQL looks like this:

$stmt = $conn->prepare("CREATE TEMPORARY TABLE tmp AS 
SELECT * FROM Menues WHERE MenuID=:menuid AND UserName =:username; 
ALTER TABLE tmp DROP MenuID; UPDATE tmp SET parentID =:parentid; 
INSERT INTO Menues SELECT 0,tmp.* FROM tmp;  DROP TABLE tmp;");

Using the Stripe API, how to retreive a payment intent from a connected account?

I’m using stripe to build an application that uses connected accounts. I need to retrieve the paymentIntent that was used for a purchase associated with a given connected account. I’m able to create the paymentIntent using the syntax listed as the first example here: https://docs.stripe.com/connect/authentication, but when I try to use the same syntax to retrieve a payment intent I get the following error:

Received unknown parameter: stripe_account

This is the code I’m using to retrieve the payment intent:

$payment_intent = $stripe->paymentIntents->retrieve(
        $payment_intent_id,
        ['stripe_account' => $connected_account_id]
    );

Is it possible to retrieve a paymentIntent from a connected account and if so, how do I do it if not using the same syntax as creating the patmentIntent?

I’m using PHP and prefer to do this server-side, but I’m open to using JS on the client if necessary. Thank you.

Fatal Error occuring in the model document of a PHP project [duplicate]

I’m trying to allow a guest to update their details in a database using php. I have set up the file and tried numerous things however I can’t seem to get past this error message.

The file where the error message appears to be comiong from is the model file which handles the database interactions. The error message is as follows:

Fatal error: Uncaught PDOException: SQLSTATE[HY093]: Invalid parameter number: number of bound variables does not match number of tokens in C:xampphtdocsWedding PHPincludesrsvp_model.inc.php:25 Stack trace: #0 C:xampphtdocsWedding PHPincludesrsvp_model.inc.php(25): PDOStatement->execute() #1 C:xampphtdocsWedding PHPincludesrsvp_contr.inc.php(36): insert_group_one(Object(PDO), ‘Yes’, ‘sf’, ‘sd’, ‘No’) #2 C:xampphtdocsWedding PHPincludesrsvp.inc.php(55): insert_rsvp_group_one(Object(PDO), ‘Yes’, ‘sf’, ‘sd’, ‘No’) #3 {main} thrown in C:xampphtdocsWedding PHPincludesrsvp_model.inc.php on line 25

I have checked the session variables and post variables and all are correctly showing the data which is intended.

The file below is C:xampphtdocsWedding PHPincludesrsvp_model.inc.php

<?php

declare(strict_types=1);

function get_user(object $pdo, string $username) {
    $query = "SELECT * FROM rsvp WHERE username = :username;";
    $stmt = $pdo -> prepare($query);
    $stmt->bindParam(":username", $username);
    $stmt->execute();

    $result = $stmt->fetch(PDO::FETCH_ASSOC);
    return $result;
}

function insert_group_one(object $pdo, string $guest_one_attendance, string $dietary_input, string $song_input, string $fairfield_hotel) {
    $query = "UPDATE rsvp SET guest_one_attendance = ':guest_one' , dietary = ':dietary_input' , song = ':song_input' , fairfield_hotel = ':fairfield' WHERE id = {$_SESSION["user_id"]};";
    $stmt = $pdo->prepare($query);

    $stmt->bindParam(":guest_one", $guest_one_attendance);
    $stmt->bindParam(":dietary_input", $dietary_input);
    $stmt->bindParam(":song_input", $song_input);
    $stmt->bindParam(":fairfield", $fairfield_hotel);
    $stmt->execute();
}

The file below is C:xampphtdocsWedding PHPincludesrsvp_contr.inc.php

function insert_rsvp_group_one(object $pdo, string|null $guest_one_attendance, string $dietary_input, string $song_input, string|null $fairfield_hotel) {
    insert_group_one($pdo, $guest_one_attendance, $dietary_input, $song_input, $fairfield_hotel);
}

Then the code from C:xampphtdocsWedding PHPincludesrsvp.inc.php is below

 if (empty( $_SESSION["user_guest_two"])) {
            insert_rsvp_group_one($pdo, $guest_one_attendance, $dietary_input, $song_input, $fairfield_hotel); // CHECKS THE GUEST NAMES AND DEPENDING ON WHICH ARE EMPTY CALLS ON THE CORRECT FUNCTION TO INSERT DATA INTO THE DATABASE
        } else if (!empty( $_SESSION["user_guest_two"])) {
            insert_rsvp_group_two($pdo, $guest_one_attendance, $guest_two_attendance, $dietary_input, $song_input, $fairfield_hotel);
        }

composer install command showing composer version and help center instead of installing packages

composer install command showing composer version and help center instead of installing packages

i want run a laravel project in localhost

first i added envirment variable then another error i fix . i added composer.phar run with php.exe

but last error composer install command keep showing help center and documentation of composer

i have no idea

look in this picture
enter image description here

and here is my packages file

{
    "name": "loshmis/vanguard",
    "description": "Advanced PHP Login and User Management",
    "keywords": ["advanced", "secure", "login", "user management", "authentication", "authorization", "register"],
    "type": "project",
    "repositories": [],
    "require": {
        "php": "^7.2",
        "anlutro/l4-settings": "^1.0",
        "bacon/bacon-qr-code": "^2.0",
        "barryvdh/laravel-debugbar": "^3.3",
        "coinbase/coinbase-commerce": "^1.0.1",
        "fideloper/proxy": "^4.0",
        "geoip2/geoip2": "^2.11",
        "guzzlehttp/guzzle": "^6.5.5",
        "hexters/coinpayment": "^2.0",
        "intergo/sms.to-laravel-lumen": "^0.0.28",
        "intervention/image": "^2.3",
        "jenssegers/agent": "^2.5",
        "jeremykenedy/laravel-roles": "3.*",
        "laracasts/presenter": "^0.2.1",
        "laravel/framework": "8.x",
        "laravel/legacy-factories": "^1.0",
        "laravel/tinker": "^2.0",
        "laravel/ui": "*",
        "laravelcollective/html": "^6.0",
        "league/fractal": "^0.16.0",
        "mobiledetect/mobiledetectlib": "^2.8",
        "paragonie/random_compat": "~1.4",
        "pragmarx/google2fa-laravel": "^1.4",
        "predis/predis": "^1.1",
        "proengsoft/laravel-jsvalidation": "^4.0",
        "spatie/db-dumper": "^2.21",
        "tymon/jwt-auth": "1.*",
        "yajra/laravel-datatables-oracle": "~9.0"
    },
    "require-dev": {
        "filp/whoops": "^2.0",
        "fzaninotto/faker": "^1.4",
        "mockery/mockery": "^1.0",
        "nunomaduro/collision": "^4.1",
        "phpunit/phpunit": "^8.5"
    },
    "autoload": {
        "classmap": [
            "database/seeds",
            "database/factories"
        ],
        "psr-4": {
            "VanguardLTE\": "app/"
        },
        "files": [
            "app/Support/helpers.php"
        ]
    },
    "autoload-dev": {
        "psr-4": {
            "Tests\": "tests/"
        }
    },
    "extra": {
        "laravel": {
            "dont-discover": [
            ]
        }
    },
    "scripts": {
        "post-root-package-install": [
            "@php -r "copy('.env.example', '.env');""
        ],
        "post-create-project-cmd": [
            "@php artisan key:generate"
        ],

        "post-autoload-dump": [
            "Illuminate\Foundation\ComposerScripts::postAutoloadDump",
            "@php artisan package:discover"
        ]
    },
    "config": {
        "preferred-install": "dist",
        "sort-packages": true,
        "optimize-autoloader": true
    }
}

I want install packages with composer install . but it shows help center . no matter which command line i use same picture

PHP redirecting to a page defined as a $_SESSION variable [closed]

I am implementing a user authentication scheme in my webapp and I was wondering what the best approach was to redirect a user to their intended page after they successfully logged in.

For example, a user connects to a timesheet.php page, but becasue they have not logged in beforehand the are redirected to the login page. Once they successfully log in, I would like to redirect the user to their originally intended page (timesheet.php).

I have tried creating a session variable ($_SESSIOn[‘redirect’] = ‘timesheet.php’;) and after logging in if the $_SESSION[‘redirect’] isset, execute header(Location: $_SESSION[‘redirect’];, but that does not work.

Am I doing something wrong, or is this not a supported approach with the header() function?

On detection that not logged in…

$_SESSION['redirect'] = "timesheet.php"; header('Location: login.php'); exit();

Inside login.php…

On successful password_verify()…
header(Location: $_SESSION['redirect']);

SQL/Laravel: Get parents in tree data structure

Hello everyone) I use Laravel, MariaDB.

For example, we have a table like this, let’s say categories.

id name _lft _rgt parent_id path is_folder
1373 Windows 1 10 NULL 1373 1
1374 Glass unit 2 7 1373 1373.1374 1
1375 Accessories 8 9 1373 1373.1375 1
1376 Installation 3 4 1374 1373.1374.1376 0
1377 Adjustment 5 6 1374 1373.1374.1377 0

The Categories model uses the KalnoyNestedsetNodeTrait trait.
In the code below, the query builder already contains basic filters (for example, by name)

if (!empty($filters['recursiveSearch']) && CommonService::parseBoolean($filters['recursiveSearch']) === true) {
/** @var QueryBuilder $query */
}

When passing the recursiveSearch parameter, it is necessary to output not only the values โ€‹โ€‹that match the filter, but also all their parents.

For example: by the filter name=adjust we get the string Adjustment. with recursiveSearch you also need to get Windows and Glass unit.


The query can also have a filter parentId. If parentId=null&name=adjust&recursiveSearch=true then it should return Windows

Please help ๐Ÿ™‚

Initially I thought to do just with('ancestors'), but the result gets into the relations, and should be in the main query.

Then I made an additional query, got the result of the first selection, got pluck('ancestors') and already substituted their IDs into the resulting query. It worked, but if in the initial selection there are, for example, 1000 records and each has 3 parents, then in the end there will be where on 3000 IDs.

After Shopware update 6.5.5.2 => 6.5.8.11 filter plugin doesn’t work

After Shopware update 6.5.5.2 => 6.5.8.11 custom filter plugin doesn’t work. It should filter properties depending on another property selected.

Here it is how Subscriber.php class looks:

class Subscriber implements EventSubscriberInterface
{
    private EntityRepository $optionRepository;

    public function __construct(EntityRepository $optionRepository)
    {
        $this->optionRepository = $optionRepository;
    }

    public static function getSubscribedEvents(): array
    {
        return [
            ProductListingCriteriaEvent::class => [
                ['onListingCriteria', -200],
            ],
        ];
    }

    public function onListingCriteria(ProductListingCriteriaEvent $event): void
    {
        $event->getCriteria()->addAssociation('properties');
        $event->getCriteria()->addAssociation('properties.group');

        $criteria = $event->getCriteria();
        $filters = $criteria->getExtension('filters');

        if (!$filters instanceof FilterCollection) {
            return;
        }

        $propertyFilter = $filters->get('properties');

        if (!$propertyFilter instanceof Filter || !is_array($propertyFilter->getValues())) {
            return;
        }

        $currentPropertyOptions = $propertyFilter->getValues();

        $event->getContext()->addExtension('currentPropertyOptionsCriteria', new ArrayEntity($currentPropertyOptions));

        $criteria1 = new Criteria();
        $criteria1->addAssociation('myTags');
        $criteria1->setIds($currentPropertyOptions);

        $tags = new TagCollection();
        $options = $this->optionRepository->search($criteria1, $event->getContext())->getEntities();
        /** @var PropertyGroupOptionEntity $option */
        foreach ($options as $option) {
            $extension = $option->getExtension('myTags');
            
            if (!$extension instanceof TagCollection) {
                continue;
            }
            
            $tags->merge($extension);
        }

        $tags = $option->getExtension('myTags');
        $tagnames = $tags->map(fn (TagEntity $tag) => $tag->getName());
        $event->getContext()->addExtension('myTagsNames1', new ArrayEntity($tagnames));

        $prefixes = ['84a5f522d04f463a93a858b3c1bb8f7a','40f24f88c4c34196ad21ec5dcd094e6a', 'e892c99ffc5747848aea3aa5c8126201', '96e839a6e32a4301b238e90088f4a778', 'c5d7bcee60f7493bb6203965e15068e0', '9c493945d37b4ff1b527a874d8315519', 'f032b2d21c484196ad3a98d90379f6c0', 'a07ec367574a4c3d81b7fb6ceae66ffe'];

        if (in_array('3f777000a2734deead391133cee3a6a9', $currentPropertyOptions)) {

            $multiFilter = new MultiFilter(MultiFilter::CONNECTION_OR);

            foreach ($tagnames as $tagname) { $multiFilter->addQuery(new PrefixFilter('product.properties.name', $tagname));}

            foreach ($prefixes as $prefix) {
                $multiFilter->addQuery(new EqualsFilter('product.properties.group.id', $prefix));
            }

            $criteria->addFilter($multiFilter);
        }

        ..

        if (in_array('a637fe94fe794a84b0ce7fc2a13e1485', $currentPropertyOptions)) {
            $multiFilter = new MultiFilter(MultiFilter::CONNECTION_OR);

            foreach ($tagnames as $tagname) { $multiFilter->addQuery(new PrefixFilter('product.properties.name', $tagname));}

            foreach ($prefixes as $prefix) {
                $multiFilter->addQuery(new EqualsFilter('product.properties.group.id', $prefix));
            }

            $criteria->addFilter($multiFilter);
        }
    }
} 

I try to debug it, but can’t find an issue. Associated Properties Tags are in place. But it doesn’t filter properties depending on selected one.

Can someone give a tip on debug? Or maybe there is a new way of implementing this kind of custom filtering in Shopware 6.5.8.11 or 6.6 (we are going to update to latest version)?

Eclipse PHP built in server wrong path and cant find resources

CURRENT SETUP
Software
Windows 10
XAMPP (Apache, PHPMyadmin, Fillezilla, openssl etc.)
Eclipse Version: 2024-03 (4.31.0)
PHP Version 8.2.12
XDEBUG 3.3.2
project path: G:xampphtdocsapiproject
php built in server path: https://localhost
project path settings:
project base path: api/project
https://localhost/api/project
server xml:


<?xml version="1.0" encoding="UTF-8"?>
<Server>
    <Port name="HTTP/1.1" protocol="HTTP">8429</Port>
<PathMapping local="https://localhost/api/project" module="project" remote="G:xampphtdocsapiproject"/></Server>

Run as – Run on server does not work. It has a wrong path (without /api/ part) and even when correcting the path there are no files found.

run as – run on server
gives:
browser: Not Found The requested resource /project/login.php was not found on this server.
console:

[Fri Aug  2 11:19:18 2024] 127.0.0.1:64548 Accepted    [Fri Aug  2 11:19:18 2024] 127.0.0.1:64548 [404]: GET /project/login.php - No such file or directory    [Fri Aug  2 11:19:18 2024] 127.0.0.1:64548 Closing

run as – CLI application works
run as – web application works
browser: localhost:8429 – not found localhost:8429/api/project – not found
terminal: ping localhost:8429 -not found
How to fix this?