php-spx icon indicating copy to clipboard operation
php-spx copied to clipboard

Getting error TypeError: Cannot set properties of undefined (setting 'endEventIdx')

Open engcom-Hotel opened this issue 1 year ago • 7 comments

When we are running profiler on any page after some time we get this error;

TypeError: Cannot set properties of undefined (setting 'endEventIdx')

Image

Please fix it ASAP.

Thanks

engcom-Hotel avatar Jan 30 '25 14:01 engcom-Hotel

Please fix it ASAP.

I think there is something you don't understand about OSS

NoiseByNorthwest avatar Feb 02 '25 11:02 NoiseByNorthwest

Yes, please help in understanding the same. :-)

engcom-Hotel avatar Feb 04 '25 07:02 engcom-Hotel

frame is undefined in this case. You can see the code there: https://github.com/search?q=repo%3ANoiseByNorthwest%2Fphp-spx%20endEventIdx&type=code

That means in this case the array has no elements or an element with undefined as value (see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/pop), which can be easily checked.

Pullrequests are welcome @engcom-Hotel.

DanielRuf avatar Feb 15 '25 16:02 DanielRuf

I don't see what could cause this.stack.pop() to return undefined here except a corrupted report.

NoiseByNorthwest avatar Feb 16 '25 16:02 NoiseByNorthwest

@engcom-Hotel can you share a screenshot of all errors that appear in the browser console, when this happens?

DanielRuf avatar Feb 16 '25 17:02 DanielRuf

A see in this line https://github.com/NoiseByNorthwest/php-spx/blob/f44a010125d918d1c93104c93506b65d4cb14b0a/assets/web-ui/js/profileData.js#L1270 in my last profile, event[1] value is 0, and this gave me the error TypeError: Cannot set properties of undefined (setting 'endEventIdx'). So, Is event[1] = 0 a correct value for this? Because if so, you just need to change the line if (event[1]) to if (event[1] >= 0). If it's ok, I can make the change.

pthiers avatar Sep 05 '25 13:09 pthiers

If it's ok, I can make the change.

event[1] is an integer with 1 (call start) or 0 (call end) as possible values. So if event[1] is equal to 0 (call end) and this.stack is empty then the report is probably corrupted.

NoiseByNorthwest avatar Sep 05 '25 21:09 NoiseByNorthwest