ctx feed pro doesn’t update feeds according to assigned time interval

I assigned the feed to update every 5 minutes , yet it barely update once a day , and every feed update differently , some of them not updating at all

I kept looking in the plugin code , but i didn’t see anything strange
I installed crone manager and I found out that some feeds has cron tasks and other don’t , and they are scheduled to an hour at least , when I make the cron task execute now , the update doesn’t show in last update in the feed manager

How to set different minimum order amounts based on delivery date (weekday vs weekend) in WooCommerce?

I’m using WooCommerce for a restaurant website and PiWebsolution to select the delivery day. I’m having trouble setting up different minimum order prices based on whether the delivery date is on a weekday or weekend.

Here’s what I need:

  • If the customer selects a delivery date on a weekday, the order must be over $130. If the order is less than $130, the checkout form should show an error, and the submit button will be disabled.

  • If the customer selects a delivery date on the weekend, the order must be over $200. If the order is less than $200, the checkout form should show an error, and the submit button will be disabled.

Can anyone help me achieve this?

Code I’m currently using:

add_action( 'woocommerce_check_cart_items', 'required_min_cart_subtotal_amount_based_on_delivery_day' );
function required_min_cart_subtotal_amount_based_on_delivery_day() {
    // Set different minimum amounts for weekdays and weekends
    $weekday_minimum = 130; // Minimum amount for weekdays
    $weekend_minimum = 200; // Minimum amount for weekends

    // Get the delivery date from the 'pi_delivery_date' field
    if ( isset( $_POST['pi_delivery_date'] ) ) {
        $delivery_date = sanitize_text_field( $_POST['pi_delivery_date'] ); // Get the delivery date from POST

        // Check if the delivery date exists
        if ( $delivery_date ) {
            // Convert the delivery date to day of the week
            $delivery_day = date( 'w', strtotime( $delivery_date ) );

            // Check the delivery day and assign the corresponding minimum amount
            $minimum_amount = ( $delivery_day == 0 || $delivery_day == 6 ) ? $weekend_minimum : $weekday_minimum;

            // Get the cart subtotal (before tax and shipping)
            $cart_subtotal = WC()->cart->subtotal;

            // Add error notice if the total is less than the minimum amount
            if ( $cart_subtotal < $minimum_amount ) {
                // Display error notice
                wc_add_notice(
                    sprintf(
                        __(
                            '<strong>A minimum total purchase amount of %s is required for the selected delivery day.</strong>',
                            'woocommerce'
                        ),
                        wc_price( $minimum_amount )
                    ),
                    'error'
                );
            }
        } else {
            // If there is no delivery date, display an error message asking the user to select one
            wc_add_notice( __( 'Please select a delivery date.', 'woocommerce' ), 'error' );
        }
    }
}

Issue:
The code works fine for weekdays.
When I select weekends and try to order below $200 (specifically under $150), I get the error message: “A minimum total purchase amount of $150.00 is required for the selected delivery day.”
However, when I order between $150 and $200 (for example, $170), no error is shown, and I’m able to proceed with the order.
Can anyone explain why this happens and how to fix it please?

Laravel Gmail SMTP Issues on cPanel: Timeout & SSL Errors (Works Locally)

I’m trying to send emails using Laravel’s Mail facade with Gmail SMTP on a cPanel server. While the configuration works perfectly on my local environment, on the server I’m encountering two different issues:

  1. Timeout errors when trying to connect to Gmail’s SMTP server
  2. SSL certificate verification failures

These issues persist despite successful SSL and port tests. I’ve confirmed that basic connectivity works:

  • Port tests succeed (connection establishes in 71ms)
  • OpenSSL tests show successful TLS negotiation
  • Server can reach Gmail SMTP servers

I’ve tried multiple configuration approaches including:

  • Using both SSL (465) and TLS (587) ports
  • Different encryption methods (SSL/TLS)
  • Various SSL verification settings
  • Different SMTP hosts (smtp.gmail.com and smtp-relay.gmail.com)
  • Adjusting timeout values
  • Different authentication modes

Each attempt results in either a timeout or an SSL certificate verification error, even though the same configuration works flawlessly in the local environment.

Environment:

  • Laravel version 11.34.2
  • PHP 8.2.25
  • cPanel server
  • Gmail SMTP

Configuration Working on Local:

'smtp' => [
            'transport' => 'smtp',
            'url' => null,
            'host' => 'smtp.gmail.com',
            'port' => 587,
            'encryption' => 'tsl',
            'username' => '[email protected]',
            'password' => "app-password",
            'timeout' => null,
        ],

Error #1 – Timeout:

Error sending: SMTP Error: Could not connect to SMTP host.

Configuration USED:

'smtp' => [
    'transport' => 'smtp',
    'host' => 'smtp.gmail.com',
    'port' => 465,
    'encryption' => 'ssl',
    'username' => '[email protected]',
    'password' => 'app-password',
    'timeout' => 5,
    'stream_options' => [
        'ssl' => [
            'verify_peer' => false,
            'verify_peer_name' => false,
            'allow_self_signed' => true,
        ]
    ]
],

Error #2 – SSL Certificate:

Error sending: SMTP Error: Could not connect to SMTP host. 
Connection failed. stream_socket_enable_crypto(): SSL operation failed with code 1. 
OpenSSL Error messages: error:1416F086:SSL routines:tls_process_server_certificate:certificate verify failed

Configuration USED:

'smtp' => [
    'transport' => 'smtp',
    'host' => 'smtp-relay.gmail.com',
    'port' => 587,              
    'encryption' => 'tls',          
    'username' => env('MAIL_USERNAME'),
    'password' => env('MAIL_PASSWORD'),
    'timeout' => 5,
    'auth_mode' => 'PLAIN',
    'stream_options' => [
        'tcp' => [
            'tcp_nodelay' => true,
        ],
        'ssl' => [
            'verify_peer' => false,
            'verify_peer_name' => false,
            'allow_self_signed' => true,
            'SNI_enabled' => true,
        ]
    ]
],

  1. Port tests show successful connections:
$ time nc -zv -w 5 smtp.gmail.com 465
Connection to smtp.gmail.com 465 port [tcp/submissions] succeeded!
real    0m0.071s
  1. OpenSSL test shows successful TLS negotiation:
$ openssl s_client -connect smtp.gmail.com:465
...
New, TLSv1.3, Cipher is TLS_AES_256_GCM_SHA384
...
220-smtp.gmail.com ESMTP ready

  1. Verified Exim settings:
$ sudo exim -bP accept_8bitmime
accept_8bitmime
$ sudo exim -bP smtp_accept_max_nonmail
smtp_accept_max_nonmail = 10
  1. Tried both SSL (465) and TLS (587) ports
  2. Tried different timeout values
  3. Verified Gmail app password and 2FA settings
  4. Added various SSL/TLS configurations and certificate verifications
  5. Tried using smtp-relay.gmail.com

The connection tests succeed but Laravel’s mailer consistently times out. The quick netcat connection (71ms) suggests the issue might be during SSL handshake or SMTP authentication, but I haven’t been able to resolve it.

Any help would be appreciated.

Symfony tests data provider with fixtures information

PHPUnit: 11.4
Symfony: 7.2

We have simple test with external data provider:

class AppTest {
    #[DataProviderExternal(AppDataProvider::class, 'getData')]
    public function testData(array $data): void {
        static::assertSame($data['type'], '123');
    }
}

class AppDataProvider {
    public static function getData(): array {
        return [
            [
                'data' => [
                    'type' => /* What code should be here?
                               * Something like static::fixtureManager()->getReference(AppTypeEnum::MAIN_TYPE->value)
                               */
                ],
            ]
        ];
    }
}

From source code I see that data provider set data for test via setData, but in this place test class is just created and no “setUp” was called or anything.

How can I get type to be taken from database fixtures in external data provider?

Trying to Cloak my domain only to specific country

im trying to display my domain to specific country with IP checking which if open by TH(Thai) it will show my domain example.com but if not, it will show another page, im currently on Thai, which to check if it works, i use SG(Singapore) VPN to see if it works or not,

$ip = $_SERVER['REMOTE_ADDR'];
$user_agent = $_SERVER['HTTP_USER_AGENT'];

if (!is_bot($user_agent, $bots)) {
    $access_key = '6adf16bff8db66'; // Replace with your ipinfo.io access key
    $ch = curl_init('http://ipinfo.io/' . $ip . '?token=' . $access_key);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    $json = curl_exec($ch);
    curl_close($ch);

    $ip_details = json_decode($json, true);

    if ($ip_details['country'] == 'TH') {
        header('Location: https://example.com/');
        exit;
    }
}

with the codes above it keeps showing the other domain if TH is set as the designated country, but if i swap it to SG, it shows the example.com to all even if i use my TH IP, im confused

please help

throttle error when migration laravel 8 to 11

I made a migration from laravel 8 to 11 following the guides proposed in the doc, I find myself with a throtter problem when I try to reach my api sanctum and fortify :
error is :

[2024-12-11 10:47:30] local.ERROR: Target class [throttle] does not exist. {"exception":"[object] (Illuminate\Contracts\Container\BindingResolutionException(code: 0): Target class [throttle] does not exist. at /home/yannick/dev/NetDesk/backend/vendor/laravel/framework/src/Illuminate/Container/Container.php:879)
[stacktrace]
#0 /home/yannick/dev/NetDesk/backend/vendor/laravel/framework/src/Illuminate/Container/Container.php(758): Illuminate\Container\Container->build()
#1 /home/yannick/dev/NetDesk/backend/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(851): Illuminate\Container\Container->resolve()
#2 /home/yannick/dev/NetDesk/backend/vendor/laravel/framework/src/Illuminate/Container/Container.php(694): Illuminate\Foundation\Application->resolve()
#3 /home/yannick/dev/NetDesk/backend/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(836): Illuminate\Container\Container->make()
#4 /home/yannick/dev/NetDesk/backend/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(206): Illuminate\Foundation\Application->make()
#5 /home/yannick/dev/NetDesk/backend/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(180): Illuminate\Foundation\Http\Kernel->terminateMiddleware()
#6 /home/yannick/dev/NetDesk/backend/public/index.php(55): Illuminate\Foundation\Http\Kernel->terminate()
#7 /home/yannick/dev/NetDesk/backend/server.php(21): require_once('...')
#8 {main}

[previous exception] [object] (ReflectionException(code: -1): Class "throttle" does not exist at /home/yannick/dev/NetDesk/backend/vendor/laravel/framework/src/Illuminate/Container/Container.php:877)
[stacktrace]
#0 /home/yannick/dev/NetDesk/backend/vendor/laravel/framework/src/Illuminate/Container/Container.php(877): ReflectionClass->__construct()
#1 /home/yannick/dev/NetDesk/backend/vendor/laravel/framework/src/Illuminate/Container/Container.php(758): Illuminate\Container\Container->build()
#2 /home/yannick/dev/NetDesk/backend/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(851): Illuminate\Container\Container->resolve()
#3 /home/yannick/dev/NetDesk/backend/vendor/laravel/framework/src/Illuminate/Container/Container.php(694): Illuminate\Foundation\Application->resolve()
#4 /home/yannick/dev/NetDesk/backend/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(836): Illuminate\Container\Container->make()
#5 /home/yannick/dev/NetDesk/backend/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(206): Illuminate\Foundation\Application->make()
#6 /home/yannick/dev/NetDesk/backend/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(180): Illuminate\Foundation\Http\Kernel->terminateMiddleware()
#7 /home/yannick/dev/NetDesk/backend/public/index.php(55): Illuminate\Foundation\Http\Kernel->terminate()
#8 /home/yannick/dev/NetDesk/backend/server.php(21): require_once('...')
#9 {main}
"} 
//backend/app/Http/Kernel.php
 protected $routeMiddlewareAliases = [
        'auth' => AppHttpMiddlewareAuthenticate::class,
        'auth.basic' => IlluminateAuthMiddlewareAuthenticateWithBasicAuth::class,
        'type.customer' => CustomerMiddleware::class,
        'type.tech' => TechnicianMiddleware::class,
        'cache.headers' => IlluminateHttpMiddlewareSetCacheHeaders::class,
        'can' => IlluminateAuthMiddlewareAuthorize::class,
        'guest' => AppHttpMiddlewareRedirectIfAuthenticated::class,
        'password.confirm' => IlluminateAuthMiddlewareRequirePassword::class,
        'signed' => IlluminateRoutingMiddlewareValidateSignature::class,
        'throttle' => IlluminateRoutingMiddlewareThrottleRequests::class,
        'verified' => IlluminateAuthMiddlewareEnsureEmailIsVerified::class,
        'role' => SpatiePermissionMiddlewaresRoleMiddleware::class,
        'permission' => SpatiePermissionMiddlewaresPermissionMiddleware::class,
        'role_or_permission' => SpatiePermissionMiddlewaresRoleOrPermissionMiddleware::class,
    ];

some api routes :

Route::get('getTicketCategories', [DataController::class, 'getTicketCategories']);
Route::get('getPlanificationTypes', [DataController::class, 'getPlanificationTypes']); 
Route::get('getDashboardPoints', [DataController::class, 'getDashboardPoints']);

When I did some research, it was about a defect in the kernel but I added the file and still the same error. Do you have any idea how to find the cause or solve it?

Twitter – X – Ads API – Unable to Fetch Ad and Ad Group Level Data Using Twitter Ads API

We are currently using the following endpoints to pull campaign data:

  1. Get All Campaign Data:
    /accounts/{{account_id}}/campaigns

  2. Get Specific Campaign Data:
    /accounts/{{account_id}}/campaigns/{{campaign_id}}

While we are successfully retrieving all campaign data and specific campaign data, we are facing an issue fetching ad and ad group level data on a daily basis.

Currently, we are using the free API access.

Could someone please guide us on how to retrieve ad and ad group level data using the Twitter Ads API?

Any help would be greatly appreciated!

API Link : https://developer.x.com/en/docs/x-ads-api

Can’t create an user in utenti using PHP registration form [duplicate]

I’ve got an HTTP ERROR 500 after the registration in index.php using PHP 8.3.12 and MySQL 9.0.1, i’ve made 1 file and folder with 2 files:

index.php

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title></title>
</head>

<body>
    <form action="./php/register.php" method="POST">
        <h2>Registrati</h2>

        <div>
            <label for="email">Email</label>
            <input type="email" name="email" id="email">
        </div>

        <div>
            <label for="username">Username</label>
            <input type="text" name="username" id="username">
        </div>

        <div>
            <label for="password">Password</label>
            <input type="password" name="password" id="password">
        </div>

        <input type="submit" value="invia">

    </form>
</body>

</html>

Folder php:

register.php

<?php

require_once('./config.php');

$email = $connessione->real_escape_string($_POST['email']);
$username = $connessione->real_escape_string($_POST['username']);
$password = $connessione->real_escape_string($_POST['password']);

$sql = "INSERT INTO utenti (email, username, password) VALUES ('$email', '$username', '$password')";
if ($connessione->query($sql) === true) {
    echo "registrazione avvenuta";
} else {
    echo "errore registrazione $sql" . $connessione->error;
}

?>

config.php

<?php
$host = "127.0.0.1";
$user = "root";
$password = "rootroot";
$db = "testMySQL";

$connessione = new mysqli($host, $user, $password, $db);

if ($connessione === false) {
    die("errore" . $connessione->connect_error);
}

?>

the connection in config.php with the database went smoothly

Ive tried to:

Change in register.php the

require_once('./config.php');

into

require_once('./php/config.php');

but still not working

Callable Arrays in PHP since 7.0

I noticed that since PHP 7.0, I can use syntax like this:

<?php

["a", "b"]();

When I run it, I encounter the following error:

Fatal error: Uncaught Error: Class 'a' not found in ...

It seems that the PHP interpreter tries to resolve [“a”, “b”] as a reference to a class a with a method b and attempts to invoke it.

  • Why does PHP interpret this array in this way?
  • What is the underlying mechanism behind this behavior?
  • Is there any official documentation or resources that explain this feature?

Laravel: Database password error with `php artisan cache:clear`

PHP 8.3, Laravel 11

php artisan cache:clear works on local dev machine, but on staging and production servers fails with:

In Connection.php line 825:
                                                                                           
  SQLSTATE[08006] [7] connection to server at "127.0.0.1", port 5432 failed: fe_sendauth:  
   no password supplied (Connection: pgsql, SQL: delete from "cache")                      

In Connector.php line 66:
                                                                                           
  SQLSTATE[08006] [7] connection to server at "127.0.0.1", port 5432 failed: fe_sendauth:  
   no password supplied

In the .env file, CACHE_STORE was originally database, but the same error occurs after setting CACHE_STORE=redis. The database and cache are both set up with passwords and working fine within the app. Config is not cached. No Docker involved. All other Artisan cache/clear commands work fine.

Why is it not using DB_PASSWORD from the .env, and why is it accessing the database at all when CACHE_STORE=redis?

Tried:

  • sudo php artisan cache:clear

  • php artisan config:clear

  • service nginx restart

  • service php-fpm restart

  • reboot

./config/cache.php 'database' references DB_CACHE_CONNECTION etc. without default values, so I set the following in .env:

DB_CACHE_CONNECTION=pgsql
DB_CACHE_LOCK_CONNECTION=pgsql
DB_CACHE_LOCK_TABLE=cache_locks

Same error.

There must be a difference between production and local setups but I can’t think of it.

Where can I start debugging?

Docker (compose) httpd proxy request to php container “File not found.”

I’m trying to learn more and build a development docker stack separating the Apache server from the PHP using different containers.

Actually this is the test docker-compose.yml configuration:

services:
  webserver:
    image: httpd:latest
    ports:
      - "8002:80"
    volumes:
      - ./apache/conf:/usr/local/apache2/conf
      - ./src:/usr/local/apache2/htdocs
  php:
    image: php:fpm
    volumes:
      - ./src:/var/www/html

In ./src there are only 1 directory public within 2 files:

  • index.html (that works great)
  • index.php (that isn’t find by php container)

I previously download the “vanilla” httpd configuration and set it as volume for the webserver service.

I update the configuration to serve index.php before index.html:

<IfModule dir_module>
    DirectoryIndex index.php index.html
</IfModule>

And then add the proxy configuration to the php service:

# Proxy to PHP-FPM
<FilesMatch .*.php$>
    SetHandler "proxy:fcgi://php:9000"
</FilesMatch>

I’m sure that when i ask for localhost:8002/public/index.php the php service is call and works (files are visible in the php container).

If I test the same but using NXING it works without problem, but with apache I’m still stuck in it.

I don’t find any clear explain searching online; I’m miss configure what?

EDIT 1:

Before any ask, I have already enable:

  • LoadModule proxy_module modules/mod_proxy.so
  • LoadModule proxy_fcgi_module modules/mod_proxy_fcgi.so

Symfony testing repository custom method

I am trying to test a custom repository function but when my test call the function I have this error “BadMethodCallException: Undefined method “getByState”. I don’t understand why. The repository seems to be empty of my custom functions.
Maybe it’s because the Document entity is declared as an abstract class…
I also have tests on another repository which are perfectly running.

Entity/Document.php

#[Entity(repositoryClass: DocumentRepository::class)]
#[InheritanceType('JOINED')]
abstract class Document
{
...
}

tests/DocumentRepositoryTest.php

<?php

namespace AppTest;

use AppEntityDocument;
use AppRepositoryDocumentRepository;
use AppWorkflowStateDocumentWorkflowState;
use DoctrineORMEntityManager;
use SymfonyBundleFrameworkBundleTestKernelTestCase;

class DocumentRepositoryTest extends KernelTestCase
{

    private ?EntityManager $entityManager;

    protected function setUp(): void
    {
        $kernel = self::bootKernel();

        $this->entityManager = $kernel->getContainer()
            ->get('doctrine')
            ->getManager();
    }

    protected function tearDown(): void
    {
        parent::tearDown();

        $this->entityManager->close();
        $this->entityManager = null;
    }
    public function testGetByState(): void
    {
        /** @var DocumentRepository */
        $documentRepository = $this->entityManager
            ->getRepository(Document::class);

        assert($documentRepository instanceof DocumentRepository);

        $documents = $documentRepository->getByState(DocumentWorkflowState::BROUILLON);

        foreach ($documents as $document) {
            $this->assertEquals(DocumentWorkflowState::BROUILLON, $document->getState(), 'Erreur dans la fonction findByStatus');
        }
    }
}

Repository/DocumentRepository.php

<?php

namespace AppRepository;

use AppEntityDocument;
use DoctrineBundleDoctrineBundleRepositoryServiceEntityRepository;

/**
 * @extends ServiceEntityRepository<Document>
 *
 * @method Document|null find($id, $lockMode = null, $lockVersion = null)
 * @method Document|null findOneBy(array $criteria, array $orderBy = null)
 * @method Document[]    findAll()
 * @method Document[]    findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
 */
class DocumentRepository extends ServiceEntityRepository
{
/**
     * @return Document[] Returns an array of Jury objects
     */
    public function getByState(string $state): array
    {
        return $this->createQueryBuilder('d')
            ->leftJoin('d.statuses', 'statuses')
            ->where(
                ":val = (SELECT st.status FROM AppEntityStatus st
                                WHERE st.id = (SELECT MAX(s.id) FROM AppEntityStatus s
                                WHERE s.document = d
                                GROUP BY s.document)
                    )"
            )
            ->setParameter('val', $state)
            ->orderBy('d.libelle_etape', 'ASC')
            ->getQuery()
            ->getResult();
    }
}

Thanks for ideas !

Modifying the Laravel response HTML causes unit tests to fail

Running on Laravel 10, with PHPUnit 10.5.38, I have a middleware that adds the environment to the <title> tag so stakeholders are more aware of when they are on Dev or UAT environments.

<title>My Page</title> becomes <title>DEV - My Page</title>

public function handle(Request $request, Closure $next): Response
{
    $response = $next($request);

    $isHtmlResponse = $response->headers->get('Content-Type') === 'text/html; charset=UTF-8';

    if (!app()->isProduction() && $isHtmlResponse) {

        $content = $response->getContent();

        $content = preg_replace(
            '/<title>/i',
            '<title>' . strtoupper(config('app.env')) . ' - ',
            $content
        );

        $response->setContent($content);
    }

    return $response;
}

When I run unit tests with assertions against a view, the following error occurs:

The response is not a view.

Example test:

public function test_why_it_is_not_a_view(): void
{
    $this
        ->get(route('my.login'))
        ->assertViewHas('x', 'y')
        ->assertOk();
}

This test should fail. There’s no x property with value y. The same happens on what should be passing tests.

When I exclude the middleware completely, things work. When I add logic to exclude the regex with app()->runningUnitTests(), things work.

So, what is it about $response->setContent($content) that causes upset?

Where Apache configures the caching for php dynamic pages

I checked my LAMP webapp responses an I see that php pages responses are not cached by browser and images, css, js, and so on are cached.

I don’t explicitly add any header control entry, so I guess this behaviour is somehow handled by php or apache configuration.
Can you tell me how?

Problem with composer update (php 8.2 > 8.3) [duplicate]

I have a problem with coposer.
I use a php container php:8.3-fpm

stephane @ dagda => /www/projets/vc $ 
└─ $ ▶ docker exec -ti php_vc_www /bin/bash
root@75620432819b:/var/www/html# /usr/local/bin/php -v
PHP 8.3.3 (cli) (built: Feb 16 2024 21:02:14) (NTS)

Updated in composer.json
-> the version was wrong: 8.2
I have modified to be at 8.3

"php": "^8.3",

Update via composer:

stephane @ dagda => /www/projets/vc$ 
└─ $ ▶ docker-compose run --rm composer_vc_www update
Starting php_vc_www ... done
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Root composer.json requires php ^8.3 but your php version (8.2.2) does not satisfy that requirement.

In the container everything works very well.
A php page with phpinfo() show version 8.3.3