Property hook not found when serializing an object using __sleep

I noticed something strange when using the combination property hooks with the magic __sleep() method. I have no idea whether I incorrectly use hooks or that this is a bug in PHP.

See the following example:

class A {
    private array $foo = ['baz' => 10];

    public int $bar {
        get => $this->foo['baz'];
        set {
            $this->foo['baz'] = $value;
        }
    }
    
    public function __sleep()
    {
        // ...
        return array_keys(get_object_vars($this));
    }
}

$a = new A;
$a->bar = 20;

var_dump(unserialize(serialize($a)));

This causes the following warning:

serialize(): "bar" returned as member variable from __sleep() but does not exist

Which is strange, because it works as expected and the property does exist.
Reproducable example: https://3v4l.org/V1S5i#v8.4.3.

This is an issue because in the framework I use (Laravel), this warning is promoted to an exception and breaks my application.

Dynamic CollectionType in Symfony FormType

Scenario is I have one Parent and three child FormTypes

ParentFormType

ChildOneFormType
ChildTwoFormType
ChildThreeFormType

All thee child classes inherit parent, ofcourse.

So, here is my Form class

 {
     /**
      * @param FormBuilderInterface $builder
      * @param array $options
      */
     public function buildForm(FormBuilderInterface $builder, array $options)
     {
         $builder
             ->add('name', TextType::class, [
                 'constraints' => [new NotBlank()]
             ])
             ->add('description', TextType::class, [
                 'required' => false
             ])
             ->add('wallets', CollectionType::class, [
                 'entry_type' => ParentFormType::class, // Issue is here when wallet is one of the child class
                 'allow_add' => true,
               
             ]);
 
             
             
     
     }
 
     /**
      * @param OptionsResolver $resolver
      */
     public function configureOptions(OptionsResolver $resolver): void
     {
         $resolver->setDefaults([
             'data_class' => MyFormClass::class,
             'allow_extra_fields' => true,
             'csrf_protection' => false
         ]);
     }
 
     /**
      * @return string
      */
     public function getName(): string
     {
         return 'MyForm';
     }
 }
 

Wallets can contain data related to any child class, but Form is not validated it because validation is being done only on fields added on ParentFormType.

So,how I can pass and validate this type of dynamic CollectionType?

Thanks In Advance

PHP Server Sent Event overload on While loop

I’m creating an infopage for work that updates “live”.

Now i came across Server Sent Events.

I managed to put data on the screen but the update was every 3 seconds.
(After looking online it appears i created a disconnect and the default retry time was 3 seconds)

So i found a sollution that in theory should work but when putting it live, it creates an overload on the server side.

<?php

        // make session read-only
        session_start();
        session_write_close();

        // disable default disconnect checks
        ignore_user_abort(true);

        // set headers for stream
        header("Content-Type: text/event-stream");
        header("Cache-Control: no-cache");
        header("Access-Control-Allow-Origin: *");

        // Is this a new stream or an existing one?
        $lastEventId = floatval(isset($_SERVER["HTTP_LAST_EVENT_ID"]) ? $_SERVER["HTTP_LAST_EVENT_ID"] : 0);
        if ($lastEventId == 0) {
            $lastEventId = floatval(isset($_GET["lastEventId"]) ? $_GET["lastEventId"] : 0);
        }

        echo ":" . str_repeat(" ", 2048) . "n"; // 2 kB padding for IE
        echo "retry: 1000n";

        // start stream
        while(true){
            if(connection_aborted()){
                exit();
            } else{

                // here you will want to get the latest event id you have created on the server, but for now we will increment and force an update
                $latestEventId = $lastEventId+1;

                if($lastEventId < $latestEventId){
                    echo "id: " . $latestEventId . "n";
                    echo "data: Howdy (".$latestEventId.") nn";
                    $lastEventId = $latestEventId;
                    ob_flush();
                    flush();
                } else{
                    // no new data to send
                    echo ": heartbeatnn";
                    ob_flush();
                    flush();
                }
            }
    
            // 2 second sleep then carry on
            sleep(1);
        }
        
?>

It appears that the while(true) loop is the problem …

Unfortunatly i couldn’t find the correct way to use Server Side events with a connection that stays open.

Is there someone that knows a sollution for this?

i tried using this script without while loop (which works) BUT thats because the client side keeps reconnecting after every 3 seconds, so basically the connection opens, closes, opens, closes

Edit Link Still Appears for Hidden Pages on Frontend for Non-Super Admins

I’m having trouble preventing the edit page link from appearing in the admin bar on the frontend when non-super admin users view hidden pages. I have several functions that are supposed to remove the edit link and adjust the user’s capabilities for these pages, but the link still shows up.

Below are the relevant parts of my code that handle removing the edit link and related functionality:

// Remove edit-related nodes from the admin bar on hidden pages.
public function remove_edit_button_for_hidden_pages($wp_admin_bar) {
    // Bail early if user is super admin or feature is disabled.
    if ($this->is_super_admin() || !$this->is_enabled()) {
        return;
    }
    // Get current post ID.
    $post_id = get_queried_object_id();
    if (!$post_id || get_post_type($post_id) !== 'page') {
        return;
    }
    // Check if the page is hidden.
    $hidden_pages = $this->get_hidden_pages();
    if (in_array($post_id, $hidden_pages)) {
        $wp_admin_bar->remove_node('edit');
        $wp_admin_bar->remove_node('customize');
        $wp_admin_bar->remove_node('edit-frontend');
        $wp_admin_bar->remove_node('site-editor');
        $wp_admin_bar->remove_node('edit-site');
        $wp_admin_bar->remove_node('edit-page');
        $wp_admin_bar->remove_node('edit-post');
    }
}

// Backup removal of edit nodes later in the process.
public function remove_edit_menu_late() {
    global $wp_admin_bar;
    if ($this->is_super_admin() || !$this->is_enabled()) {
        return;
    }
    $post_id = get_queried_object_id();
    if (!$post_id || get_post_type($post_id) !== 'page') {
        return;
    }
    $hidden_pages = $this->get_hidden_pages();
    if (in_array($post_id, $hidden_pages)) {
        $wp_admin_bar->remove_node('edit');
        $wp_admin_bar->remove_node('edit-frontend');
        $wp_admin_bar->remove_node('customize');
    }
}

// Filter to remove the edit link for hidden pages.
public function remove_hidden_page_edit_link($link, $post_id, $context) {
    if (!$this->is_enabled() || $this->is_super_admin()) {
        return $link;
    }
    if (get_post_type($post_id) !== 'page') {
        return $link;
    }
    $hidden_pages = $this->get_hidden_pages();
    if (in_array($post_id, $hidden_pages)) {
        return ''; // Prevent the edit link from being generated.
    }
    return $link;
}

// Adjust user capabilities for hidden pages.
public function control_edit_page_cap($allcaps, $caps, $args, $user) {
    if (!$this->is_enabled() || $this->is_super_admin()) {
        return $allcaps;
    }
    // Check if we're handling edit capabilities.
    if (!isset($args[0]) || !in_array($args[0], array('edit_post', 'edit_page'))) {
        return $allcaps;
    }
    // Get the post ID.
    $post_id = isset($args[2]) ? $args[2] : 0;
    if (!$post_id) {
        return $allcaps;
    }
    // Check if this is a page.
    $post = get_post($post_id);
    if (!$post || $post->post_type !== 'page') {
        return $allcaps;
    }
    // If the page is hidden, remove editing capabilities.
    $hidden_pages = $this->get_hidden_pages();
    if (in_array($post_id, $hidden_pages)) {
        unset($allcaps['edit_post']);
        unset($allcaps['edit_pages']);
        unset($allcaps['edit_others_pages']);
        unset($allcaps['edit_published_pages']);
        unset($allcaps['edit_private_pages']);
    }
    return $allcaps;
}

I want to change the url in the base url but by removing the %20 character in the url

I want to change the URL from
http://localhost/webcodingmedia/service-view/detail/10/Jasa%20SEO
to
http://localhost/webcodingmedia/service-view/detail/10/Jasa-SEO

but I haven’t found a way. I tried using URL decoding but it doesn’t change. Can anyone help, thanks. can you give an example

View:

  <a href="<?= site_url('service-view/detail/' . $value->id_service . '/'. $value->layanan) ?>"
                                    class="read-more">
                                    Read More <i class="bi bi-arrow-right"></i>
                                </a>

Controller:

public function detail($id, $layanan) {

        // $formatted_layanan = format_service_url($layanan);

        // $layanan = str_replace('%20', '-', $layanan);
        // Get data from the model
        $data['title'] = 'Service Detail'; // Title for this page
        $data['row'] = $this->setting_m->get()->row(); // General settings
        $data['social'] = $this->social_media_m->get(); // Social media links
        $data['faq'] = $this->faq_m->get(); // FAQ data
        $data['service'] = $this->service_m->get(); // All services
    
        // Get service data based on ID and service name (layanan)
        $data['service2'] = $this->service_m->get_service($id, $layanan); // Get service detail
    
        // If no service data is found, redirect to the 404 page
        if (empty($data['service2'])) {
            redirect('eror_404');
            return; // Exit the function to stop further code execution
        }
    
        // Load the views to display the detail page
        $this->load->view('home/template/header', $data);
        $this->load->view('home/template/navbar');
        $this->load->view('home/pelayanan/detail-layanan', $data);
        $this->load->view('home/template/footer', $data);
        $this->load->view('home/template/library');
    }
    

Model:

public function get_service($id, $layanan) {
    $layanan = urldecode($layanan);  // Decode URL-encoded string

    // Replace spaces with hyphens
    // $layanan = str_replace(' ', '-', $layanan);  // Replace space with '-'
    // Menyaring data berdasarkan ID dan layanan
    $this->db->where('id_service', $id);
    $this->db->where('layanan', $layanan);  // Decoding nama layanan jika perlu
    $query = $this->db->get('tb_service');  // tb_service adalah nama tabel

    // Jika ada data yang ditemukan, kembalikan sebagai objek
    if ($query->num_rows() > 0) {
        return $query->row();  // Mengambil hanya satu baris hasil
    } else {
        return null;  // Jika tidak ditemukan, kembalikan null
    }
    }

FCM with Php and Admin-sdk. Shows firebase sdk class not found

I used composer to install firebase admin-sdk with command composer require kreait/firebase-php
The resulting downloaded folder structure had

vendor/kreait/firebase-php , vendor/kreait/clock,
vendor/kreait/firebase-tokens.

When I ran composer show kreait/firebase-php it did not list firebase-php under the require section. Instead kreait/firebase-tokens and kreait/clock was listed. the version for admin-sdk is 5.26.5. The vendor folder is in the root of my project folder. I added a test.php file with the following code.

require __DIR__ . '/vendor/autoload.php';

if (class_exists('KreaitFirebaseFirebase')) {
    echo "Firebase class found!";
    $firebase = new KreaitFirebaseFirebase(); // Or your Firebase initialization code
} else {
    echo "Firebase class NOT found!";
} 

It outputs class not found. Output for php -v is

PHP 8.3.14 (cli) (built: Nov 19 2024 15:53:36) (NTS Visual C++ 2019 x64)
Copyright (c) The PHP Group
Zend Engine v4.3.14, Copyright (c) Zend Technologies

I next tried composer clear-cache composer install. Still it cannot find the sdk location when i run the test.php. There is something wrong with whatever being downloaded by the composer. The folder structure is not the way it should be. Please advise.

Unable to decrypt data using PHP wich is encrypted with Java

We are using the following code to encrypt data in Java, and trying to convert the logic to PHP. The data encrypted with one language cannot be decrypted with the other language. Is there any difference?

My Java code

public class EncYes {
    
    private static final char[] hexDigits = new char[]{'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'};
        
    public static void main(String[] args) {
        try {
            String encString=null;
            
            EncYes enc = new EncYes();
            
            switch(args[0]){
               case "e":
                 System.out.println(enc.encrypt(args[1],args[2])); 
               break;  
               case "d":
                 System.out.println(enc.decrypt(args[1],args[2])); 
               break; 
             }
        }  catch (Exception e) {
            System.out.println(e);
        }
    }
     
    public String encrypt(String json, String key) throws NoSuchAlgorithmException, NoSuchPaddingException, IllegalBlockSizeException, BadPaddingException, InvalidKeyException, InvalidAlgorithmParameterException {
        Cipher cipher = null;
        EncYes enc = new EncYes();
        //byte[] keyBytes = new byte[16];
        SecretKeySpec skeySpec = new SecretKeySpec(enc.hexfromString(key), "AES");
        byte[] ivSrc = new byte[12];
        GCMParameterSpec ivSpec = new GCMParameterSpec(128, ivSrc);
        cipher = Cipher.getInstance("AES/GCM/NoPadding");
        cipher.init(1, skeySpec, ivSpec);
        byte[] encstr = cipher.doFinal(json.getBytes());
        return enc.hextoString(encstr);
    }
      
    public String decrypt(String json, String key) throws NoSuchAlgorithmException, NoSuchPaddingException, IllegalBlockSizeException, BadPaddingException, InvalidKeyException, InvalidAlgorithmParameterException {
        Cipher cipher = null;
        EncYes enc = new EncYes();
        //byte[] keyBytes = new byte[16];
        SecretKeySpec skeySpec = new SecretKeySpec(enc.hexfromString(key), "AES");
        byte[] ivSrc = new byte[12];
        GCMParameterSpec ivSpec = new GCMParameterSpec(128, ivSrc);
        cipher = Cipher.getInstance("AES/GCM/NoPadding");
        cipher.init(2, skeySpec, ivSpec);
      
        byte[] encstr = cipher.doFinal(enc.hexfromString(json));
        return new String(encstr);
    }
      
      
    public static byte[] hexfromString(String s) {
        int i = s.length();
        byte[] abyte0 = new byte[(i + 1) / 2];
        int j = 0;
        int k = 0;
        if (i % 2 == 1) {
            abyte0[k++] = (byte)HexfromDigit(s.charAt(j++));
        }
        while(j < i) {
            abyte0[k++] = (byte)(HexfromDigit(s.charAt(j++)) << 4 | HexfromDigit(s.charAt(j++)));
        }
        return abyte0;
    }

    public static int HexfromDigit(char c) {
        if (c >= '0' && c <= '9')
            return c - 48;
        if (c >= 'A' && c <= 'F')
            return (c - 65) + 10;
        if (c >= 'a' && c <= 'f')
            return (c - 97) + 10;
        else
            throw new IllegalArgumentException("invalid hex digit: ");
    }

    public static String asHex(byte[] buf) {
        StringBuffer strbuf = new StringBuffer(buf.length * 2);

        for(int i = 0; i < buf.length; ++i) {
            if ((buf[i] & 255) < 16) {
                strbuf.append("0");
            }

            strbuf.append(Long.toString((long)(buf[i] & 255), 16));
        }

        return strbuf.toString();
    }

    public static String HextoString(byte abyte0[], int i, int j) {
        char ac[] = new char[j * 2];
        int k = 0;
        for (int l = i; l < i + j; l++) {
             byte byte0 = abyte0[l];
             ac[k++] = hexDigits[byte0 >>> 4 & 0xf];
             ac[k++] = hexDigits[byte0 & 0xf];
        }
        return new String(ac);
    }

    public static String hextoString(byte[] abyte0) {
        return HextoString(abyte0, 0, abyte0.length);
    }

    public static String generateIv() {
        UUID uId = UUID.randomUUID();
        return uId.toString().replace("-", "");
    }
                 
}

My PHP code

class EncYes {

    private static $hexDigits = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'];

    public static function main($args) {
        try {
            $enc = new EncYes();

            switch ($args[0]) {
                case "e":
                    return $enc->encrypt($args[1], $args[2]) . "n";
                    break;
                case "d":
                    return $enc->decrypt($args[1], $args[2]) . "n";
                    break;
            }
        } catch (Exception $e) {
            echo $e->getMessage() . "n";
        }
    }

    public function encrypt($json, $key) {
        $iv = str_repeat("", 12);
        $cipher = "aes-128-gcm";
        $tag = "";

        $encrypted = openssl_encrypt($json, $cipher, $this->hexfromString($key), OPENSSL_RAW_DATA, $iv, $tag,"",12);
        if ($encrypted === false) {
            throw new Exception("Encryption failed");
        }

        return $this->hextoString($encrypted . $tag);
    }

    public function decrypt($json, $key) {
        $iv = str_repeat("", 12); // 12-byte IV filled with zeros
        //$iv = base64_decode('AAAAAAAAAAAAAAAA');
        $cipher = "aes-128-gcm";

        $data = $this->hexfromString($json);
        $encrypted = substr($data, 0, -12);
        $tag = substr($data, -12);

       //echo  base64_encode($tag);
        $decrypted = openssl_decrypt($encrypted, $cipher, $this->hexfromString($key), OPENSSL_RAW_DATA, $iv, $tag);
        if ($decrypted === false) {
            throw new Exception("Decryption failed");
        }

        return $decrypted;
    }

    public static function hexfromString($s) {
        $i = strlen($s);
        $abyte0 = array_fill(0, (int)(($i + 1) / 2), 0);
        $j = 0;
        $k = 0;

        if ($i % 2 == 1) {
            $abyte0[$k++] = self::HexfromDigit($s[$j++]);
        }

        while ($j < $i) {
            $abyte0[$k++] = (self::HexfromDigit($s[$j++]) << 4) | self::HexfromDigit($s[$j++]);
        }

        return implode(array_map("chr", $abyte0));
    }

    public static function HexfromDigit($c) {
        if ($c >= '0' && $c <= '9') {
            return ord($c) - ord('0');
        }
        if ($c >= 'A' && $c <= 'F') {
            return (ord($c) - ord('A')) + 10;
        }
        if ($c >= 'a' && $c <= 'f') {
            return (ord($c) - ord('a')) + 10;
        }
        throw new InvalidArgumentException("invalid hex digit: " . $c);
    }

    public static function asHex($buf) {
        $strbuf = "";

        for ($i = 0; $i < strlen($buf); $i++) {
            $byte = ord($buf[$i]);
            if (($byte & 255) < 16) {
                $strbuf .= "0";
            }
            $strbuf .= dechex($byte & 255);
        }

        return $strbuf;
    }

    public static function HextoString2($abyte0, $i, $j) {
        $ac = array_fill(0, $j * 2, '0');
        $k = 0;

        for ($l = $i; $l < $i + $j; $l++) {
            $byte0 = ord($abyte0[$l]);
            $ac[$k++] = self::$hexDigits[$byte0 >> 4 & 0xf];
            $ac[$k++] = self::$hexDigits[$byte0 & 0xf];
        }

        return implode("", $ac);
    }

    public static function hextoString($abyte0) {
        return self::HextoString2($abyte0, 0, strlen($abyte0));
    }

    public static function generateIv() {
        return str_replace("-", "", uuid_create());
    }
}

Remove items from admin bar

This placed in functions.php removes the two items from the admin bar.
What I would like to know is can they be combined?

$wp_admin_bar->remove_node('imagify'); // This removes the Imagify menu.
$wp_admin_bar->remove_node('maintenance_options'); // This removes the maintenance menu.

Together under the one action?

// remove imagify from admin bar
add_action('wp_before_admin_bar_render', function() {
global $wp_admin_bar;
$wp_admin_bar->remove_node('imagify'); // This removes the Imagify menu.
});

// remove maintenance from admin bar
add_action('wp_before_admin_bar_render', function() {
global $wp_admin_bar;
$wp_admin_bar->remove_node('maintenance_options'); // This removes the maintenance menu.
});

Managed to get the two pieces of code working. Wanting to know if it can be slimmed down.

How to keep selected value in Symfony EntityType if value was deleted by softdeletable?

First of all, I use Gedmo’s softdeletable to manage deleted entities. Also I have my own EntityField:

namespace AppFormFields;

use SymfonyBridgeDoctrineFormTypeEntityType;
use SymfonyComponentFormAbstractType;

class EntityField extends AbstractType
{
    public function configureOptions(OptionsResolver $resolver): void
    {
        parent::configureOptions($resolver);

        // some additional configuration

        $resolver->setDefaults([
            'query_builder' => function (EntityRepository $er): QueryBuilder {
                return $er->createQueryBuilder('entity')
                    ->andWhere('entity.deletedAt IS NULL');
            },
        ]);
    }

    public function getParent(): string
    {
        return EntityType::class;
    }
}

As you can see, I don’t use softdeleteable filter in Doctrine, but instead I use custom query_builder in my EntityField.

It works fine as long as I’ve softdeleted entity thas has been already used.

E.g. I have User, File and FileType entities, User has collection of Files and File has FileType. I’ve softdeleted some FileType and for me it means I don’t want to create new Files of this FileType, but all existing Files of this FileType are still legal and have to be properly displayed in forms. “Properly” means, in this case, that if I render File form and this exact file has deleted FileType, the select must have this FileType. But now I have no selected value in this field and it loks like “there is no selected file type for this file” that is not.

I tried to modify query_builder in FormEvents::PRE_SET_DATA event and add the value from the database, but it looks like list of choises is generated before this event, because I can see updated query_builder in the form, but the real query corresponds to unmodified query_buider.

There are buildView and finishView methods, but I don’t think it’s a good idea to use them, because in this case I need to manually modify form attributes.

So, is there a “Symfony way” to do that? Maybe I forgot some form options?

having problems since recreating my database

I have a controller on my Api folder named CrudsController and I have this function. what I don’t understand is this is properly working before I had issues with my database that I had to recreate. Now I’m getting this error message:

Missing Method in CrudsController
Error: The action api_add is not defined in controller CrudsController

> public function add()
>         {
> if ($this->request->is('post')) {
>                 $this->Crud->create();
> if ($this->Crud->save($this->request->data)) {
> 
> if (isset($this->request->data['Crud']) && isset($this->request->data['Crud']['email'])) {
> 
>                         $email = new CakeEmail('default'); // Use the 'default' configuration
> 
> Specify the from address as '[email protected]'
>                     $email->from(array('[email protected]' => 'Your Application'))
>                           ->replyTo('[email protected]') // Set the "Reply-To" header to no-reply address
>                           ->to($this->request->data['Crud']['email'])
>                           ->subject('Notification')
>                           ->send('Your data has been successfully saved.');
> 
> Debug statement
>                     $this->log('Email sent to: ' . $this->request->data['Crud']['email'], 'debug');
> else {
> Debug statement
>                     $this->log('Email not sent: Email address not found in request data', 'debug');
>                 }
> 
>                 $response = array(
>                     'ok' => true,
>                     'msg' => 'saved!',
>                     'data' => $this->request->data,
>                 );
> else {
>                 $response = array(
>                     'ok' => false,
>                     'msg' => 'not saved!',
>                     'data' => $this->request->data,
>                 );
>             }
> 
>             $this->set(array(
>                 'response' => $response,
>                 '_serialize' => 'response'
>             ));
>         }
>     }

I tried editing it to public function api_add. but after that this is the error I’m getting. I just want it to work the way it did before

Database Error
Error: SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (ednc.cruds, CONSTRAINT cruds_ibfk_1 FOREIGN KEY (status_id) REFERENCES statuses (id))

Apache/PHP is stripping the XML tags out of my API call results [closed]

I’m moving an older web application written in php 7.3 from a very old server to a new Ubuntu server. The client has no interest in upgrading the application code past 7.3.

Both old and new servers are running apache.

The application makes some soap calls to salesforce.com apis. When I make the call from the command line via “php sfTest.php”, var_dump( $result ); shows the expected results of:

<sf:E3_Client_Number__c>1010</sf:E3_Client_Number__c><sf:Name>The Name of Some Client</sf:Name><sf:active>true</sf:active>

However, when I run that same file in a browser, var_dump( $result ); returns:

1010The Name of Some Clienttrue

Apache is stripping the tags out of my result set so I can’t parse it. I’ve tried comparing the old server configuration with the new and I can’t spot the difference. I’ve searched this question with all the phrasing I can think of and can’t find anything helpful.

Statamic AppServiceProvider halting app bootstrapping

Throughout the process of upgrading Laravel 10 -> 11, statamic/cms was also upgraded from 4 -> 5. Since this occurred i’ve noticed some service providers not booting when the app is bootstrapping only before calls to Kernel files.

For context, the package ylsideas/feature-flags adds a macro to the Event facade for skipWithoutFeature for use in the kernel schedule which was not loaded at the point of the kernel. Tracing through vendor files led me to the vendor/laravel/framework/src/Illuminate/Foundation/Application::boot method.

When the app is bootstrapping it walks through all service providers and boots them to be accessible. This halts on statamic/cms/src/Providers/AppServiceProvider.php on the line:

$this->app->make(Schedule::class)->job(new HandleEntrySchedule)->everyMinute()

No exception or throwable is thrown from this line, by catching in a try/catch, but additionally no code execution is performed afterwards which causes further service providers to not be booted. This issue does not persist after the kernel is registered and the macro is then applied.

What could this issue be, and how is it possible to debug when no catchable exception is thrown and no logs produced?

the wordpress admin page does not work with my nginx configuration

I installed WordPress and my site in the /var/www/html/guce directory; and when I put root on my nginx configuration the wp-admin admin page does not work, when root is put on /var/www/html; It works correctly but the problem is that I can only access the home page of my site, all other links give 404 not found. with the first root, therefore /var/www/html/guce; all links work correctly, except the wp-admin page. thank you for helping me

it’s my nginx configuration

server {
    listen 80;
    server_name ikar.dev www.ikar.dev;

    # Rediriger automatiquement tout trafic HTTP vers HTTPS
    return 301 https://$server_name$request_uri;
}

server {
    listen 443 ssl;
    server_name ikar.dev www.ikar.dev;
    root /var/www/html;

    ssl_certificate /etc/letsencrypt/live/ikar.dev/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/ikar.dev/privkey.pem;
    include /etc/letsencrypt/options-ssl-nginx.conf;
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;

    client_max_body_size 50M;
    proxy_read_timeout 1200;
    proxy_send_timeout 1200;
    add_header 'Content-Security-Policy' 'upgrade-insecure-requests';
    index index.php index.html index.htm;
  location /nginx_status {
    stub_status on;
    access_log off;
    allow 192.81.216.136;
    deny all;
}
# Bloc spécifique pour wp-admin



#gestion de CSS dans /guce

 location ~ /.ht {
        deny all;
    }
location / {
        try_files $uri $uri/ /index.php?$args;
    }
    location ~ .php$ {
        include snippets/fastcgi-php.conf;
        fastcgi_pass unix:/run/php/php8.3-fpm.sock;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include fastcgi_params;
    }
allow all;
error_log /var/log/nginx/guce_error.log debug;
access_log /var/log/nginx/guce_access.log;
}
}

DomPDF uses custom font on local server, but not in production

I’m using dompdf 3.1.0. The template html resides in public/templates/reports, while the custom fonts are at public/templates/reports/fonts. My CSS inside the template:

@font-face {
        font-family: "Ubuntu";
        src: url("./fonts/Ubuntu-Regular.ttf"); // I tried absolute path as well, no effect
      }

      body {
        font-family: "Ubuntu", serif;
        font-weight: 400;
        font-style: normal;
        font-size: 10pt;
      }

The DomPdf configuration:

        $options = new Options();
        $options->setIsRemoteEnabled(true);
        $options->setFontDir(APPPATH . '../public/templates/reports/fonts');
        $options->setFontCache(APPPATH . '../public/templates/reports/fonts');
        $options->setChroot(APPPATH . '../public/templates/reports/');
        $this->dompdf = new Dompdf($options);

At my local Apache server everything works as expected, however when I try it on the docker container, the font is the default one (even if I set the defaultFont on $options).

Docker image specification:

FROM php:8.3-fpm-alpine3.20

...

WORKDIR /var/www/html

COPY . .

RUN apk add --no-cache curl 
    && curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer 
    && composer install --no-dev 
    && chown -R www-data:www-data . 
    && chmod -R +r public

According to everything, DomPdf should find the font file. I would appreciate any help.

Outlook Mail Analyzer

I’m working on a file that execute a SQL Request when the user goes in it, to know they clicked on the link.
I’m sending it to a lot of people of my company (they are all on Outlook).

However, in my db it’s saying they almost all clicked on it (no one did). I believe it’s something like a link analyzer from Outlook ?

Do you have an idea to fix it ?
A button to execute the sql request would fix it simply, but i really want it to be when they click on the link in the mail..