php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #42934 Include (string)
Submitted: 2007-10-11 21:18 UTC Modified: 2007-10-11 23:21 UTC
From: donato dot f at tiscali dot it Assigned:
Status: Not a bug Package: Feature/Change Request
PHP Version: 4.4.7 OS: Linux
Private report: No CVE-ID: None
 [2007-10-11 21:18 UTC] donato dot f at tiscali dot it
Description:
------------
Scenario:
a database driven CMS, article contents are retrieved from the database and stored into a string variable.
The output is usually shown using "echo".
If the article contains some php code it is not executed, but printed on screen.
The alternative is to write the entire article as php code, retrieve it and then process it using "eval".
An even more complicated variant is to create a temporary file, containing both xHTML and php code, and then process it using "include".

It would be extremely useful to have a variant of the "include" function, that can take as input not just a file path, but a string variable, containing both xHTML and php code.



Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-10-11 23:21 UTC] johannes@php.net
That's already possible, check PHP Streams, especially data: but keep the allow_url_include security flag in mind. But I don't see a benefit over eval in your example.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Mon Dec 29 22:00:01 2025 UTC