1<?php
2
3namespace App\Repository;
4
5/**
6 * Repository class for returning "quick fix" reasons
7 * as if they had come from a database.
8 *
9 * As of July 2019, these are no longer stored in bugsdb,
10 * but are included as a hard-coded list.
11 */
12class ReasonRepository
13{
14    const REASONS = [
15		[
16            'id' => '4',
17            'name' => 'fixed',
18            'status' => 'Closed',
19            'title' => 'Fix committed',
20            'message' => 'The fix for this bug has been committed.
21If you are still experiencing this bug, try to check out latest source from https://github.com/php/php-src and re-test.
22Thank you for the report, and for helping us make PHP better.',
23            'project' => 'php',
24            'package_name' => '',
25            'webonly' => '0',
26        ], [
27            'id' => '5',
28            'name' => 'fixed',
29            'status' => 'Closed',
30            'title' => 'Fix committed',
31            'message' => 'The fix for this bug has been committed. Since the websites are not directly
32updated from the repository, the fix might need some time to spread
33across the globe to all mirror sites, including PHP.net itself.
34
35Thank you for the report, and for helping us make PHP.net better.',
36            'project' => 'php',
37            'package_name' => 'Website problem',
38            'webonly' => '0',
39        ], [
40            'id' => '6',
41            'name' => 'fixed',
42            'status' => 'Closed',
43            'title' => 'Fix committed',
44            'message' => 'This bug has been fixed in the documentation\'s XML sources. Since the
45online and downloadable versions of the documentation need some time
46to get updated, we would like to ask you to be a bit patient.
47
48Thank you for the report, and for helping us make our documentation better.',
49            'project' => 'php',
50            'package_name' => 'Documentation problem',
51            'webonly' => '0',
52        ], [
53            'id' => '7',
54            'name' => 'fixed',
55            'status' => 'Closed',
56            'title' => 'Fix committed',
57            'message' => 'This bug has been fixed in the documentation\'s XML sources. Since the
58online and downloadable versions of the documentation need some time
59to get updated, we would like to ask you to be a bit patient.
60
61Thank you for the report, and for helping us make our documentation better.',
62            'project' => 'php',
63            'package_name' => 'Translation problem',
64            'webonly' => '0',
65        ], [
66            'id' => '8',
67            'name' => 'fixed',
68            'status' => 'Closed',
69            'title' => 'Fix committed',
70            'message' => 'The fix for this bug has been committed. Since the websites are not directly
71updated from the repository, the fix might need some time to spread
72across the globe to all mirror sites, including PHP.net itself.
73
74Thank you for the report, and for helping us make PHP.net better.',
75            'project' => 'php',
76            'package_name' => 'Doc Build problem',
77            'webonly' => '0',
78        ], [
79            'id' => '9',
80            'name' => 'fixed',
81            'status' => 'Closed',
82            'title' => 'Fix committed',
83            'message' => 'This bug has been fixed and the fix has been committed. It should show up online in an
84hour or three.
85
86Thank you for the report, and for helping us make PHP.net better.',
87            'project' => 'php',
88            'package_name' => 'Online Doc Editor problem',
89            'webonly' => '0',
90        ], [
91            'id' => '10',
92            'name' => 'fixed',
93            'status' => 'Closed',
94            'title' => 'Fix committed',
95            'message' => 'The fix for this bug has been committed. Since the PHP Documentation Tools website
96is updated from the repository at a regular interval, the fix might need
97some time to take effect.
98
99Thank you for the report, and for helping us make DocWeb better.',
100            'project' => 'php',
101            'package_name' => 'DocWeb problem',
102            'webonly' => '0',
103        ], [
104            'id' => '12',
105            'name' => 'alreadyfixed',
106            'status' => 'Closed',
107            'title' => 'Fixed in release',
108            'message' => 'Thank you for your bug report. This issue has already been fixed
109in the latest released version of PHP, which you can download at
110http://www.php.net/downloads.php',
111            'project' => 'php',
112            'package_name' => '',
113            'webonly' => '0',
114        ], [
115            'id' => '13',
116            'name' => 'needtrace',
117            'status' => 'Feedback',
118            'title' => 'Need backtrace',
119            'message' => 'Thank you for this bug report. To properly diagnose the problem, we
120need a backtrace to see what is happening behind the scenes. To
121find out how to generate a backtrace, please read
122http://bugs.php.net/bugs-generating-backtrace.php for *NIX and
123http://bugs.php.net/bugs-generating-backtrace-win32.php for Win32
124
125Once you have generated a backtrace, please submit it to this bug
126report and change the status back to "Open". Thank you for helping
127us make PHP better.',
128            'project' => 'php',
129            'package_name' => '',
130            'webonly' => '0',
131        ], [
132            'id' => '14',
133            'name' => 'needscript',
134            'status' => 'Feedback',
135            'title' => 'Need Reproduce Script',
136            'message' => 'Thank you for this bug report. To properly diagnose the problem, we
137need a short but complete example script to be able to reproduce
138this bug ourselves.
139
140A proper reproducing script starts with <?php and ends with ?>,
141is max. 10-20 lines long and does not require any external
142resources such as databases, etc. If the script requires a
143database to demonstrate the issue, please make sure it creates
144all necessary tables, stored procedures etc.
145
146Please avoid embedding huge scripts into the report.',
147            'project' => 'php',
148            'package_name' => '',
149            'webonly' => '0',
150        ], [
151            'id' => '15',
152            'name' => 'oldversion',
153            'status' => 'Not a bug',
154            'title' => 'Try newer version',
155            'message' => 'Thank you for taking the time to report a problem with PHP.
156Unfortunately you are not using a current version of PHP --
157the problem might already be fixed. Please download a new
158PHP version from http://www.php.net/downloads.php
159
160If you are able to reproduce the bug with one of the latest
161versions of PHP, please change the PHP version on this bug report
162to the version you tested and change the status back to "Open".
163Again, thank you for your continued support of PHP.',
164            'project' => 'php',
165            'package_name' => '',
166            'webonly' => '0',
167        ], [
168            'id' => '16',
169            'name' => 'support',
170            'status' => 'Not a bug',
171            'title' => 'Not developer issue',
172            'message' => 'Sorry, but your problem does not imply a bug in PHP itself.  For a
173list of more appropriate places to ask for help using PHP, please
174visit http://www.php.net/support.php as this bug system is not the
175appropriate forum for asking support questions.  Due to the volume
176of reports we can not explain in detail here why your report is not
177a bug.  The support channels will be able to provide an explanation
178for you.
179
180Thank you for your interest in PHP.',
181            'project' => 'php',
182            'package_name' => '',
183            'webonly' => '0',
184        ], [
185            'id' => '17',
186            'name' => 'nofeedback',
187            'status' => 'No Feedback',
188            'title' => 'No feedback',
189            'message' => 'No feedback was provided. The bug is being suspended because
190we assume that you are no longer experiencing the problem.
191If this is not the case and you are able to provide the
192information that was requested earlier, please do so and
193change the status of the bug back to "Re-Opened". Thank you.',
194            'project' => 'php',
195            'package_name' => '',
196            'webonly' => '1',
197        ], [
198            'id' => '18',
199            'name' => 'notwrong',
200            'status' => 'Not a bug',
201            'title' => 'Expected behavior',
202            'message' => 'Thank you for taking the time to write to us, but this is not
203a bug. Please double-check the documentation available at
204http://www.php.net/manual/ and the instructions on how to report
205a bug at http://bugs.php.net/how-to-report.php',
206            'project' => 'php',
207            'package_name' => '',
208            'webonly' => '0',
209        ], [
210            'id' => '19',
211            'name' => 'notenoughinfo',
212            'status' => 'Feedback',
213            'title' => 'Not enough info',
214            'message' => 'Not enough information was provided for us to be able
215to handle this bug. Please re-read the instructions at
216http://bugs.php.net/how-to-report.php
217
218If you can provide more information, feel free to add it
219to this bug and change the status back to "Open".
220
221Thank you for your interest in PHP.',
222            'project' => 'php',
223            'package_name' => '',
224            'webonly' => '0',
225        ], [
226            'id' => '20',
227            'name' => 'submittedtwice',
228            'status' => 'Not a bug',
229            'title' => 'Submitted twice',
230            'message' => 'Please do not submit the same bug more than once. An existing
231bug report already describes this very problem. Even if you feel
232that your issue is somewhat different, the resolution is likely
233to be the same.
234
235Thank you for your interest in PHP.',
236            'project' => 'php',
237            'package_name' => '',
238            'webonly' => '0',
239        ], [
240            'id' => '21',
241            'name' => 'globals',
242            'status' => 'Not a bug',
243            'title' => 'register_globals',
244            'message' => 'In PHP 4.2.0, the \'register_globals\' setting default changed to
245\'off\'. See http://www.php.net/release_4_2_0.php for more info.
246We are sorry about the inconvenience, but this change was a necessary
247part of our efforts to make PHP scripting more secure and portable.',
248            'project' => 'php',
249            'package_name' => '',
250            'webonly' => '0',
251        ], [
252            'id' => '22',
253            'name' => 'phptooold',
254            'status' => 'Wont fix',
255            'title' => 'PHP version support discontinued',
256            'message' => 'The version of PHP you are reporting on is no longer supported.
257Please download a new PHP version from http://www.php.net/downloads.php
258
259If you are able to reproduce the bug with one of the latest
260versions of PHP, please change the PHP version on this bug report
261to the version you tested and change the status back to "Open".
262Again, thank you for your continued support of PHP.
263',
264            'project' => 'php',
265            'package_name' => '',
266            'webonly' => '0',
267        ], [
268            'id' => '23',
269            'name' => 'dst',
270            'status' => 'Not a bug',
271            'title' => 'Daylight Savings',
272            'message' => 'We are happy to tell you that you just discovered Daylight Savings
273Time. For more information see:
274http://webexhibits.org/daylightsaving/b.html
275Instead of using mktime/date consider using gmmktime and gmdate which do
276not suffer from DST.',
277            'project' => 'php',
278            'package_name' => '',
279            'webonly' => '0',
280        ], [
281            'id' => '24',
282            'name' => 'isapi',
283            'status' => 'Not a bug',
284            'title' => 'IIS Stability',
285            'message' => 'We are aware of PHP\'s problems with stability under IIS and are working
286to rectify the problem. Unfortunatly your bug report does not contain any
287extra useful information and we already have enough bug reports open about
288this issue. If you can provide more detailed information such as a
289reproducable crash or a backtrace please do so and reopen this bug.
290Otherwise please keep trying new releases as we are working to resolve
291the problems on this platform
292
293Thanks for your interest in PHP.',
294            'project' => 'php',
295            'package_name' => '',
296            'webonly' => '0',
297        ], [
298            'id' => '25',
299            'name' => 'gnused',
300            'status' => 'Not a bug',
301            'title' => 'Install GNU Sed',
302            'message' => 'Due to a bug in the installed sed on your system the build
303fails. Install GNU sed and it should be okay.
304
305Thank you for your interest in PHP.',
306            'project' => 'php',
307            'package_name' => '',
308            'webonly' => '0',
309        ], [
310            'id' => '26',
311            'name' => 'float',
312            'status' => 'Not a bug',
313            'title' => 'Floating point limitations',
314            'message' => 'Floating point values have a limited precision. Hence a value might
315not have the same string representation after any processing. That also
316includes writing a floating point value in your script and directly
317printing it without any mathematical operations.
318
319If you would like to know more about "floats" and what IEEE
320754 is, read this:
321http://www.floating-point-gui.de/
322
323Thank you for your interest in PHP.',
324            'project' => 'php',
325            'package_name' => '',
326            'webonly' => '0',
327        ], [
328            'id' => '27',
329            'name' => 'nozend',
330            'status' => 'Not a bug',
331            'title' => 'No Zend Extensions',
332            'message' => 'Do not file bugs when you have Zend extensions (zend_extension=)
333loaded. Examples are Zend Optimizer, Zend Debugger, Turck MM Cache,
334APC, Xdebug and ionCube loader.  These extensions often modify engine
335behavior which is not related to PHP itself.',
336            'project' => 'php',
337            'package_name' => '',
338            'webonly' => '0',
339        ], [
340            'id' => '28',
341            'name' => 'mysqlcfg',
342            'status' => 'Not a bug',
343            'title' => 'MySQL Configuration Error',
344            'message' => 'When using the mysqli extension together with the mysql extension
345you have to use the same libraries and include files. mysqli
346extension requires the location of mysql_config file, mysql
347extension requires the path of your mysql installation.
348
349If you installed MySQL 4.1 for example with prefix /usr/local/mysql-4.1
350your configure settings should be
351--with-mysql=/usr/local/mysql-4.1
352--with-mysqli=/usr/local/mysql-4.1/bin/mysql_config',
353            'project' => 'php',
354            'package_name' => '',
355            'webonly' => '0',
356        ],
357    ];
358
359    /**
360     * Class constructor
361     */
362    public function __construct(\PDO $dbh)
363    {
364    }
365
366    /**
367     * Fetch bug resolves.
368     */
369    public function findByProject(string $project = ''): array
370    {
371        $reasons = self::REASONS;
372        if ($project !== '') {
373            $reasons = array_filter(
374                $reasons,
375                function ($reason) use ($project) {
376                    return ((($reason['project'] ?? '') === $project) ||
377                            (($reason['project'] ?? '') === ''));
378                });
379        }
380
381        $resolves = $variations = [];
382        foreach ($reasons as $row) {
383            if (!empty($row['package_name'])) {
384                $variations[$row['name']][$row['package_name']] = $row['message'];
385            } else {
386                $resolves[$row['name']] = $row;
387            }
388        }
389
390        return [$resolves, $variations];
391    }
392
393    /**
394     * @return array<int,array<string,mixed>>
395     */
396    public function findAll(): array
397    {
398        return self::REASONS;
399    }
400}
401