D
D
dr1v32014-09-21 10:55:03
PHP
dr1v3, 2014-09-21 10:55:03

How to debug a cyclic page reload?

I am currently working on finalizing a self-written CMS (not by me), consisting of several hundred PHP files. In the code, constructions of the form "header('Location:....)" are abundant, both in PHP and in JS code. Under certain conditions, the site starts to cause a cyclic page reload (HTTP 302), after which the browser kills the page. It was not possible to debug manually, and since I have little experience with debuggers, I can’t quickly find a solution. Can you tell me how to solve the problem using Xdebug or similar tools?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
asd111, 2014-09-21
@dr1v3

As an option, go through the IDE search engine through all the header("Location... ) and place breakpoints before the header or on the header itself.
In phpstorm, it's done like this: open the folder in the ide via File> Open directory where all the project sources are located on the left, right-click click on the name of the upper folder and select Find in Path there we write header for the search. double click and ctrl+F8 bypass each match and put a breakpoint on the header itself or on some function call before the header.
In the same way, if there is a suspicion of javascript or other reasons, then you can try to comment out all the places with the header through the search engine. To do this, instead of Find in Path - Replace in Path, write header("Location in the line to replace / /header("Location and click Find then All files. Then you can also uncomment back. Thus, you can comment out all the header in all files in all folders that are in the folder that you opened via File> Open directory.
Everything is wrong with the debugger difficult as it seems - the main thing is to set up once, then you can set as many breakpoints as you want and enjoy what you can see the values ​​of variables without any <?

S
sasha, 2014-09-21
@madmages

CMS consisting of several hundred PHP files

you are not busy with that. CMS is written only by beginners to learn how to write code, or about dudes who know how and what to do. you don't look like a pro.
but on business.
xdebuger is a very handy thing, without it it's like without hands. I can't imagine how people live without it. and in a nutshell to describe how to work with it is not possible. you can study articles, for example here habrahabr.ru/post/209024

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question