[Phpmyadmin-devel] Any special reason that "require" but not "require _once" on libraries/common.inc.php

adam adamgsoc2013 at gmail.com
Fri May 17 16:30:03 CEST 2013

Hi Dieter,

>2013/5/16 adam <adamgsoc2013 at gmail.com>:
>> Hi,
>> Although I changed the "require" to "require _once" on libraries/common.inc.php
>> other redefine error still existed:
>> https://travis-ci.org/phpmyadmin/phpmyadmin/jobs/7223416
>> so I think to test the files which requires "libraries/common.inc.php", the problem will exist.
>> Any advice? thanks
>Using require_once, will only include the file if it wasn't included
>before, see [0].
>If you use require, it will include the file, regardless if it was
>included at another place or in another included file. If a function
>or class is defined in a file that was included before, you get the
>error that you mention.
>Because keeping track of where which files were included, is too
>complicated, using require_once is the best option.

I agree with you about that. But I don't know why the file libraries/common.inc.php use "require" but not "require _once". this file will be used frequently, so use "require _once" is better.
I was thinking that there must be some special reason.

thanks for your information.


More information about the Developers mailing list