Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

153
Views
Zend Framework's JsPush adapter only refreshing progress once the PHP script is finished

Since we switched a project from PHP 5 to 7.4, something odd is happening, although I doubt it's a PHP thing, but please hear me out first.

The HTML/PHP project uses the Zend_ProgressBar_Adapter_JsPush class of the Zend Framework.

There's an HTML button on screen. Once it's clicked, a PHP script is running in the background and calling the update method of the Zend_ProgressBar class. After each step the PHP script does/finishes, the value goes up by +20, until 100 is reached.

There is also an HTML table. 2nd column showing a load-icon before the results of each step coming in. There are 5 rows in that table, so one row for each step.

Now here's the situation: During the times of PHP5 when the PHP script was running, the user could see which step the PHP script has reached/finished so far, but now with PHP7.4 in use, ALL fields are getting updated once the PHP script is finished. They are shown correctly, but the problem is that it doesn't refresh step by step anymore.

It's like everything is getting queued in the background or something, and JavaScript doesn't get the chance to update any fields "live", so it does it at the end of the PHP script.

I got no clue what the reason is. I even tried to add sleep(5) between these steps, and I saw it was working. But why letting the user wait 5 times 5 seconds if there could be a better solution?

Here's the (light version) of the PHP code:

$adapter = new Zend_ProgressBar_Adapter_JsPush();
$adapter->setUpdateMethodName('Zend_ProgressBar_Update');
$adapter->setFinishMethodName('Zend_ProgressBar_Finish');

$progress = new Zend_ProgressBar($adapter, 0, 100);
$result = "";
$progress->update(0, $result);
// Do something...
$progress->update(20, $result);
// [...]
$progress->update(100, $result);

JavaScript methods:

function Zend_ProgressBar_Update(data)
{
    switch (data.current) {
        case 0:
        /* Reset progress table */
        /* [...] */
        break;
    case 20:
        /* Fill first row column of table with data.text */
        /* [...] */
        break;
    /* [...] */
    case 100:
        /* Fill final row column of table with data.text */
        /* [...] */
        break;
    default:
        //alert('default');
        break;
}

function Zend_ProgressBar_Finish()
{
    alert('Finished');
}
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!