@
@
@Twitt2017-09-26 20:35:13
PHP
@Twitt, 2017-09-26 20:35:13

How to look for an error in the largest projects?

Today I sat down for a huge project as an intern, they let me find the cause of the error. The thing is this:
A person drives into the search the words, say "Tires and tires", and the search for some reason finds results like "Computers and laptops" (despite the fact that these words are not related to each other in any way). This is all taken from Solr, the error is somewhere in the PHP code, most likely in some kind of if. The gravity of all this lies in the fact that the project is simply huge. I poked breakpoints, from one breakpoint it goes deep into one method, if you go further, it goes into another method, and this is mess, then bam and you see that somehow the value in the array turned out to be wrong. How to look for errors in healthy projects in general?

Answer the question

In order to leave comments, you need to log in

4 answer(s)
G
Griboks, 2017-09-26
@Griboks

There are three ways to detect faults: sequential block test, division test, and combination test.
The main advantage of the first method - sequential verification - is simplicity, because it is not required to allocate groups of blocks for testing and fault detection.
The advantage of the division method is to minimize the time spent, but the more difficult verification process. It is necessary to divide the entire project into separate blocks, and then in pairs into groups of blocks. Next, you should check the performance of the first half. If the failure occurs in it, you should check the first half of this half. Thus, it is necessary to descend to specific blocks (in your case, methods).
The essence of the method lies in the representation of individual blocks as black boxes, with a given input and a supposed output.
For your project, which I assume you are not familiar with, I would prefer the sequential fault detection method.

P
Philipp, 2017-09-27
@zoonman

First you need to install xdebug, xhprof and PHPStorm. This is a necessary set of tools to facilitate navigation. PHPStorm has a very handy debugger. You can see the call stack, etc. xhprof allows you to look at the overall picture of the execution of the entire project. Working with arrays is really hard, especially when "too smart" people start inventing do-it-yourself sorts and functions with lousy names.
You need to find what the Solr query is built with, for this, search for the Solr keyword. Next, find out what request goes to Solr and what comes back from it. If the Solr search results are ok, move on to how the data is rendered. If the output from Solr is erroneous, look for how the index is formed.

W
Weridy, 2017-09-26
@Weridy

Fucking category id as an option

T
tema_sun, 2017-09-27
@tema_sun

I would first make sure that the search index is built correctly.
But in general, if you are a trainee, then ask for help from experienced colleagues. Tell what you did and why, and let them show you on your fingers why you should have done it wrong.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question