How to inherit ratings on WooCommerce variable products?

I’ve created several variable products in WooCommerce, grouping similar simple products that had ratings from the Customer Reviews for WooCommerce plugin.

I have a feature that works perfectly, and the reviews are inherited. But I deleted the simple products from which the reviews were inherited, and they were lost.

Is there a way to do this through the database? Could I inherit the reviews by requesting them from the database somehow, even if the products are no longer in the WordPress dashboard?

I’d like to add that everything related to reviews is enabled. I’ve already consulted the documentation for this plugin, but I didn’t find anything about it.

I ran several tests until I found this option that worked:

add_filter( 'woocommerce_product_get_rating_counts', 'fusionar_valoraciones_heredadas', 10, 2 );
add_filter( 'woocommerce_product_get_review_count', 'fusionar_valoraciones_heredadas', 10, 2 );
add_filter( 'woocommerce_product_get_average_rating', 'fusionar_valoraciones_heredadas', 10, 2 );

function fusionar_valoraciones_heredadas( $value, $product ) {

    // Tabla de asignación: 'ID del producto nuevo' => ['IDs de los productos antiguos']
    $productos_a_fusionar = [
        24359 => [326, 327], // Nuevo producto con ID 23736 hereda de los productos 326 y 327
        24224 => [559, 972],
         24192 => [666, 667]
    ];

    // Comprobamos si el ID del producto actual está en nuestra tabla de asignación
    if ( array_key_exists( $product->get_id(), $productos_a_fusionar ) ) {

        // Si es así, obtenemos los IDs antiguos para este producto
        $ids_antiguos = $productos_a_fusionar[ $product->get_id() ];
        $rating_count = [];
        $review_count = 0;

        foreach ( $ids_antiguos as $old_id ) {
            $old_product = wc_get_product( $old_id );
            if ( $old_product ) {
                foreach ( $old_product->get_rating_counts() as $rating => $count ) {
                    if ( ! isset( $rating_count[ $rating ] ) ) {
                        $rating_count[ $rating ] = 0;
                    }
                    $rating_count[ $rating ] += $count;
                }
                $review_count += $old_product->get_review_count();
            }
        }

        if ( current_filter() == 'woocommerce_product_get_rating_counts' ) {
            return $rating_count;
        }
        if ( current_filter() == 'woocommerce_product_get_review_count' ) {
            return $review_count;
        }
        if ( current_filter() == 'woocommerce_product_get_average_rating' ) {
            $total = 0; $count = 0;
            foreach ( $rating_count as $rating => $num ) {
                $total += $rating * $num;
                $count += $num;
            }
            return $count ? round( $total / $count, 2 ) : 0;
        }
    }
    return $value;
} 

I did more tests, since the “stars of the reviews” were not visible, I thought it was due to the code… but it was because the products were simple, since my function calls them by ID.

compiling PHP 8.* with libmysqlclient for MySQL 8.* w/o resorting to the disabled by default in MySQL 8.4/removed in MySQL 9 mysql_native_password [duplicate]

In MySQL I have created the user in this webpage query using the query:

CREATE USER '[user]'@'[host]' IDENTIFIED WITH caching_sha2_password BY '[password]';

and granted this user the only permissions it needs:

grant insert, select on [db].[table] to '[user]'@'[host]';

I specifically don’t use mysql_native_password since it is disabled by default in MySQL 8.4 and removed in MySQL 9.0.

php 8.4 – Choosing a library reads, in part:

// Recommended, compiles with mysqlnd
$ ./configure --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd

// Alternatively recommended, compiles with mysqlnd
$ ./configure --with-mysqli --with-pdo-mysql

// Not recommended, compiles with libmysqlclient
$ ./configure --with-mysqli=/path/to/mysql_config --with-pdo-mysql=/path/to/mysql_config

while MySQL 8.4 – 8.4.1.2 Caching SHA-2 Pluggable Authentication reads, in part:

**Installing SHA-2 Pluggable Authentication**

 The caching_sha2_password plugin exists in server and client forms:

   - The server-side plugin is built into the server, need not be loaded
   explicitly, and cannot be disabled by unloading it.
   
   - The client-side plugin is built into the libmysqlclient client
   library and is available to any program linked against libmysqlclient.

The server-side plugin uses the sha2_cache_cleaner audit plugin as a helper to perform password cache management. 

sha2_cache_cleaner, like caching_sha2_password, is built in and need not be installed.

I am currently compiling PHP 8.4 with:

./configure 
    --prefix=$path_to_php_bin 
    --with-apxs=/usr/local/apache2/bin/apxs 
    --enable-mbstring 
    --with-mysqli 
    --with-mysql=mysqlnd 
    --with-mysqli=mysqlnd 
    --with-pdo-mysql=mysqlnd 
    --with-iconv=$(brew --prefix libiconv) 
    --enable-fpm

but when I attempt to create a mysqli link on a webpage, I generate a Fatal error:

Fatal error: Uncaught mysqli_sql_exception: The server requested authentication method unknown to the client [caching_sha2_password] in [path_to_global_php_commands_include_file]:201

#0 [path_to_global_php_commands_include_file](201): mysqli_connect([host], [user], [password], [db])
#1 [path_to_mysqli_connect_variables_file](10): connectDBi([host], [user], [password], [db])
#2 [path_to_php/html_header_file](12):include('[path_to_mysqli_connect_variables_file]')
#3 [path_to_website_index_file](3): include('[path_to_php/html_header_file]')
#4 {main} thrown in [path_to_global_php_include_commands_file] on line 201

I take it that this Fatal error is being generated because I’m not compiling PHP 8.4 with libmysqlclient because Choosing a library – php 8.4 recommends against doing so while MySQL 8.4 – 8.4.1.2 Caching SHA-2 Pluggable Authentication says it is necessary to do so.

If it is necessary to compile PHP 8.* with libmysqlclient in order to use caching_sha2_password, with MySQL 8.*:

  1. Why does PHP recommend against doing so?

  2. Is there a better way to enable caching_sha2_password than
    compiling PHP 8.* with libmysqlclient?

  3. If I do have to compile PHP 8.* with libmysqlclient using:

$ ./configure --with-mysqli=/path/to/mysql_config --with-pdo-mysql=/path/to/mysql_config

is there code that needs to be in my.conf in order to compile PHP 8.* effectively for [caching_sha2_password] use?

  1. In --with-mysqli=… and --with-pdo-mysql=…, mysql_config means my.conf, right?

Thanks in advance!

non-standard query in wp pattern file

so i love the patterns and the templates in the editor
im trying to create my own patterns
im sure this is a basic question but ive been googling
and am getting really confused as to the order of operations

in a standard query type of last-3-posts.php

    <!-- wp:query {"queryId":1,"query":{"perPage":"3","pages":0,"offset":"0","postType":"post","order":"desc","orderBy":"date","author":"","search":"","exclude":[],"sticky":"","inherit":false},"align":"wide","layout":{"type":"default"}} -->

ok but what if i wanted to do a join query or a query on a non-standard table
ie ive created a new table called mission_meta
where mission_meta has a foreign key to posts
and i want to return that data as well

do i do it in php first and then fill out the pattern template
(how to then populate the pattern?)
or can i call a wp:query with a join?

any pointers would be greatly apprec
thanks!

Why Doesn’t FrankenPHP Feel Faster on Laravel 12 with SQL Server? It’s Almost the Same as Apache [closed]

I’m trying out FrankenPHP for my Laravel 12 application because many people say it’s a super-fast PHP runtime compared to PHP-FPM or Apache. However, after testing it, I found that the speed is almost the same as the standard Apache setup I was using before. In fact, for some API endpoints, the response time is still around 1.2 seconds, and for exporting large data sets (around 90,000 rows to Excel via PhpSpreadsheet), it often timeouts even after increasing the max_execution_time to 60 seconds or more.

For simple API endpoints (e.g. fetch data from DB with a simple join query), response time in Apache is around 600-1200ms, in FrankenPHP it is about the same (it doesn’t drop to <200ms as I expected).

What’s wrong? Is FrankenPHP less than optimal for SQL Server? Or is there a specific tuning for Laravel + SQL Server? Perhaps a bottleneck in the SQLSRV driver?

If anyone has had similar experiences, please share any tips or configurations that make FrankenPHP truly superior. Thank you!

Setting up Codeigniter 4 project’s Base URL (Config/App.php) and .htaccess because i can’t set the document root of the domain to the public folder

This is my base URL on Config/App: https://pantradeglobal.com/raymond_new_pantradeglobal/public

This is my htaccess on root folder:

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteRule ^(.*)$ raymond_new_pantradeglobal/public/$1 [L]
</IfModule>

<FilesMatch "^.">
    Require all denied
    Satisfy All
</FilesMatch>

This is my hataccess on public folder:

# Disable directory browsing
Options -Indexes


<IfModule mod_rewrite.c>
    Options +FollowSymlinks
    RewriteEngine On

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^([sS]*)$ /index.php/$1 [L,NC,QSA]

    # Ensure Authorization header is passed along
    RewriteCond %{HTTP:Authorization} .
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
</IfModule>


<IfModule !mod_rewrite.c>
    # If we don't have mod_rewrite installed, all 404's
    # can be sent to index.php, and everything works as normal.
    ErrorDocument 404 index.php
</IfModule>

# Disable server signature start
ServerSignature Off
# Disable server signature end

It works but the URL becomes very ugly: enter image description here

I set it up like this because i use a web hosting that can’t set the document root for the main domain, (it can only set document root for the subdomains). Is there a way i can make so the base URL in Config/App as https://pantradeglobal.com/ ? so the URL becomes https://pantradeglobal.com/web/gogogyes_new_new instead of https://pantradeglobal.com/raymond_new_pantradeglobal/public/web/gogogyes_new_new. Documentation on Codeigniter: https://codeigniter.com/user_guide/installation/deployment.html#deployment-to-shared-hosting-services enter image description here

The server use LiteSpeed, not Apache.

This is my project structure: enter image description here

Block all outgoing HTTP requests from page (javascript) [closed]

I am trying to make a very basic proxy just for learning purposes. The PHP file accesses a URL and displays it. I’m trying to block all outgoing HTTP requests from any links in the page displayed. I tried using a service worker but it does nothing – all requests go through.

proxy.php:

<script type="text/javascript">
function sendm(){
  navigator.serviceWorker.controller.postMessage('test');
}

if ('serviceWorker' in navigator) { 
  window.addEventListener('load', function() {
    navigator.serviceWorker.register('sw.js').then(function(registration) {
      console.log('Service worker registered with scope: ', registration.scope);
    }, function(err) {
      console.log('ServiceWorker registration failed: ', err);
    });
  });
}

  
</script>


<!DOCTYPE html>
<html>

<body>

<div class="content">

<?php


    $url = "www.ft.com";
    $curl = curl_init();
    curl_setopt($curl, CURLOPT_URL, $url);

    curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
    $response = curl_exec($curl);
    echo $response;

?>
</div>
</body>
</html>

service worker:

self.addEventListener('fetch', function(event) {
  event.respondWith(
    //fetch(event.request)
  );
});

What am I doing wrong? The service worker is registered successfully, but just doesn’t block any requests.

How to optimize YouTube Data API v3 search requests to save quota units? [closed]

I have build a YouTube channel search feature using the Data API v3. Each search request costs 100 quota units, and I’m hitting my daily limit quickly.
Are there ways to reduce quota usage while still fetching all relevant video results?
I’m looking for strategies like caching results, filtering by date, or batching requests.
Currently you can check the api call in below details
Youtube Monetization
I am sending @nasa as channel id.
Please help me.

I tried fetching search results using youtube.search.list() with type=video and maxResults=50.
I also tried filtering by publishedAfter to reduce results per query.
However, each request still costs 100 quota units, and I’m hitting my daily limit quickly.

How to replace a space character with a   inside a XHTML file in an ePub (e-book) [closed]

I am augmenting content of a book in ePub format. My task is to make all single-letter words not to show at the end of a line in paragraphs (<p>) or header (<h1> to <h6>) elements.

To do

This is what we must do:

  • Use a php parser or php script to do the job.
  • Target a set of single-letter words declared earlier.
  • The set contains the following characters:
    u U i I o O a A z Z – (this set is for Polish language)
  • In a single html file there might be hundreds instances, multiple instances for each word.

Example of an input and output string/file

Input file

    <h4>Title a title I title O title z title</h4>

    <p>A Lorem ipsum i dolor sit – amet, w consectetur z adipiscing elit. Quisque tincidunt nisi. Z nec arcu convallis pulvinar.</p>

Output file

    <h4>Title a title I&#160;title O&#160;title z&#160;title</h4>

    <p>A Lorem ipsum i&#160;dolor sit&#160;– amet, w&#160;consectetur z&#160;adipiscing elit. Quisque tincidunt nisi. Z&#160;nec arcu convallis pulvinar.</p>
  • the desired code should be CASE SENSITIVE
  • In case of the , some publishers choose to force it to be at the end of a line or at the beginning of a line of text. The code should allow the user to switch between the two standards.

List of sub-jobs the code must do:

  • A note: I am a beginner in this. It is enough that you help me to write a solution for the first 1-2 letters. After seeing your solution, I will do the rest
  • change w w&#160;
  • change W w&#160;
  • change u w&#160;
  • change U w&#160;
  • change i w&#160;
  • change I w&#160;
  • change o w&#160;
  • change O w&#160;
  • change a w&#160;
  • change A w&#160;
  • change z w&#160;
  • change Z w&#160;
  • change &#160;–

Just a note

Currently I just do a find-and-replace. This crude method works and was acceptable for a single book per year. However, now I am about to do dozens.

How to remove all text from inside HTML elements of certain types in an XHTML file (in ePub)

Situation

My goal is to remove ALL text from a html file. The file is a part of an ePub (electronic book)

Example input and output

(It is a chapter of a novel, contained within a single xhtml file.)

<body id="">
  <div>
    <h3 class="h3"><a id="_idTextAnchor026"></a><a id="_idTextAnchor027"></a> Chapter title</h3>

    <p>Paragraph 1. Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>
    <p>Paragraph 1. It contains an `a` element.<a id="_idTextAnchor026"></a>. The `a` element should remain intact!</p>

After processing the file or string, the output should be like this:

<body id="">
  <div>
    <h3 class="h3"><a id="_idTextAnchor026"></a><a id="_idTextAnchor027"></a></h3>

    <p></p>
    <p></p>

Success conditions:

  • In the output, all html elements intact. THerefore the structure of both the html file and the ePub is also intact.
  • The special focus is on <a> elements, which are vital part of the whole book’s structure. They are referred to in contents table, file manifests and so on.

What I have tried

I am a begginner in HTML parsing. All solutions lack documentation, which block all my progress in resolving issues.

I have used this repo:
https://github.com/paquettg
and tried to modify this code:

$dom = new Dom;
        $dom->loadStr('<div class="all"><p>Hey bro, <a href="google.com">click here1</a><a href="google.com">click here2</a><br /> :)</p></div>');
        /** @var DomNodeInnerNode $a */
        $a   = $dom->find('a');
        $a->childNodes()->setText('(deleted)');
        echo $dom;

Issues

  • I don’t know how to find all <a> elements. Replacing firstChild with my best quesses has not worked.
  • Also, I have no clue how to handle multiple elements: p, a, h1 to h5, span, b, i, cite, div.
    but I was unable to find a command to select all <a>, h3 and all <p> elements. No documentation.

Just a sidenote

  • My purpose is to create a ePub file with a book sample. The task is to keep first 30% of a book and delete all remaining chapters. Anex and everything at the end of a book should remain as is.
  • The common practices are time consuming and/or damage the ePub structure. In effect, the samples often do not pass automatic check-ups.
  • After I solve this issue, I plan to develop a clean-up app to remove all unwanted class and id attributes, replace spaces with non-breaking spaces and so on.

Woocommerce products batch update limitation: How to update more

I am creating a plugin to update products stock and regular price for now. I am using the batch update API endpoint as follow. I use a csv file with 3 columns product sku, stock and regular price to batch update my website using WC REST API (home_url(‘/wp-json/wc/v3/products/batch’). Everything is working correctly except that I can not batch update when my file contains between 500 to 600 products. I then get 503 Backend fetch failed. The way I proceeed is sending 50 products data at a time as json formatted array of data (as the limit indicated in WC REST API documentation is 100 products). I also used the filter from this SO question to increase the limit but without success. Below are the main methods parts of my stockUpdater class. I first upload the csv file in wp-content folder then use AJAX to instantiate a new class with the methods below that start the batch update process.

    private function sendBatchRequest($data) {

            $ch = curl_init($this->apiUrl);
            curl_setopt_array($ch, [
                CURLOPT_RETURNTRANSFER => true,
                CURLOPT_POST => true,
                CURLOPT_POSTFIELDS => json_encode($data),
                CURLOPT_HTTPHEADER => ['Content-Type: application/json'],
                CURLOPT_USERPWD => $this->apiKey . ':' . $this->apiSecret, 
                CURLOPT_TIMEOUT => 60
            ]);

            $response = curl_exec($ch);
            $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
            curl_close($ch);

            return [
                'success'   => ($httpCode >= 200 && $httpCode < 300),
                'response'  => json_decode($response, true),
                'http_code' => $httpCode
            ];
    }

    public function processStockFile() {

        $products = $this->parseCSV(); 
        /* parseCSV returns 

            $products[] = [
                'sku' => trim($data[0]),  // Product SKU
                'id'  => $id,    // Product id
                'stock' => !empty($data[1]) ? (int)trim($data[1]) : 0, // Stock quantity
                'price' => !empty($data[2]) ? wc_format_decimal(str_replace(',', '.', trim($data[2]))) : 0//!empty($data[2]) ? (float)$data[2] : 0, // Product price
            ];
        */
        $chunks = array_chunk($products, 50); // split into 50 products per batch

        $results = [];
        foreach ($chunks as $chunk) {
            $data = ['update' => []];
            foreach ($chunk as $product) {
                $data['update'][] = [
                    'id'             => $product['id'],
                    'sku'            => $product['sku'],
                    'stock_quantity' => $product['stock'],
                    'regular_price'  => $product['price'],
                ];
            }

            $results[] = $this->sendBatchRequest($data);
            //used sleep(1) here did not change
        }

        return $results;

    }

I tried to pause the curl request before sending another one (using php sleep() and usleep()) but again without success. Is there anyway to increase this limit (what I tried did not work in my case) or maybe to fraction the data to send and proceed again after the previous response is a success, in this case what is the best way to proceed?

HerdHelper installed but cannot be reached on Windows (port issue 5022)

HerdHelper

I am using the Herd application on Windows computer for working multiple php version applications and I’m having trouble every time with the HerdHelper service when i stop and start the services.

When I open the Herd app I see this error:

The HerdHelper is installed, but can not be reached. Please try changing the port – this requires admin access. If the error persists, please take a look at the troubleshooting docs.

What I tried so far

  • Restarting Herd
  • Restarting Windows
  • Changing the port in the Herd settings (still no luck)
  • Running Herd as Administrator

How can I fix this error so that HerdHelper runs correctly and connects to the Herd app?
Is there a specific port conflict or Windows service permission I should check?

Laravel Development server failed to listen on 0.0.0.0:8001 [duplicate]

When I start the server, I get this error.

php artisan serve --host=0.0.0.0 --port=8001

Starting Laravel development server: http://0.0.0.0:8001

[Sat Sep 20 08:30:14 2025] Failed to listen on 0.0.0.0:8001 (reason: ?)

I set up Laravel Herd and confirmed that the application was working. However when I try to start it locally using php artisan serve it doesn’t run. I checked with netstat -ano | findstr :8001, and nothing is running on that port. How can I fix this issue?

PHP-cli running with curl_init but not with file_get_contents, how to enable?

Using php -a

$url = "https://getcomposer.org/versions";

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0");
echo curl_exec($ch);

It working fine, returns a JSON string from the URL. Now, continuing in the php -a terminal interaction:

echo file_get_contents($url);

… After a long wait, say: “PHP Warning: file_get_contents(…): Failed to open stream: Connection timed out in php shell code”.

Same error when using all headers:

error_reporting(E_ALL);
ini_set('display_errors', 1);

ini_set("auto_detect_line_endings","0");
ini_set("allow_url_fopen", "1");
ini_set("allow_url_include", "0");
ini_set("user_agent", "Mozilla/5.0");

echo file_get_contents($url);

PS: I need file_get_contents for WordPress, Composer, etc. this question is about “why file_get_contents not working”.


My env

php -v 
PHP 8.0.30 (cli) (built: May 20 2025 13:31:19) ( NTS gcc x86_64 )
cat /etc/oracle-release
Oracle Linux Server release 9.6

Modificar caracteres do MySql (Charset) [closed]

Olá, em meu banco de dados alguns dados estão com caracteres errados Invés de alterar palavra errada por palavra, tem como solucionar de uma vez? O conteúdo armazenado no mysql vem de um plugin do WordPress.

Já tentei alterar a codificação, tentei de tudo e não resolvi, ficarei grato por sua atenção, até mais

Symfony app crashes during XDebug session at EntityManager proxy, but manual evaluation works

I’m experiencing a strange debugging issue with my Symfony web application where XDebug causes a crash, but manually evaluating the same code works fine.

Problem Description

When debugging my Symfony application with XDebug in PHPStorm, the application crashes when execution reaches var/cache/dev/ContainerJCxBVLf/EntityManager_9a5be93.php at line 225 (specifically at the getRepository() call).

However, when I manually evaluate $this->getRepository(); in the PHPStorm Debug Evaluator at the exact same breakpoint in SymfonyBridgeDoctrineSecurityUserEntityUserProvider->refreshUser(), it executes successfully and the application continues normally.

Stack Trace

EntityManager_9a5be93.php:225, ContainerJCxBVLfEntityManager_9a5be93->getRepository()
EntityUserProvider.php:139, SymfonyBridgeDoctrineSecurityUserEntityUserProvider->getRepository()
EntityUserProvider.php:84, SymfonyBridgeDoctrineSecurityUserEntityUserProvider->refreshUser()
ContextListener.php:216, SymfonyComponentSecurityHttpFirewallContextListener->refreshUser()
ContextListener.php:131, SymfonyComponentSecurityHttpFirewallContextListener->authenticate()
WrappedLazyListener.php:49, SymfonyBundleSecurityBundleDebugWrappedLazyListener->authenticate()
AbstractListener.php:26, SymfonyComponentSecurityHttpFirewallAbstractListener->__invoke()
TraceableFirewallListener.php:62, SymfonyBundleSecurityBundleDebugTraceableFirewallListener->callListeners()
Firewall.php:86, SymfonyComponentSecurityHttpFirewall->onKernelRequest()
WrappedListener.php:117, SymfonyComponentEventDispatcherDebugWrappedListener->__invoke()
EventDispatcher.php:230, SymfonyComponentEventDispatcherEventDispatcher->callListeners()
EventDispatcher.php:59, SymfonyComponentEventDispatcherEventDispatcher->dispatch()
TraceableEventDispatcher.php:151, SymfonyComponentEventDispatcherDebugTraceableEventDispatcher->dispatch()
HttpKernel.php:133, SymfonyComponentHttpKernelHttpKernel->handleRaw()
HttpKernel.php:79, SymfonyComponentHttpKernelHttpKernel->handle()
Kernel.php:195, SymfonyComponentHttpKernelKernel->handle()
index.php:78, {main}()

Suspicious Code in Generated Proxy

I noticed that the generated cache file EntityManager_9a5be93.php appears to have a potential issue. The variable $valueHolder68094 is used without being defined in the local scope:

<?php
namespace ContainerJCxBVLf;
include_once dirname(__DIR__, 4).'/vendor/doctrine/persistence/src/Persistence/ObjectManager.php';
include_once dirname(__DIR__, 4).'/vendor/doctrine/orm/src/EntityManagerInterface.php';
include_once dirname(__DIR__, 4).'/vendor/doctrine/orm/src/EntityManager.php';

class EntityManager_9a5be93 extends DoctrineORMEntityManager implements ProxyManagerProxyVirtualProxyInterface
{
    /**
     * @var DoctrineORMEntityManager|null wrapped object, if the proxy is initialized
     */
    private $valueHolder68094 = null;

    /**
     * @var Closure|null initializer responsible for generating the wrapped object
     */
    private $initializerd5058 = null;

    /**
     * @var bool[] map of public properties of the parent class
     */
    private static $publicProperties034fb = [

    ];

    // ...

    public function getRepository($entityName)
    {
        $this->initializerd5058 && ($this->initializerd5058->__invoke($valueHolder68094, $this, 'getRepository', array('entityName' => $entityName), $this->initializerd5058) || 1) && $this->valueHolder68094 = $valueHolder68094;

        return $this->valueHolder68094->getRepository($entityName);
    }

    // ...
}

Notice that in each method, $valueHolder68094 is passed to the initializer closure by reference, but it’s not defined in the method’s local scope.

Environment

  • PHP Version: 8.1.33
  • XDebug Version: 3.4.5
  • Symfony Components: v5.2.x
    • symfony/cache: v5.2.0
    • doctrine/orm: 2.20.6
    • doctrine/doctrine-bundle: 2.7.0

What I’ve tried

  • Clearing the Symfony cache (the whole cache folder)
  • Manually evaluating the code in the Debug Evaluator (which works)

Question

Why does the Symfony application crash during XDebug debugging at the EntityManager proxy’s getRepository() call, but executing the same method manually in the Debug Evaluator works fine? Is this a known issue with proxy generation, XDebug compatibility, or a configuration problem?