Fatal Error with BlockArts Block Plugin on WordPress – Cannot Traverse an Already Closed Generator

I am facing an issue with the BlockArts Block plugin on my WordPress / WooCommerce site. Recently, I started encountering the following fatal error when attempting to edit any pages or blocks built using the plugin:

PHP Fatal error: Uncaught Exception: Cannot traverse an already closed generator in /var/www/vhosts/flawxmusic.com/academy.flawxmusic.com/wp-content/plugins/blockart-blocks/includes/ScriptStyle.php:358

This error prevents me from modifying any content on the site, essentially breaking my ability to edit pages or blocks.

Details:

  • The issue appeared suddenly without any prior warnings.
  • I have not made any major recent changes to the site, except for updating some basic plugins.
  • The error is occurring specifically in the ScriptStyle.php file on line 358.
  • The plugin was functioning perfectly well before this issue surfaced.

Steps I’ve Taken:

  1. Deactivated and reactivated the plugin: This did not resolve the issue, and the error persisted when attempting to edit pages.
  2. Cleared the cache: I cleared the WordPress and server cache using the WP Super Cache plugin, deleting all files from the cache directory. This did not resolve the issue because the error persists when I attempt to edit a page.
  3. Tried modifying the plugin code: Based on a suggestion from Chat-GPT, I attempted changes to the plugin code to fix the error. While this removed the error message, it caused all blocks to break and display incorrectly.
  4. Checked for other changes: No changes to themes or other plugins have been made that could have affected the BlockArts plugin.

Has anyone encountered a similar issue with this plugin? What might be causing this fatal error, and how can I resolve it without losing access to the content created with BlockArts Block?

Any guidance or suggestions on how to fix this would be greatly appreciated.

Thanks in advance for your help!

Initialization error Could not load : oci.dll error in Oracle PHP Generator Professional

I have Oracle PHP Generator Professional licensed version and facing the issue as below

Initialization error Could not load
“E:OracleDatabaseOrclproduct12.1.0dbhome_1binoci.dll”
OracleHomeKey:
OracleHomeDir: E:Oracle DatabaseOrclproduct12.1.0dbhome_1 Found: oci.dll
Using: E:OracleDatabaseOrclproduct12.1.0dbhome_1binoci.dll
LoadLibrary(E:Oracle DatabaseOrclproduct12.1.0dbhome_1binoci.dll) returned 0

enter image description here

I have Oracle 12C is installed on my system

Why am I getting ‘Failed to decode QR code: An error occurred while processing some image(s)’ in PHP with ImageMagick?

I am working on a PHP application that involves decoding QR codes using ImageMagick. However, I encountered the following error in my logs:

{"logtime":"2024-12-04 14:19:45.955","message":"Processing file: Image_001.jpg","context":[],"level":200,"level_name":"INFO","channel":"local","datetime":{"date":"2024-12-04 14:19:45.955052","timezone_type":3,"timezone":"Asia/Jakarta"},"extra":{"ip":"NB-ANDY","ipserver":"NB-ANDY"}}
{"logtime":"2024-12-04 14:19:48.191","message":"Failed to decode QR code: An error occurred while processing some image(s). This includes bad arguments, I/O errors and image handling errors from ImageMagick.","context":[],"level":400,"level_name":"ERROR","channel":"local","datetime":{"date":"2024-12-04 14:19:48.191321","timezone_type":3,"timezone":"Asia/Jakarta"},"extra":{"ip":"NB-ANDY","ipserver":"NB-ANDY"}}
{"logtime":"2024-12-04 14:19:48.192","message":"QR code not detected for file: Image_001.jpg","context":[],"level":400,"level_name":"ERROR","channel":"local","datetime":{"date":"2024-12-04 14:19:48.192000","timezone_type":3,"timezone":"Asia/Jakarta"},"extra":{"ip":"NB-ANDY","ipserver":"NB-ANDY"}}

This is My Code:

    private function readQrCode($fileContents)
    {
        $image = Image::make($fileContents)
            ->resize(1200, null, function ($constraint) {
                $constraint->aspectRatio();
                $constraint->upsize();
            })
            ->contrast(15)
            ->brightness(20)
            ->sharpen(10);
            
            if (!$image->width() || !$image->height()) {
                Log::error("Invalid image: cannot read dimensions.");
                return null;
            }
    
        $format = $image->mime();
        $extension = str_replace('image/', '', $format);
    
        if ($extension === 'jpeg' || $extension === 'jpg') {
            $extension = 'jpg';
        } elseif ($extension === 'png') {
            $extension = 'png';
        }
    
        $tempFile = tempnam(sys_get_temp_dir(), 'qr') . '.' . $extension;
        file_put_contents($tempFile, $image->encode($extension, 90));
    
        try {
            $QRCodeReader = new Zbar($tempFile);
            $qrcodeText = $QRCodeReader->scan();
            unlink($tempFile);
    
            preg_match('/Contract No. ?: ?(d+)/i', $qrcodeText, $leaseMatches);
            preg_match('/DocumentTypeIds*:s*(w+)/i', $qrcodeText, $docTypeMatches);
            preg_match('/Customer Names*:s*(.+)/i', $qrcodeText, $customerNameMatches);
            preg_match('/Document Types*:s*.+s*-s*(.+)/i', $qrcodeText, $receiverNameMatches);
            preg_match('/Document Types*:s*([^-]+)/i', $qrcodeText, $docTypeNameMatches);
    
            return [
                'lease_no' => $leaseMatches[1] ?? null,
                'document_type_id' => $docTypeMatches[1] ?? null,
                'document_type_name' => $docTypeNameMatches[1] ?? null,
                'customer_name' => $customerNameMatches[1] ?? null,
                'receiver_name' => $receiverNameMatches[1] ?? null,
                'extension' => $extension,
            ];
        } catch (Exception $e) {
            unlink($tempFile);
            Log::error("Failed to decode QR code: " . $e->getMessage());
            return null;
        }
    }     

Here’s what I’ve tried so far:

  1. Ensured that the ImageMagick extension is installed and enabled in my PHP environment.

  2. Verified that the input images are valid and not corrupted.

  3. Checked the permissions of the image file to make sure it’s accessible.

My Environment:

  • PHP Version: 7.2

  • ImageMagick Version: ImageMagick 7.1.1-41 Q16 x86 bbdcbf7:20241116 https://imagemagick.org

  • Operating System: Windows 10, Win32

  • Additional Libraries: ZBar for QR code reading

What could be causing this error, and how can I debug or resolve it? Is this an issue with:

  • ImageMagick configuration?

  • QR code library (e.g., ZBar)?

  • The input image?

Any insights or suggestions would be greatly appreciated!

How to prevent HTMLPurifier from sanitizing the inline style attribute?

I’m using HTMLPurifier to sanitize HTML, but I want to prevent any changes to the inline style attribute. Specifically, I don’t want HTMLPurifier to modify or sanitize the values of the style attribute while purifying the HTML.

Here’s a sample code:

require_once 'ezyang/htmlpurifier/library/HTMLPurifier.auto.php';
$config = HTMLPurifier_Config::createDefault();
$purifier = new HTMLPurifier($config);
$dirty_html = '<div style="background-color: rgb(240, 240, 240);"> How configure HTMLPurifier to prevent sanitize of Inline-style Attribute ? </div>';
// I want to prevent any change done by purify on style Attribute values
$clean_html = $purifier->purify($dirty_html);

// But in $clean_html div style value becomes: style="background-color:rgb(0,240,240);"
echo $clean_html;

enter image description here

How can I configure HTMLPurifier to skip sanitizing the style attribute ?

Google analytics not assigning to traffic acquisition

I’m facing a problem with custom events sent to Google Analytics. The main problem is that custom sent events are being assigned only to user acquisition and not to traffic acquisition.

I’m sending 2 custom events.

1st event starts the session:

{
    "client_id": "435384.2118427612",
    "events": [
        {
            "name": "session_start_test",
            "params": {
                "session_id": 1733217977,
                "source": "Test source",
                "medium": "cpc",
                "session_number": 1
            },
            "timestamp_micros": 1733217976999990
        }
    ]
}

2nd event send source data:

{
    "client_id": "435384.2118427612",
    "events": [
        {
            "name": "custom_event_test",
            "params": {
                "session_id": 1733217977,
                "engagement_time_msec": 100,
                "title": "Test title",
                "country": "Estonia",
                "source": "Test source",
                "medium": "cpc",
                "campaign": "test",
                "campaign_source": "Test source",
                "campaign_medium": "cpc",
                "session_number": 2
            },
            "timestamp_micros": 1733217977000000
        }
    ],
    "user_properties": {
        "country": {
            "value": "Estonia"
        }
    }
}

Both events are sent to GA and can be seen inside realtime reporting.

The problem that both of these events still assign source/medium to user acquisition instead of traffic acquisition. I’ve also tried to send utm_source and utm_medium, but that did not work out. Any ideas where is the problem?

I’m sending both events with PHP curl, using Google Measurement Protocol API.

PHP PDO_SQLSRV – INSERT permission was denied on the object (but it works in SSMS on same credentials) [closed]

I’m facing this issue:

Fatal error: Uncaught PDOException: SQLSTATE[42000]: [Microsoft][ODBC Driver 18 for SQL Server][SQL Server]The INSERT permission was denied on the object ‘xxxxxxxxxx’, database ‘xxxxxxxxxx’, schema ‘dbo’. in /home/….

Error would be pretty straightforward except that I use this SQL Server account in SQL Server Management studio and I can do inserts there without problems. Moreover, I log on SA account via same PHP code and it is the same – this is why I figure this is not really permissions problem on SQL Server. Am I wrong?

Is there a setting in PDO like read only maybe? Or in SQL Server: “allow PHP connections” – this are just guesses.

How to Install Xapian in PHP 7.0

We were using PHP 5.6 and installed Xapian 1.2.24. It was working fine.
We upgraded to PHP 7.0 and the Xapian is not working.

Any help?

We are getting the following error.

PHP Fatal error: UNHANDLED EXCEPTION! Error: Call to undefined function new_Database() in /usr/share/php/xapian.php:2100

delhivery api integration with laravel botble cms website

I’m trying to integrate the Delhivery API into my application, but I’m facing multiple issues. Here’s what I’ve attempted so far:

Webhook Integration: I followed Delhivery’s documentation for webhook integration, but it failed to establish a proper connection or trigger responses. I double-checked the URL and payload structure, but no luck.

Manual Integration: I tried using cURL and Postman for manual requests. The API returns a response, but it’s either inconsistent or gives errors like 401 Unauthorized or 500 Internal Server Error, despite using the correct API key and headers.

ZIP File Integration: I found a sample ZIP file for the API, which supposedly includes all the necessary files for a working integration. However, after extracting and following the instructions, I encountered various errors such as missing dependencies, incorrect routes, and authentication failures.

Has anyone successfully integrated the Delhivery API? Any guidance on troubleshooting integration or using the ZIP file method would be appreciated. Please share any working examples, best practices, or tips.

Google run altering a request payload in very strange way

I’m experiencing a strange issue where my JSON payload is being distorted when deployed on Google Cloud Run, but the same code works perfectly fine on Heroku and localhost. I’m using Laravel 11 and PHP. Here’s what my payload looks like before and after the distortion:

[
    {
        "id": "15758",
        "product_price": "5"
    }
]

To this

{
    "0": {
        "id": "15758",
        "product_price": "5"
    },
    "q": "/v1/products/variants" // this is strangely added by google, it is the URL of the request endpoint
}

Strangely google run adds a key “q” with the url of the request endpoint.

How can I display client single data and not duplicate them

Please how can I display client single data and not duplicate them. As you can see on the result it duplicate each client twice.

When I run the code this is what I get

enter image description here

This is what I want

enter image description here

This are MySQL tables

First table

enter image description here

Second table

enter image description here

This is my code

<?php
    require_once 'db_connect.php';
    $varCurDate = date("Y-m-d");
    $sqlabs = "SELECT * FROM tbl_absent HAVING (startDate = '$varCurDate' AND endDate > '$varCurDate')";
    $resultabs = mysqli_query($conn, $sqlabs);
    if (mysqli_num_rows($resultabs) > 0) {
        while ($rowabs = mysqli_fetch_assoc($resultabs)) {
            $varSpecialId = $rowabs["specialId"];
            $varUserName = $rowabs["userName"];
            $varStartDate = $rowabs["startDate"];
            $varEndDate = $rowabs["endDate"];


            $sql = "SELECT * FROM tbl_clients WHERE (specialId != '$varSpecialId') GROUP BY specialId";
            $result = mysqli_query($conn, $sql);
            while ($row = mysqli_fetch_assoc($result)) {
                echo "
                    <tr>
                        <td>" . $row["userId"] . "</td>
                        <td>" . $row["userName"] . "</td>
                        <td>" . $row["userEmail"] . "</td>
                        <td>" . $row["userPhone"] . "</td>
                        <td>" . $row["specialId"] . "</td>
                    </tr>
                    ";
            }
        }
    } else {
        echo "0 results";
    }
    mysqli_close($conn);
    ?>

How can I search for data if a template is specified in the database?

Are there templates like
abc????cba
or
??de??df
or any other combination.
But the user will enter the full line, for example, abc1234cba
, and the script needs to output all the lines where this combination exists, taking into account the templates.
Under the symbol ? any letter or number can be implied.

I’m doing it on WP, we’re looking for the ACF field
Have you tried this:


    $vin_regex = str_replace(array('0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'), '.', $vin_regex);

    
    $meta_query = array(
        array(
            'key' => 'vin',
            'value' => $vin_regex,
            'compare' => 'REGEXP', 
        ),
    );

    $args = array(
        'post_type' => 'product',
        'posts_per_page' => 10,
        'paged' => $paged,
        'meta_query' => $meta_query,
    );

    $query = new WP_Query($args);

It didn’t help

ave you tried this

    $query = "
        SELECT DISTINCT p.ID
        FROM {$wpdb->posts} p
        INNER JOIN {$wpdb->postmeta} pm ON p.ID = pm.post_id
        WHERE p.post_type = 'product'
          AND p.post_status = 'publish'
          AND pm.meta_key = 'vin'
          AND pm.meta_value LIKE REPLACE(%s, '?', '_')
        LIMIT 10 OFFSET %d
    ";

    $results = $wpdb->get_col($wpdb->prepare($query, $vin_input, $offset));

It didn’t help

How to make WP customize preview on multiple front page selection?

I have developed a theme with multiple page selection like Homepage1.php, homepage2.php, homepage3.php and more. But I have stuck on WordPress preview as page aren’t change dynamically on preview after selection.

The selection is saved well but doesn’t show up on preview by either refresh or postMessage transports, it only show up after reloaded whole page after being saved, below are codes that I have used for WP customization,

Selection page php fuction

function bansta_home_page() {
    if ( get_theme_mod( 'bansta_front_page') === 'home-default' ) {
        $bansta_home = 'default';
    } elseif ( get_theme_mod( 'bansta_front_page' ) === 'home-grid2') {
        $bansta_home = 'grid_2';
    } elseif ( get_theme_mod( 'bansta_front_page') === 'home-grid3' ) {
        $bansta_home = 'grid_3';
    } elseif ( get_theme_mod( 'bansta_front_page') === 'home-grid4' ) {
        $bansta_home = 'grid_4';
    } else {
        $bansta_home = 'default';
    }
    return $bansta_home;
}


$wp_customize->add_setting( 'bansta_front_page', array(
    'default'           =>  $bansta_defaults[ 'bansta_front_page' ],
    'capability'        =>  'edit_theme_options',
    'type'              =>  'theme_mod',
    'sanitize_callback' =>  'bansta_sanitize_select',
    'transport'         =>  'refresh'
));
$wp_customize->add_control( 'bansta_front_page', array(
    'label'             =>  __( 'Front Layout', 'bansta' ),
    'settings'          =>  'bansta_front_page',
    'section'           =>  'bansta_section_frontpage',
    'type'              =>  'select',
    'choices'           =>  array(
        'home-default'      =>  __( 'Default', 'bansta' ),
        'home-grid2'        =>  __( 'Grid-2', 'bansta' ),
    'home-grid3'        =>  __( 'Grid-3', 'bansta' ),
    'home-grid4'        =>  __( 'Grid-4', 'bansta' )
    )
));

scripts for preview

( function( $ ) {
    wp.customize( 'bansta_front_page', function( newval ) {
        newval.bind( function( to ) {
            $( '.content-wrapper' ).html( to );
        });
    });
}) ( jQuery );

index.php contain these codes for page selection;

$basta_home_layout = get_theme_mod( 'bansta_front_page', '' );
get_template_part( '/libs/front/home-' .$bansta_home );

As you can see I have multiple selection with multiple homepages such as home-defaut.php, home-grid2.php and so on, can someone help me to achieve this issue, what code did I miss????.

Laravel 11 – I want to create dynamic routing for multi level access but without passing the same parameter each time

In laravel 11 i setup my route like this :

      then: function(){
                Route::middleware(['web', 'admin'])->prefix('admin')->name('admin.')->group(base_path('routes/admin.php'));
                Route::middleware(['web', 'user'])->prefix('u/{userid?}')->name('user.')->group(base_path('routes/user.php'));
            },

but there is a problem when i want to each any route of user.php file: i need to add userid parameter each time

can i automate this process so the userid will automatically injected to the route

I don’t want to write this type of syntax each time :

<a href="{{ route("user.comment.create", Auth::id()) }}"></a>

I think laravel have the good approach for this : I want to use that approach !

anyone tell me the right way to do this…

How do i write more elegant code to search for an elements’ property in PHP?

I’m scraping a webpage for some metatags that look like this :

<meta property="og:phone_number" content="01234 567890">

They may or may not exist. I’ve created some code that works, but I don’t think it’s as elegant as it could be:

if ($html->find('meta[itemprop="phone_Number"]')) { $event["phone_number"]=$html->find('meta[property="og:phone_number"]',0)->getAttribute('content'); } 

I’d like to do this without the if, and when the phone_number metatag or the metatag property does not exist, just silently continue.