Does Bit Flows Pro limit either the number of nodes executed in a single flow or the maximum duration?

Bit Flows Pro flow stops early (~20–21s) with fewer nodes than expected on WordPress (OpenLiteSpeed + lsphp). Where is the timeout coming from and how do I raise it?

Environment

  • WordPress + Bricks Builder
  • JetEngine (CCTs + Relations), JetFormBuilder (form + repeater)
  • Bit Flows Pro (flows triggered by webhook)
  • RunCloud server running OpenLiteSpeed with lsphp 8.1 (not PHP-FPM)

What the flow does

A JetFormBuilder form creates 4 CCTs of type “contatos” (x1), “atribuicoes” (x2) and “interacoes” (x1).
Then it sends a webhook to Bit Flows Pro with a repeater array so the flow can create N extra CCTs of type “interacoes“ and all the relations between them. The N extra CCTs and the connections they require are created with Rest API requests.

What I tried

Each repeater item equals a “cycle” of 6 nodes (create interacao, 5 relations).
With the 2 “intro” nodes at the start, a run with 2 items on the repeater should end with 14 nodes. A run with 3, with 20 nodes and so on.

If I have 3 items on the repeater, everything works fine, with the run ending with 20 nodes at around 19-20s. When I try to add a fourth item do the repeater, the run ends early with around 21 nodes, status SUCCESS, and duration ~19–21s.

The logs show no errors, both the Bit Flows Pro logs and the WP debug log.

What I suspect

A hard timeout based on the number of nodes or on ~20s (runner/job timeout) is aborting the flow before the final node(s), even though the flow UI shows “SUCCESS”.

Bit Flows Pro log inside the flow

Flow I built

Expected 2 arguments. Found 1.intelephense(P1005) [closed]

Good evening,

I am a beginner in web developpement and I am stuck beacause when i write thoses lines :

$produit->setCategorie($this->getReference(CategorieFixtures::INFORMATIQUE));

$produit->setCategorie($this->getReference(CategorieFixtures::ELECTROMENAGER));

There is always a red line saying that it expect 2 arguments and I only have one.

On the Online courses it works, but on my computer nothing.

And when I try this commande on my Terminal : php bin/console doctrine:fixtures:load

it says :

Too few arguments to function
DoctrineCommonDataFixturesAbstractFixture::getReference(), 1 passed
in
C:xampphtdocssymfony-sitewebsrcDataFixturesProduitFixtures.php
on line 17 and exactly 2 expected

I hope I was clear.

Here is a picture of my code :
enter image description here

I tried to install the vers 1.2.3 version of PHP but it still did not worked. Even after I reboot my VSCODE.

Then I tried to put in false all the “intelephense” on the JSON file. I rebooted my VSCODE still nothing.

And I tried to empty the cache, then I rebooted my VSCODE and nothing works.

PHP Help Regisiter with image upload

I’m trying to integrate an image upload into the customer add area that will also be saved in the database with the name + uploaded to the folder, I managed to save it in the database but I can’t get it to upload. Can someone tell me what’s wrong? Thanks

Upload form

                                <div class="form-group row m-b-20">
                                    <div class="col-12">
                                        <form enctype="multipart/form-data" method="POST" action="test2.php">
                                        <label for="password">Carte Auto</label>
                                        <input type="file" id="file" name="file" required="true" placeholder="Carte Auto">
                                    </div>
                                </div>

Client add .php

<?php  
session_start();
error_reporting(0);
include('includes/dbconnection.php');
if (strlen($_SESSION['adid']==0)) {
  header('location:logout.php');
  } else{

?>

<?php 
session_start();
error_reporting(0);
include('includes/dbconnection.php');
if(isset($_POST['submit']))
  {
    $fname=$_POST['fullname'];
    $mobno=$_POST['mobilenumber'];
    $email=$_POST['email'];
    $password=md5($_POST['password']);
    $marca=$_POST['marca'];
    $model=$_POST['model'];
    $km=$_POST['km'];
    $servizio=$_POST['servicedate'];
    $carte=$_POST['file'];

    $ret=mysqli_query($con, "select Email from tbluser where Email='$email' || MobileNo='$mobno'");
    $result=mysqli_fetch_array($ret);
    if($result>0){
$msg="Questo indirizzo email o numero di contatto è già associato a un altro account";
    }
    else{
    $query=mysqli_query($con, "insert into tbluser(FullName, MobileNo, Email, Password, CarModel, CarMarca, CarKM, servizio, carte) value('$fname', '$mobno', '$email', '$password', '$marca', '$model', '$km', '$servizio', '$carte')");
    if ($query) {
    $msg="Il cliente si è registrato con successo";
  }
  else
    {
      $msg="Qualcosa è andato storto. Riprova.";
    }
}
}
 ?>
<!doctype html>
<html lang="en">

    <head>
        <meta charset="utf-8" />
        <title>ALL-IN GARAGE SERVICE</title>
        <!-- App css -->
        <link href="../assets/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
        <link href="../assets/css/icons.css" rel="stylesheet" type="text/css" />
        <link href="../assets/css/metismenu.min.css" rel="stylesheet" type="text/css" />
        <link href="../assets/css/style.css" rel="stylesheet" type="text/css" />

        <script src="../assets/js/modernizr.min.js"></script>

    </head>


    <body>

        <!-- Begin page -->
        <div id="wrapper">

          <?php include_once('includes/sidebar.php');?>
            <div class="content-page">
                 <?php include_once('includes/header.php');?>
                <!-- Start Page content -->
                <div class="content">
                    <div class="container-fluid">

                        <div class="row">
                            <div class="col-12">
                                <div class="card-box">
                                    <h4 class="m-t-0 header-title">ALL-IN GARAGE | aggiungere un cliente</h4>
                                    <p class="text-muted m-b-30 font-14">
                                       
                                    </p>

                                </a>
                            </h3>
                              <hr color="#000" />
                                                <p style="font-size:16px; color:red" align="center"> <?php if($msg){
    echo $msg;
  }  ?> </p>

                            <form class="form-horizontal" action="" name="signup" method="post" onsubmit="return checkpass();">

                                <div class="form-group row m-b-20">
                                    <div class="col-12">
                                        <label for="username">Nome</label>
                                        <input class="form-control" type="text" id="fullname"name="fullname" required="" placeholder="Inserisci il tuo nome completo">
                                    </div>
                                </div>

                                 <div class="form-group row m-b-20">
                                    <div class="col-12">
                                        <label for="username">Telefono</label>
                                        <input class="form-control" type="text" id="mobilenumber" name="mobilenumber" required="" placeholder="Inserisci il tuo numero di cellulare" maxlength="15" pattern="[0-9]+">
                                    </div>
                                </div>
                                

                                <div class="form-group row m-b-20">
                                    <div class="col-12">
                                        <label for="emailaddress">Auto Targa</label>
                                        <input class="form-control" type="text" id="email" name="email" required="" placeholder="Targa">
                                    </div>
                                </div>
                                
                                                                                                <div class="form-group row m-b-20">
                                    <div class="col-12">
                                        <label for="password">Marca dell'auto </label>
                                        <input class="form-control" type="text required="" id="marca" name="marca" placeholder="Modello di auto">
                                    </div>
                                </div>


                                <div class="form-group row m-b-20">
                                    <div class="col-12">
                                        <label for="password">Modello di auto</label>
                                        <input class="form-control" type="text" required="" id="model" name="model" placeholder="Marca dell'auto">
                                    </div>
                                </div>
                                
                                <div class="form-group row m-b-20">
                                    <div class="col-12">
                                        <label for="password">Scadenza revisione </label>
                                        <input class="form-control" type="date" required="" id="servicedate" name="servicedate" required="true" placeholder="Marca dell'auto">
                                    </div>
                                </div>
                                
                                <div class="form-group row m-b-20">
                                    <div class="col-12">
                                        <form enctype="multipart/form-data" method="POST" action="test2.php">
                                        <label for="password">Carte Auto</label>
                                        <input type="file" id="file" name="file" required="true" placeholder="Carte Auto">
                                    </div>
                                </div>
                                


                                <div class="form-group row text-center m-t-10">
                                    <div class="col-12">
                                        <button class="btn btn-block btn-custom waves-effect waves-light" type="submit" name="submit" >Aggiungi</button>
                                    </div>
                                </div>

                            </form>

                            <div class="row m-t-50">
                                <div class="col-sm-12 text-center">
                                </div>
                            </div>
   


</table>

                                                
                                            </div>
                                        </div>

                                    </div>
                                    <!-- end row -->

                                </div> <!-- end card-box -->
                            </div><!-- end col -->
                        </div>
                        <!-- end row -->
                    </div> <!-- container -->

                </div> <!-- content -->

             <?php include_once('includes/footer.php');?>
            </div>
        </div>
        <!-- jQuery  -->
        <script src="../assets/js/jquery.min.js"></script>
        <script src="../assets/js/bootstrap.bundle.min.js"></script>
        <script src="../assets/js/metisMenu.min.js"></script>
        <script src="../assets/js/waves.js"></script>
        <script src="../assets/js/jquery.slimscroll.js"></script>

        <!-- App js -->
        <script src="../assets/js/jquery.core.js"></script>
        <script src="../assets/js/jquery.app.js"></script>

    </body>
</html>
<?php }  ?>

test2.php ( upload php )

<?php
$allowedExts = array("gif", "jpeg", "jpg", "png");
$extension = end(explode(".", $_FILES["file"]["name"]));
if ((($_FILES["file"]["type"] == "image/gif")
|| ($_FILES["file"]["type"] == "image/jpeg")
|| ($_FILES["file"]["type"] == "image/jpg")
|| ($_FILES["file"]["type"] == "image/png"))
&& ($_FILES["file"]["size"] < 350000)
&& in_array($extension, $allowedExts))
  {
  if ($_FILES["file"]["error"] > 0)
    {
    echo "Return Code: " . $_FILES["file"]["error"] . "<br>";
    }
  else
    {
    echo "Upload: " . $_FILES["file"]["name"] . "<br>";
    echo "Type: " . $_FILES["file"]["type"] . "<br>";
    echo "Size: " . ($_FILES["file"]["size"] / 1024) . " kB<br>";
    echo "Temp file: " . $_FILES["file"]["tmp_name"] . "<br>";

    if (file_exists("uploads/" . $_FILES["file"]["name"]))
      {
      echo $_FILES["file"]["name"] . " already exists. ";
      }
    else
      {
      move_uploaded_file($_FILES["file"]["tmp_name"],
      "uploads/" . $_FILES["file"]["name"]);
      echo "Stored in: " . "uploads/" . $_FILES["file"]["name"];
      }
    }
  }
else
  {
  echo "Invalid file";
  }
?>

what is wrong there ? thanks

Symfony twig component

I use symfony multi app directory structure by this manual – https://symfony.com/doc/current/configuration/multiple_kernels.html
I want to use Twig component for each app, but i can’t rewrite component path to component template directory (anonymous_template_directory).
Whatever I do, my new path just added to base path.

base path (in twig_component.yaml) – anonymous_template_directory: ‘components/’
i try to set anonymous_template_directory:’kernel.project_dir%/website/templates/components/’

result: The “/var/www/html/templates//var/www/html/website/templates/components/” directory does not exist.

I would be grateful for help

Debugging ‘Max File Size Limit’ in Dockerized Dolibarr [closed]

I have a Dolibarr instance running inside Docker, with Nginx as a reverse proxy on the host. Here’s my setup:

docker-compose.yml

services:
    mariadb:
        image: mariadb:latest
        environment:
            MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD:-root}
            MYSQL_DATABASE: ${MYSQL_DATABASE:-dolidb}
            MYSQL_USER: ${MYSQL_USER:-dolidbuser}
            MYSQL_PASSWORD: ${MYSQL_PASSWORD:-dolidbpass}

        restart: always
        volumes:
            - ./dolibarr_mariadb:/var/lib/mysql

    web:
        # Choose the version of image to install
        # dolibarr/dolibarr:latest (the latest stable version)
        # dolibarr/dolibarr:develop
        # dolibarr/dolibarr:x.y.z
        image: dolibarr/dolibarr:latest
        environment:
            DOLI_INIT_DEMO: ${DOLI_INIT_DEMO:-0}
            DOLI_DB_HOST: ${DOLI_DB_HOST:-mariadb}
            DOLI_DB_NAME: ${DOLI_DB_NAME:-dolidb}
            DOLI_DB_USER: ${DOLI_DB_USER:-dolidbuser}
            DOLI_DB_PASSWORD: ${DOLI_DB_PASSWORD:-dolidbpass}
            DOLI_URL_ROOT: "${DOLI_URL_ROOT:-http://0.0.0.0}"
            DOLI_ADMIN_LOGIN: "${DOLI_ADMIN_LOGIN:-admin}"
            DOLI_ADMIN_PASSWORD: "${DOLI_ADMIN_PASSWORD:-admin}"
            DOLI_CRON: ${DOLI_CRON:-0}
            DOLI_CRON_KEY: ${DOLI_CRON_KEY:-mycronsecurekey}
            DOLI_COMPANY_NAME: ${DOLI_COMPANY_NAME:-MyBigCompany}
            WWW_USER_ID: ${WWW_USER_ID:-1000}
            WWW_GROUP_ID: ${WWW_GROUP_ID:-1000}

        ports:
          - "127.0.0.1:8000:80"
        links:
            - mariadb
        volumes:
            - ./dolibarr_documents:/var/www/documents
            - ./dolibarr_custom:/var/www/html/custom
            - ./dolibarr_php:/usr/local/etc/php

        restart: always

php.ini inside Dolibarr container:

; https://php.net/upload-max-filesize
upload_max_filesize = 20M
; Maximum number of files that can be uploaded via a single request
max_file_uploads = 20

Nginx config on the host:

server {
    listen 80;
    server_name dolibarr.local;

    location / {
            return 301 https://$host$request_uri;
    }
}

server {
    listen 443 ssl;
    server_name dolibarr.local;

    ssl_certificate /etc/nginx/certs/dolibarr.local.crt;
    ssl_certificate_key /etc/nginx/certs/dolibarr.local.key;

    client_max_body_size 20M;

    location / {
        proxy_pass http://127.0.0.1:8000;  
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
    }
}

I am trying to upload files larger than the default limit, but it doesn’t work. I checked Nginx logs and the Dolibarr Docker logs, but nothing appears related to the issue.

how to create simple login system (admin & user) in Laravel 12 livewire starter kit? [closed]

i am learning laravel. as a beginner i am trying to create a simple login system in laravel 12 with livewire. system should redirect to the admin dashboard and user dashboard base on role. i have created AdminMiddleware and UserMiddleware.

AdminMiddleware

<?php

namespace AppHttpMiddleware;

use Closure; use IlluminateHttpRequest; use IlluminateSupportFacadesAuth; use SymfonyComponentHttpFoundationResponse;

class AdminMiddleware {
    /**
     * Handle an incoming request.
     *
     * @param  Closure(IlluminateHttpRequest):   (SymfonyComponentHttpFoundationResponse)  $next
     */
    public function handle(Request $request, Closure $next): Response
    {
        if (Auth::user() && Auth::user()->role != 'admin') {
            return redirect()->route('user.dashboard);
        }
        return $next($request);
    } }

UserMiddleware

<?php
    
    namespace AppHttpMiddleware;
    
    use Closure;
    use IlluminateHttpRequest;
    use IlluminateSupportFacadesAuth;
    use SymfonyComponentHttpFoundationResponse;
    
    class UserMiddleware
    {
        /**
         * Handle an incoming request.
         *
         * @param  Closure(IlluminateHttpRequest): (SymfonyComponentHttpFoundationResponse)  $next
         */
        public function handle(Request $request, Closure $next): Response
        {
            if (Auth::user() && Auth::user()->role != 'user') {
                return redirect()->route('admin.dashboard);
            }
            return $next($request);
        }
    }

web.php

<?php

use AppLivewireAdminAdminDashboard;
use AppLivewireEmployeeUserDashboard;
use AppLivewireSettingsAppearance;
use AppLivewireSettingsPassword;
use AppLivewireSettingsProfile;
use IlluminateSupportFacadesRoute;

Route::get('/', function () {
    return view('welcome');
})->name('home');

Route::view('dashboard', Dashboard::class)
    ->middleware(['auth', 'employee'])
    ->name('user.dashboard');

Route::middleware(['auth'])->group(function () {
    Route::redirect('settings', 'settings/profile');

    Route::get('settings/profile', Profile::class)->name('settings.profile');
    Route::get('settings/password', Password::class)->name('settings.password');
    Route::get('settings/appearance', Appearance::class)->name('settings.appearance');
});

Route::middleware(['auth', 'admin'])->group(function () {
    Route::view('admin/dashboard', AdminDashboard::class)->name('admin.dashboard');
    // Additional admin routes can be added here
});

require __DIR__ . '/auth.php';

i am getting error Route [dashboard] not defined.
because i have created AdminMiddleware and UserMiddleware to redirect the admin.dashboard and user.dashboard while default dashboard is there.

my question is

Should we create two separate middleware for admin and user, or is it
enough to have only one middleware for admin that redirects to
admin.dashboard, while regular users don’t need their own middleware
and instead use the default dashboard without requiring a separate
user middleware to redirect the route to user.dashboard?

Return 200 status code with Location header

PHP documentation for the header() function tells us:

There are two special-case header calls… The second special case is the “Location:” header. Not only does it send this header back to the browser, but it also returns a REDIRECT (302) status code to the browser unless the 201 or a 3xx status code has already been set.

However, I want to return a 200 status code with a Location header. How can I do this, if at all? I have tried a few variations on the following with no luck:

header('Location: https://example.com/foo', true, 200);
http_response_code(200);
header('HTTP/1.1 200 OK', true, 200);
header('Content-Type: application/json');
echo '{"test":"testing"}';

According to my understanding of the PHP source, the first line should do it because of the explicitly specified status code:

if ((SG(sapi_headers).http_response_code < 300 ||
    SG(sapi_headers).http_response_code > 399) &&
    SG(sapi_headers).http_response_code != 201) {
    /* Return a Found Redirect if one is not already specified */
    if (http_response_code) { /* user specified redirect code */
        sapi_update_response_code(http_response_code);
    } else if (SG(request_info).proto_num > 1000 &&
       SG(request_info).request_method &&
       strcmp(SG(request_info).request_method, "HEAD") &&
       strcmp(SG(request_info).request_method, "GET")) {
        sapi_update_response_code(303);
    } else {
        sapi_update_response_code(302);
    }
}

How to enable CSRF protection in Laravel 12 API

I’m developing a Laravel (v12) API-based backend. I want to implemented CSRF protection but I can’t figure out how It’s gonna be doing in Laravel version 12.x.

I read Laravel 12 CSRF protection document but it couldn’t help me.

So how can I use CSRF protection on Laravel 12 APIs?

I tried following way and it I got nothing (CSRF token is not required from server):

<?php

use IlluminateFoundationApplication;
use IlluminateFoundationConfigurationExceptions;
use IlluminateFoundationConfigurationMiddleware;
use IlluminateFoundationHttpMiddlewareVerifyCsrfToken;

return Application::configure(basePath: dirname(__DIR__))
    ->withRouting(
        web: __DIR__.'/../routes/web.php',
        api: __DIR__.'/../routes/api.php',
        commands: __DIR__.'/../routes/console.php',
        health: '/up',
    )
    ->withMiddleware(function (Middleware $middleware): void {
        $middleware->validateCsrfTokens();
    })
    ->withExceptions(function (Exceptions $exceptions): void {
        //
    })->create();

enter image description here

Composer: how to use local symlinks for packages in development but Git versions in production

I have a project with a composer.json where some libraries are pulled from our GitLab:

"require": {
    "my/library": "1.0.0",
    "my/library-second": "1.2.1"
}

On production, this works fine — Composer fetches the packages from Git.

However, during development, I need to make changes to these libraries locally without creating a release. I want to use path repositories with symlink to my local folder.

The problems I face:

  • If I add local path repositories directly to the main composer.json, it breaks the production build.

  • Using replace or dev-master leads to conflicts with the fixed versions (1.0.0 / 1.2.1).

  • Ideally, I want a way to have a separate local composer.json or override only on the dev machine, so that:

  1. locally the packages are installed as symlinks,

  2. on production the stable Git versions are used,

  3. the main composer.json remains unchanged.

Question:

What is the proper way to structure Composer for this use case?

  • Is there a standard practice or common pattern to separate local and production Composer configuration, while keeping symlinks for local packages during development?

  • How do PHP projects usually handle local development with symlinks on packages without touching production composer.json?

Use a reference to $a to make $a a reference to $b

I have an array $arr = ['a', ['b',['c','d','e']]];.
So $arr[1][1][0] is 'c'.

I have these indexes listed in n array: $idx = [1,1,0];
(this may sound tricky, but comes from the fact that I got them from parsing a kind of scripting pseudo-language).

I have a recursive function which returns a reference to the expected element:
function &getDeepRef(&$array, $indexes){...}

Usage:
$ref = & getDeepRef($arr, $idx);

At that point, everything works as expected:
echo $ref;===> outputs 'c'
$ref = 12;
print_r($arr); ==> $arr is now ['a', ['b',[12,'d','e']]]

Here comes my question:
I need $arr[1][1][0] to become a reference to another variable $otherVar.
Can I do this using the $ref reference?

If yes, I couldn’t find the right syntax for this
($ref = &$OtherVar; unsets $ref as a reference to $arr[1][1][0], and makes it a reference to $otherVar, but in no way helps make $arr[1][1][0] a reference to $otherVar).

If no, how would you make the array element which indexes are listed in an array, become a reference to a given variable?

[Edit]
I found a solution based on eval();, but I’d rather use another way for security reasons:

    $arr = ['a', ['b', 'ii'=> ['c','d','e']],'f'];
    out($arr);
    
    $idxLeft  = [2];
    $idxRight = [1,'ii',0];
    
    $ref = &getDeepRef($arr,$idxRight);//$ref now is a reference to $arr[1]['ii'][0]
    $ref = 'ccc';//demo: $arr[1]['ii'][0] is now 'ccc'
    out($arr);
    
    //Now the target: $arr[2] = &$arr[1]['ii'][0];
    //Following does NOT work:
    $leftRef  = &getDeepRef($arr,$idxLeft);
    $rightRef = &getDeepRef($arr,$idxRight);
    $leftRef = &$rightRef; //this did NOT make $arr[2] a reference to $arr[1]['ii'][0]
        //instead it broke the reference from $leftRef on $arr[2] and made a new reference from $leftRef onto $arr[1]['ii'][0].
    
    //Following DOES work, but I'd prefer avoiding eval();  [notice: the mapping with json_encode is just here for string indexes compatibility, like 'ii']
    $eval = '$arr['. implode('][',array_map('json_encode',$idxLeft)) . '] = &$arr['. implode('][',array_map('json_encode',$idxRight)) . '];';
    out($eval);
    eval($eval);
    out($arr);
    
    $a = &getDeepRef($arr,$idxLeft);
    $a=45;
    out($arr);


    function &getDeepRef(&$var,$indexes){//third param just for exception message
        if(null===($id=array_shift($indexes))){ return $var; }
        if(!is_array($var) || !array_key_exists($id, $var)){ throw new Exception("Bad key: [$id]"); }
        return getDeepRef($var[$id],$indexes);
    }
    
    function out($v){
        static $i=0;
        echo '<br>'.++$i.' - '; print_r($v);
    }

How to run tests of the same phpunit testcase class in parallel with ParaTest?

I have a contrived test case showcasing how multiple test cases can slow the entire execution time down, as even though each is quick on its own, they add up if waited for before executing the next.

use PHPUnitFrameworkTestCase;

class ShouldTestInParallel extends TestCase
{
    /**
     * @dataProvider delayProvider
     */
    public function testItRunsTestsInParallel(int $delay)
    {
        sleep($delay);
        $this->assertTrue(true);
    }

    public function delayProvider()
    {
        return array_map(function ($value) {
            return [$value];
        }, array_fill(0, 10, 1));
    }

}

In order speed up test execution time, I installed paratest:

composer require brianium/paratest --dev

Now I expected the test to finish after 1 seconds.

I execute the test via phpstorm (and have enabled the paratest config), yet the entire test run still takes ~10s as each test is executed one after the other.

/bin/php -d memory_limit=5G /myproject/vendor/bin/paratest_for_phpstorm /myproject/library/vendor/phpunit/phpunit/phpunit --bootstrap /myproject/tests/bootstrap.php --debug --verbose --configuration /myproject/tests/phpunit.xml --filter Test\Vm\ShouldTestInParallel --test-suffix ShouldTestInParallel.php /myproject/tests/Vm --teamcity
Testing started at 1:57 PM ...
PHPUnit 9.6.25 by Sebastian Bergmann and contributors.

Runtime:       PHP 8.0.30
Configuration: /myproject/tests/phpunit.xml

Test 'TestVmShouldTestInParallel::testItRunsTestsInParallel with data set #0 (1)' ended
Test 'TestVmShouldTestInParallel::testItRunsTestsInParallel with data set #1 (1)' ended
Test 'TestVmShouldTestInParallel::testItRunsTestsInParallel with data set #2 (1)' ended
Test 'TestVmShouldTestInParallel::testItRunsTestsInParallel with data set #3 (1)' ended
Test 'TestVmShouldTestInParallel::testItRunsTestsInParallel with data set #4 (1)' ended
Test 'TestVmShouldTestInParallel::testItRunsTestsInParallel with data set #5 (1)' ended
Test 'TestVmShouldTestInParallel::testItRunsTestsInParallel with data set #6 (1)' ended
Test 'TestVmShouldTestInParallel::testItRunsTestsInParallel with data set #7 (1)' ended
Test 'TestVmShouldTestInParallel::testItRunsTestsInParallel with data set #8 (1)' ended
Test 'TestVmShouldTestInParallel::testItRunsTestsInParallel with data set #9 (1)' ended


Time: 00:10.026, Memory: 28.00 MB

OK (10 tests, 10 assertions)
Process finished with exit code 129 (interrupted by signal 1:SIGHUP)

How to Make Elementor Loop Grid Taxonomy Filters Work Dynamically After Custom User Role Filtering?

I have a custom post type called files. This post type is connected to a field group that includes:

  • 3 taxonomies

  • 1 checkbox list containing the available user roles on my site

I’m displaying the posts using an Elementor Loop Grid.

What I want to achieve:

  • First, filter the posts based on a comparison between the allowed roles (from the checkbox list) and the current user’s roles.

  • Then, apply Elementor’s native taxonomy filters dynamically on top of that.

What I have so far:

I wrote a small custom script (see below).

  • The user role filtering part works correctly: when I load the page, the posts displayed are restricted according to the current user’s roles.

  • However, the taxonomy filters do not work dynamically: when I click on a taxonomy filter, no posts appear. If I refresh the page, the filter is applied correctly, but I want it to work without needing a page reload.

Here’s my code:

<?php add_action("elementor/query/fichiers_query", function ($query) {
  if (!is_user_logged_in()) {
    $query->set("post__in", [0]);

    return;
  }

  $user = wp_get_current_user();

  $roles = (array) $user->roles;

  if (empty($roles)) {
    $query->set("post__in", [0]);

    return;
  }

  $meta_queries = ["relation" => "OR"];

  foreach ($roles as $role) {
    $meta_queries[] = [
      "key" => "roles",

      "value" => '"' . $role . '"',

      "compare" => "LIKE",
    ];
  }

  $query->set("meta_query", $meta_queries);
});
?>

Question:

How can I make Elementor’s taxonomy filters work dynamically after applying the initial user role filtering logic?

I hope you can help me on this,
thank you in advance!

How to select custom theme in Magento integration tests?

I am writing an integration test for a Magento action. In the frontend I have selected a custom theme with custom layout files and I get the correct output.

But in the integration test the default theme Magento/luma is used, where the specific blocks, which should be shown in the frontend, are not available.

How can I select the correct theme in my integration tests? A solution that must not be repeated for each test is preferred.

PHP Mail Function Says it Sends … but it doesnt [duplicate]

New to PHP, so please bare with me.

I created a function to send an activation email. To test it, I setup a test page that would run the function. The page is telling me that the mail was sent (i.e. it prints “Mail Sent.”) … but I never receive any email.

I’ve tried several different “to emails” (just in case the mail server for one was being picky). I also checked my SPAM folders for each account, but the emails aren’t showing. Can anyone see any issue with the code below?

<?
include_once('configinfo.php');
?>
<html>
<head>
<meta charset="utf-8">
<title>Email Test</title>
</head>

<body>
<?php
// site_email  and  activation_link are defined in configinfo.php. 
// activation-email-template.html is a file in the same location as this test page

function send_activation_email($email, $code) {
    // Email Subject
    $subject = 'Account Activation Required Test';
    // Email Headers 
    $headers = 'From: ' . site_email . 'rn' . 'Reply-To: ' . site_email . 'rn' . 'Return-Path: ' . site_email . 'rn' . 'X-Mailer: PHP/' . phpversion() . 'rn' . 'MIME-Version: 1.0' . 'rn' . 'Content-Type: text/html; charset=UTF-8' . 'rn';
    // Activation link
    $activate_link = activation_link .'?email=' . $email . '&code=' . $code;
    // Read the template contents and replace the "%link" placeholder with the above variable
    $email_template = str_replace('%link%', $activate_link, file_get_contents('activation-email-template.html'));
    // Send email to user
    if(mail($email, $subject, $email_template, $headers)) {
        $mailed = 1;
    } else {
        $mailed = 0;
    }
    return $mailed;
}
$code = '123456789';
$email = '[email protected]'; // I replace with my email address

$mailed = send_activation_email($email, $code)
?>

<h1>TESTING EMAIL</h1>
<?php
if($mailed == 1) {
    echo "Mail Sent."; // Page tells me this...
} else {
    echo "Mail FAILED";
}
?>
    
</body>
</html>