‘React/JSCExecutorFactory.h’ file not found with React Native upgrade 0.77x

error screenshotI have done RN upgrade from 0.76.9 to 0.77x. In Android, it’s working fine. but getting this error on ios while running the app.I have added to lines in AppDelegate.mm
#import <ReactAppDependencyProvider/RCTAppDependencyProvider.h>
self.dependencyProvider = [RCTAppDependencyProvider new]; because as per docs i don’t have to migrate to Swift: the Objective-C++ variant but i got error ‘React/JSCExecutorFactory.h’ file not found. I have tried multiple possible solution but it’s not resolved yet.

# require_relative '../node_modules/react-native/scripts/react_native_pods'
# require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'
require_relative '../node_modules/react-native-permissions/scripts/setup'
#Google Maps SDK for iOS requires iOS 13, so make sure that your deployment target is >= 13.4 in your iOS project settings.
#platform :ios, min_ios_version_supported #'13.4'
require Pod::Executable.execute_command('node', ['-p',
  'require.resolve(
    "react-native/scripts/react_native_pods.rb",
    {paths: [process.argv[1]]},
  )', __dir__]).strip
  
platform :ios,'15.6'
prepare_react_native_project!
setup_permissions([
  'AppTrackingTransparency',
  'LocationAccuracy',
   'LocationAlways',
   'LocationWhenInUse',
   'Bluetooth',
   'Camera'
])

def node_require(script)
   # Resolve script with node to allow for hoisting
   require Pod::Executable.execute_command('node', ['-p',
     "require.resolve(
       '#{script}',
       {paths: [process.argv[1]]},
     )", __dir__]).strip
end

# Use it to require both react-native's and this package's scripts:
node_require('react-native/scripts/react_native_pods.rb')
node_require('react-native-permissions/scripts/setup.rb')
# If you are using a `react-native-flipper` your iOS build will fail when `NO_FLIPPER=1` is set.
# because `react-native-flipper` depends on (FlipperKit,...) that will be excluded
#
# To fix this you can also exclude `react-native-flipper` using a `react-native.config.js`
# ```js
# module.exports = {
#   dependencies: {
#     ...(process.env.NO_FLIPPER ? { 'react-native-flipper': { platforms: { ios: null } } } : {}),
# ```
# Changed this line with below line: flipper_config = ENV['NO_FLIPPER'] == "1" ? FlipperConfiguration.disabled : FlipperConfiguration.enabled
#flipper_config = FlipperConfiguration.disabled

linkage = ENV['USE_FRAMEWORKS']
if linkage != nil
  Pod::UI.puts "Configuring Pod with #{linkage}ally linked Frameworks".green
  use_frameworks! :linkage => linkage.to_sym
end

  flags = get_default_flags()
#


target 'CustomerFacingApp' do
#target 'CustomerFacingAppDevelopment' do
#use_frameworks!
use_frameworks! :linkage => :static
$RNFirebaseAsStaticFramework = true
$RNFirebaseAnalyticsWithoutAdIdSupport = true
#use_modular_headers!

 
  config = use_native_modules!

  #$RNFirebaseAsStaticFramework = true
  # Add the lines specifying :modular_headers => true for Firebase pods
  pod 'GoogleUtilities', :modular_headers => true
  pod 'FirebaseCore', :modular_headers => true
  pod 'FirebaseInstallations', :modular_headers => true
  pod 'GoogleDataTransport', :modular_headers => true
  pod 'nanopb', :modular_headers => true
  pod 'FirebaseCoreInternal', :modular_headers => true
  pod 'FirebaseCrashlytics', :modular_headers => true
  pod 'FirebaseRemoteConfig', :modular_headers => true
  pod 'FirebaseSessions', :modular_headers => true
  pod 'FirebaseABTesting', :modular_headers => true
  pod 'FirebaseCoreExtension', :modular_headers => true
  pod 'FirebaseFirestoreInternal', :modular_headers => true
  pod 'react-native-version-check', :path => '../node_modules/react-native-version-check'
  pod 'RNScratch', :path => '../node_modules/react-native-scratch'
  pod 'HyperCardScan', '2.2.3'  

  # React Native Maps dependencies
  rn_maps_path = '../node_modules/react-native-maps'
  pod 'react-native-google-maps', :path => rn_maps_path
  # Flags change depending on the env values.
  use_react_native!(
    :hermes_enabled => flags[:hermes_enabled],
        :app_path => "#{Pod::Config.instance.installation_root}/.."
  )

  target 'CustomerFacingAppTests' do
    inherit! :complete
    # Pods for testing
  end
   target 'CustomerFacingAppDevelopment' do
     inherit! :complete
   end

  target 'CustomerFacingAppStaging' do
    inherit! :complete
  end
  target 'CustomerFacingAppQa' do
    inherit! :complete
  end
  target 'CustomerFacingAppPreprod' do
    inherit! :complete
  end
  target 'CustomerFacingAppUat' do
    inherit! :complete
  end
  target 'CustomerFacingAppDevTemp' do
    inherit! :complete
  end

  pre_install do |installer|
    installer.pod_targets.each do |pod|
      if pod.name.eql?('callstack-repack')
        def pod.build_type
          Pod::BuildType.static_library
        end
      end
    end
  end

  post_install do |installer|
    react_native_post_install(
      installer,
      # Set `mac_catalyst_enabled` to `true` in order to apply patches
      # necessary for Mac Catalyst builds
      :mac_catalyst_enabled => false
    )

   puts "Post-install Patch is running..."
     # Run your patching script and log its output
     result = `sh ./CustomerFacingApp/patch_grpc_core.sh`
     # Print the output of the script
     puts "Output from patch_grpc_core.sh:"
     puts result
     # Optionally, check for errors
     if $?.exitstatus != 0
       puts "Error: The patching script failed with exit code #{$?.exitstatus}"
     else
       puts "Patch Script executed successfully."
       end
   
    bitcode_strip_path = `xcrun --find bitcode_strip`.chop!
   def strip_bitcode_from_framework(bitcode_strip_path, framework_relative_path)
     framework_path = File.join(Dir.pwd, framework_relative_path)
     command = "#{bitcode_strip_path} #{framework_path} -r -o #{framework_path}"
     puts "Stripping bitcode: #{command}"
     system(command)
     system("chmod -R u+w Pods/RCT-Folly")
       Dir.glob("Pods/RCT-Folly/folly/Portability.h").each do |file|
         text = File.read(file)
         new_contents = text.gsub('#define FOLLY_HAS_COROUTINES 1', '#define FOLLY_HAS_COROUTINES 0')
         File.open(file, "w") { |file| file.puts new_contents }
       end
   end
 
   framework_paths = [
     "Pods/LogRocket/LogRocket.xcframework/ios-arm64/LogRocket.framework/LogRocket",
     "Pods/hermes-engine/destroot/Library/Frameworks/macosx/hermes.framework/hermes",
     "Pods/hermes-engine/destroot/Library/Frameworks/macosx/hermes.framework/Versions/Current/hermes",
     "Pods/hermes-engine/destroot/Library/Frameworks/universal/hermes.xcframework/ios-arm64/hermes.framework/hermes",
     "Pods/hermes-engine/destroot/Library/Frameworks/universal/hermes.xcframework/ios-arm64_x86_64-maccatalyst/hermes.framework/hermes"
   ]
 
   framework_paths.each do |framework_relative_path|
     strip_bitcode_from_framework(bitcode_strip_path, framework_relative_path)
   end
    installer.pods_project.targets.each do |target|
      target.build_configurations.each do |config|
            config.build_settings['CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES'] = 'YES'
          end
      if target.name == 'BoringSSL-GRPC'
        target.source_build_phase.files.each do |file|
          if file.settings && file.settings['COMPILER_FLAGS']
            flags = file.settings['COMPILER_FLAGS'].split
            flags.reject! { |flag| flag == '-GCC_WARN_INHIBIT_ALL_WARNINGS' }
            file.settings['COMPILER_FLAGS'] = flags.join(' ')
          end
        end
      end
    end
    # __apply_Xcode_12_5_M1_post_install_workaround(installer)
    fuse_path = "./Pods/HyperSDK/Fuse.rb"
    clean_assets = false # Pass true to re-download all the assets
    if File.exist?(fuse_path)
      if system("ruby", fuse_path.to_s, clean_assets.to_s)
      end
    end
    installer.pods_project.targets.each do |t|
      if t.name.start_with?("AEP")
        t.build_configurations.each do |bc|
            bc.build_settings['OTHER_SWIFT_FLAGS'] = '$(inherited) -no-verify-emitted-module-interface'
        end
      end
      t.build_configurations.each do |bc|
         bc.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= ['$(inherited)', '_LIBCPP_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION']
      end
    end

  end
  # pod 'FirebaseCore'
  #     pod 'FirebaseCoreInternal'
end
  1. I have updated the podfile with enable Hermes and new Arch.
  2. Tried to direct import RCTAppDependencyProvider in podfile.
  3. Upgrade the “@react-native-community/cli-platform-ios
  4. I have tried this steps multiple times
    cd ios
    rm -rf Pods
    rm Podfile.lock
    rm -rf ~/Library/Developer/Xcode/DerivedData/*
    pod cache clean –all
    pod install –repo-update
  5. tried to update use_frameworks! :linkage => :static in podfile

Mediasoup Consumer Receives 0 Frames Despite Successful Backend Stream and Transport Setup

I’m using Mediasoup and building a streaming app. I have implemented only a receiver transport. From the backend, the stream chunks (UDP data) are successfully sent to the Mediasoup server. However, on the frontend side, even though bytesReceived and framesReceived are shown, their values are 0.

I don’t know where the problem is. I can see logs in the terminal showing that the data is correctly sent. On my backend terminal, I ran DEBUG=mediasoup:* and it shows the complete connection with all ICE, DTLS, codec, and transport information. The transport and consumer are also created successfully without any error, and the consumer resumes successfully from frontend to backend.

However, the frames are not being received by the frontend or the consumer side. I don’t know why this is happening or where the issue lies.

Is there a way to have the timer override the prompt input?

I’m trying to make a terminal quiz that has a timer running in the background while you answer the question that once finished overrides the input if it hasn’t been filled.

I’ve tried putting the timer and question into different functions and have calling them in different orders:

const prompt = require("readline-sync");
let countdown;

function timer(questionAnswer){
    clearTimeout(countdown);
    countdown = setTimeout(() => {
        console.log("Sorry! you ran out of time. The answer was " + questionAnswer);
    }, 5000);//<-- Adjust this number to change the length of the countdown

}

function question(questionAnswer){
    let playerAnswer = prompt.question("Please enter your answer:   ");
    playerAnswer = Number(playerAnswer);//<--change this line depending on variable type

    if(countdown != 0){
        if(playerAnswer == questionAnswer){// change this condition on a question-by-question basis
          console.log("Correct!");
          //<--add point distribution here
        }else{
            console.log("Incorrect! The correct answer was " + questionAnswer);
        }  
    clearTimeout(countdown);
    }
}

question(72);//<¬
timer(72);// <----Change these lines to read from file that stores the answers depending on the question

However, calling the timer first has no effect and continues straight to the question and if I call the question first the timer only starts after the input has been filled.

Protect from screen recording

I create a web-submit-form for whistleblower. In order to keep the whistleblower anonym, I need to protect the form from being recorded.

I thought about DRM but its for videos only. Is there a transparent video I could overlap the form with DRM?

Otherwise, any other suggestions?

How to increase fetch priority for background-image from Low to High?

There are two <div> elements with the class “slider-cell” where the images are set via the inline style “background-image” The “Network” tab in Dev Tools shows that these two images have Priority High Low (screenshot), but it needs to be High High.

If this were an <img> element, it could probably be changed by adding the “fetchpriority” attribute, but here it’s a background-image. I’ve heard it might somehow be possible to do this with a link rel (though not sure). But how?

The HTML below cannot be changed since it is generated, so the Priority needs to be adjusted by affecting this HTML.

<div class="flickity-slider">
  <div class="slider-cell" style="background-image: url(&quot;https://mysite/pathtoimage/first.jpg&quot;);"></div>
  <div class="slider-cell is-selected" style="background-image: url(&quot;https://mysite//second.jpg&quot;);"></div>
</div>

enter image description here

endpoints moved to different env, blocked by ORB

the backend endpoints moved from dev to stage environment. All the env variables are correct. When accessed the staging url in browser, the request in network tab is still like: https://dev-appname/bundle.js.

But in production environment it correctly points to the proper request url

using webpack bundler. build is successfull for stage as well. not sure about this issue. Because of this on accessing stage url, there is blank screen and no UI.

all env variables and dist files have the staging url. still no ui on accessing the staging url

HTML link does not get focus outline on receiving focus unless textarea has been focussed explicitly

Example 1 – No focus outline for link

I have a keydown handler for a <textarea>. When the handler gets invoked, I want a link (<a> tag) to receive focus. If you run the example below and type something in the <textarea>, you will see the link receiving focus after 1000 ms (1 second). The link changes its color to green when it receives focus.

But when the link receives focus, it does not get a focus outline around it. I confirmed this with Firefox v143 and Chrome v140.

let link
let text

function main() {
  link = document.getElementById('link')
  text = document.getElementById('text')
  text.value = ''
  text.addEventListener('keydown', keydown)
}

function keydown() {
  setTimeout(handler, 1000)
}

function handler() {
  console.log('text.value:', text.value)
  link.focus()
}

window.addEventListener('load', main)
a:focus { color: green }
<textarea id="text"></textarea>
<a id="link" href="https://example.com/">example.com</a>

Example 2 – Successful focus outline for link

But in the example below, when I type something into the <textarea>, the link gets focus after 1000 ms (1 second) and the link gets an outline too.

The only difference between the previous example and this example is that this example has text.focus() call which the previous example does not have.

let link
let text

function main() {
  link = document.getElementById('link')
  text = document.getElementById('text')
  text.focus()
  text.value = ''
  text.addEventListener('keydown', keydown)
}

function keydown() {
  setTimeout(handler, 1000)
}

function handler() {
  console.log('text.value:', text.value)
  link.focus()
}

window.addEventListener('load', main)
a:focus { color: green }
<textarea id="text"></textarea>
<a id="link" href="https://example.com/">example.com</a>

Question

Why does the link NOT get a focus outline around it in the 1st example and why does it get a focus outline in the 2nd example? I am unable to find anything in the W3 specs that would explain this behavior. Can you help explain this behavior?

Angular emitted event does not fire

I have the following in document-browser.component.html :

<window-container #createDocumentWindow [title]="'XXX'">
    <document-form *ngIf="createDocumentWindow.isOpen"
        CreateDocumentForm
        (save)="onCreateDocument($event)"
        (reset)="createDocumentWindow.close()"
        (saveChanged)="onSaveChanged($event)">
    </document-form>
</window-container>

document-form.component.ts extends a class BaseFormComponent that has an

@Output() saveChanged: EventEmitter<any> = new EventEmitter();  

and in the same (BaseFormComponent) class emits it :

private _saving;

get saving(){ return this._saving; }

//this is fired whenever needed.
set saving(value:boolean){
    this._saving=value;
    this.saveChanged.emit(value);
  }

In document-browser.component.ts I’ve exposed a method :

  onSaveChanged(state: boolean){
    console.log("onSaveChanged fired");
    this.isSaving=state;
  }

The problem is that the onSaveChanged never gets fired.

I’ve implemented the exact same code in a slightly different scenario in document-page.component.html and the event fires as expected:

<page-container [title]="'XXX'">
    <kendo-tabstrip class="mb-2">
        <kendo-tabstrip-tab [title]="'XXXX'" [selected]="true">
            <ng-template kendoTabContent>
                <div class="tab-form-content">
                    <document-form CreateDocumentForm 
                                        (save)="onSave($event)"
                                        (saveChanged)="onSaveChanged($event)">
                    </document-form>
                </div>
            </ng-template>
        </kendo-tabstrip-tab>
    </kendo-tabstrip>

    <div bottomButtons>
        <button BackButton 
                [backUrl]="urls.browser"
                [disabled]="isSaving">xxxxx</button>
    </div>
</page-container>

document-page.component.ts implements the onSaveChanged method too :

onSaveChanged(state:boolean){
    this.isSaving=state;
  }

The document-form.component.ts is the same in both cases.
I’ve also attached a debugger and the setter is hit in both cases.

I am entirely new in Angular, so please help me understand why the method onSaveChanged is not fired in the first case.

Same fetch works on Swagger but doesn’t work from web application

Here on Swagger JwtToken appearing:

JavaScript code:

async function Login(email, password)
{
    let loginForm = {};
    loginForm['email'] = email;
    loginForm['password'] = password;

    await fetch('https://localhost:7238/login',
    {
        method: "POST",
        body: JSON.stringify(loginForm),
        headers: { 'content-type': 'application/json' }
    });

    console.log(JSON.stringify(loginForm));

}

But here on web application JwtToken does not appear, but JSON request is the same (you can see it on Console):

enter image description here

Doctrine Translatable: Is it possible to override the ID generation strategy of AbstractPersonalTranslation?

I need some help regarding the usage of Doctrine Translatable (from Doctrine Extensions)

Context

I use Doctrine Translatable to translate an entity, and my use-case follows closely this example from the docs.

This approach, where the translation entity extends AbstractPersonalTranslation, leads to a translation table having an ID generation with strategy “IDENTITY”, because AbstractPersonalTranslation is as follows:

...
#[ORMMappedSuperclass]
abstract class AbstractPersonalTranslation
{
    #[ORMColumn(type: Types::INTEGER)]
    #[ORMId]
    #[ORMGeneratedValue(strategy: 'IDENTITY')]
    protected $id;
...

The issue

The fact is that, for reasons that I explain at the end of the post, I want to change the definition of the GeneratedValue strategy for my translation table extending AbstractPersonalTranslation.

What I have tried

I tried overriding the property as follows in my child class:

class MyEntityTranslation extends AbstractPersonalTranslation
{
    #[ORMColumn(type: Types::INTEGER)]
    #[ORMId]
    #[ORMGeneratedValue(strategy: 'SEQUENCE')]
    protected $id;
...

however I get the following error:

In MappingException.php line 420:
                                                                                                                                                    
  Duplicate definition of column 'id' on entity 'AppEntityTranslationDeviceNotificationTranslation' in a field or discriminator column mapping.

Why do I want to do this?

This is probably not relevant for the issue but the reason why I need to change the auto-generated ID strategy is because I am currently upgrading my project ot Doctrine’s ORM 3 and DBAL 4 with a PostgreSQL DB, which changes the default strategy. I would like to deploy the upgrade without changing my DB tables and, afterwards, perform the migration of the DB IDs (as suggested by some important contributors)

Custom document root in XAMPP

I’m currently going through Laracast’s PHP for Beginners series, and in episode 30, they make a change to the document root. I’m using XAMPP on Windows, and the default document root in my httpd.conf was C:/xampp/htdocs. I’ve changed this to my desired document root, C:/xampp/htdocs/public, but only the public/index.php page works and nothing else.

I seem to receive a 404 when trying to access any file/page that’s outside the /public folder, which makes sense. However, they watching the video, they seem to be able to.

https://www.youtube.com/watch?v=cayyhoFnqSY&list=PL3VM-unCzF8ipG50KDjnzhugceoSG3RTC&index=30

My file structure is as follows:

controllers
    notes
        create.php
        index.php
    index.php
public
    index.php
views
    notes
        create.view.php
        index.view.php
    partials
        banner.php
        footer.php
        header.php
        nav.php
    404.php
    index.view.php
config.php
Database.php
functions.php
router.php
routes.php
Validator.php

My current httpd.conf (Line 252 & 253):

DocumentRoot "C:/xampp/htdocs/public"
<Directory "C:/xampp/htdocs/public">

I’ve also tried the following in httpd-vhosts.conf instead (https://serverfault.com/questions/917029/apache-server-wont-change-root-directory):

<VirtualHost *:80>
    ServerAdmin [email protected]
    DocumentRoot "C:/xampp/htdocs/public"
    ServerName localhost
    <Directory "C:/xampp/htdocs/public">
        Options Indexes FollowSymLinks Includes ExecCGI
        AllowOverride All
        Require all granted
    </Directory>
</VirtualHost>

My .htaccess file (tried commenting these rules out, in case they caused issues):

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]

My router.php file:

$uri = parse_url($_SERVER['REQUEST_URI'])['path'];

$routes = [
    '/' => 'controllers/index.php',
    '/notes' => 'controllers/notes/index.php',
    '/notes/create' => 'controllers/notes/create.php',
];

function routeToController($uri, $routes) {
    if (array_key_exists($uri, $routes)) {
        require $routes[$uri];
    } else {
        abort();
    }
}

Shortcode is print blank info

I’m using WordPress (WooCommerce) with the Eventon plugin.
I’m trying to print the event location and event date in the WordPress email template.

Here is the code that I’m using:

if ( isset($attr['type']) && $attr['type'] == 'event-date' ) {
    foreach ( $order->get_items() as $item_id => $item ) {
        $event_id = $item->get_product_id();
        $event_date = get_post_meta( $event_id, '_EventStartDate', true );

        if ( ! empty( $event_date ) ) {
            // Format event date
            $formatted_date = date_i18n( get_option( 'date_format' ) . ' ' . get_option( 'time_format' ), strtotime( $event_date ) );
            printf( __( "%s", 'wc-pre-orders' ), '<b>' . esc_html( $formatted_date ) . '</b>' );
        }
    }
}

// Event Location
if ( isset($attr['type']) && $attr['type'] == 'event-location' ) {
    foreach ( $order->get_items() as $item_id => $item ) {
        $event_id = $item->get_product_id();
        $venue_id = get_post_meta( $event_id, '_EventVenueID', true );

        if ( $venue_id ) {
            $venue_name = get_the_title( $venue_id );
            $venue_address = get_post_meta( $venue_id, '_VenueAddress', true );

            printf(
            __( "%s", 'wc-pre-orders' ),
            '<b>' . esc_html( $venue_name . ( $venue_address ? ' - ' . $venue_address : '' ) ) . '</b>'
            );
        }
    }
}

Do you have any idea why it doesn’t print the information? (event location + event date)

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!