Doc #80149 [NEW]: Mutually included files

From: Date: Fri, 25 Sep 2020 12:55:36 +0000
Subject: Doc #80149 [NEW]: Mutually included files
Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-17905@lists.php.net to get a copy of this message
From:             marcio dot a dot siena at gmail dot com
Operating system: 
PHP version:      Irrelevant
Package:          Documentation problem
Bug Type:         Documentation Problem
Bug description:Mutually included files

Description:
------------
The documentation does not talk about mutually included/required files.

Mutually included/required files: a.php requires (once) b.php, and b.php
requires (once) a.php.

a.php is the "master" file. b.php is the included file. But what if
b.php needs to re-include a.php?

Use case: legacy application being refactored, tons of cases. HTTP
requests may come to a.php or to b.php, but both scripts depends upon
each other.

When that occurs, as one may expected, a.php includes b.php, but the
require_once in b.php does not re-include a.php.

But that behavior is not explicitly stated in the relevant documentation
pages:

- https://www.php.net/manual/en/function.require-once.php
- https://www.php.net/manual/en/function.include-once.php

So one must make tests to be sure about PHP's true behavior.

My proposition: state that behavior clearly in the docs.


Test script:
---------------
- in a.php: require_once('b.php');

- in b.php: require_once('a.php');



-- 
Edit bug report at https://bugs.php.net/bug.php?id=80149&edit=1
-- 
Fix committed:                    https://bugs.php.net/fix.php?id=80149&r=fixed
Fixed in release:                 https://bugs.php.net/fix.php?id=80149&r=alreadyfixed
Need backtrace:                   https://bugs.php.net/fix.php?id=80149&r=needtrace
Need Reproduce Script:            https://bugs.php.net/fix.php?id=80149&r=needscript
Try newer version:                https://bugs.php.net/fix.php?id=80149&r=oldversion
Not developer issue:              https://bugs.php.net/fix.php?id=80149&r=support
Expected behavior:                https://bugs.php.net/fix.php?id=80149&r=notwrong
Not enough info:                  https://bugs.php.net/fix.php?id=80149&r=notenoughinfo
Submitted twice:                  https://bugs.php.net/fix.php?id=80149&r=submittedtwice
register_globals:                 https://bugs.php.net/fix.php?id=80149&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=80149&r=phptooold
Daylight Savings:                 https://bugs.php.net/fix.php?id=80149&r=dst
IIS Stability:                    https://bugs.php.net/fix.php?id=80149&r=isapi
Install GNU Sed:                  https://bugs.php.net/fix.php?id=80149&r=gnused
Floating point limitations:       https://bugs.php.net/fix.php?id=80149&r=float
No Zend Extensions:               https://bugs.php.net/fix.php?id=80149&r=nozend
MySQL Configuration Error:        https://bugs.php.net/fix.php?id=80149&r=mysqlcfg


Thread (10 messages)

« previous php.doc.bugs (#17905) next »