php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #22045 Relative includes broken [Win32]
Submitted: 2003-02-04 09:28 UTC Modified: 2003-02-20 08:06 UTC
From: jensalfkersten at web dot de Assigned:
Status: No Feedback Package: Filesystem function related
PHP Version: 4.3.0 OS: WinME
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2003-02-04 09:28 UTC] jensalfkersten at web dot de
I' am sorry for my bad english, but I have a Problem with this Script.

function exec_sql_lines($sql_file, $old_string = '', $new_string = '') {
	
	$sql_query = isset($sql_query) ? $sql_query : "";
	
	if(!empty($sql_file) && $sql_file != "none") {
		$sql_query = fread(fopen($sql_file, "r"), filesize($sql_file));
		/* If magic_quotes_runtime is enabled, most functions that return data from any sort of external source 
		   including databases and text files will have quotes escaped with a backslash.
		*/
		if (get_magic_quotes_runtime() == 1) $sql_query = stripslashes($sql_query);
		/* replace old_string with new_string if they are set */
		if($old_string != '') {
			$sql_query = ereg_replace($old_string,$new_string,$sql_query);
		}
	}
	$sql_query = trim($sql_query);
	
	if($sql_query != "") {
		$sql_query   = remove_remarks($sql_query);
		$pieces      = split_sql_file($sql_query,";");
		$cnt_pieces  = count($pieces);
		/* run multiple queries */
		for ($i=0; $i<$cnt_pieces; $i++) {
			$sql = trim($pieces[$i]);
			if (!empty($sql) and $sql[0] != "#") $result = mysql_query($sql);
		}
	}
	return true;
}

My Provider changed the PHP-Verion to 4.3.0 and from this
time this Script dosn't work.

Is there a Bug, nobody can help me.

Thanx Alf

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-02-04 09:29 UTC] derick@php.net
Not enough information was provided for us to be able
to handle this bug. Please re-read the instructions at
http://bugs.php.net/how-to-report.php

If you can provide more information, feel free to add it
to this bug and change the status back to "Open".

Thank you for your interest in PHP.

 [2003-02-04 10:26 UTC] sniper@php.net
WHAT part of that script does not work?
Please provide a short and COMPLETE script which 
clearly shows the 'bug'. Most likely the problem
is not any bug anyway...

 [2003-02-04 11:47 UTC] jensalfkersten at web dot de
So I want to creat two new Tables with this funktionscript
__________________________________________________________
exec_sql_lines(SQL_LOGS,    "pphl_xxxxx_logs",    $tbl_prefix.$id.$tbl_logs);
	exec_sql_lines(SQL_MPDL,    "pphl_xxxxx_mpdl",    $tbl_prefix.$id.$tbl_mpdl);
__________________________________________________________

The Funktion 'exec_sql_lines' is 
__________________________________________________________
function exec_sql_lines($sql_file, $old_string = '', $new_string = '') {
	
	$sql_query = isset($sql_query) ? $sql_query : "";
	
	if(!empty($sql_file) && $sql_file != "none") {
		$sql_query = fread(fopen($sql_file, "r"), filesize($sql_file));
		/* If magic_quotes_runtime is enabled, most functions that return data from any sort of external source 
		   including databases and text files will have quotes escaped with a backslash.
		*/
		if (get_magic_quotes_runtime() == 1) $sql_query = stripslashes($sql_query);
		/* replace old_string with new_string if they are set */
		if($old_string != '') {
			$sql_query = ereg_replace($old_string,$new_string,$sql_query);
		}
	}
	$sql_query = trim($sql_query);
	
	if($sql_query != "") {
		$sql_query   = remove_remarks($sql_query);
		$pieces      = split_sql_file($sql_query,";");
		$cnt_pieces  = count($pieces);
		/* run multiple queries */
		for ($i=0; $i<$cnt_pieces; $i++) {
			$sql = trim($pieces[$i]);
			if (!empty($sql) and $sql[0] != "#") $result = mysql_query($sql);
		}
	}
	return true;
}
__________________________________________________________

It works before my provider changed the php-version
and i don't changed anything on the script but the tables dosn't creat and the script can't read it
when it dosn't exist.

I hope this information can help you to help me with my problem when not tell me what information do you need.

Thanx alf from germany
 [2003-02-04 11:51 UTC] jensalfkersten at web dot de
I will post you the error massage what i got :
___________________________________________________________

Warning: fopen(mysql/pphl_xxxxx_logs.sql) [function.fopen]: failed to create stream: No such file or directory in /usr/local/httpd/htdocs/kunden/web152/html/libraries/load_sql.lib.php on line 79

Warning: filesize() [function.filesize]: Stat failed for mysql/pphl_xxxxx_logs.sql (errno=2 - No such file or directory) in /usr/local/httpd/htdocs/kunden/web152/html/libraries/load_sql.lib.php on line 79

Warning: fread(): supplied argument is not a valid stream resource in /usr/local/httpd/htdocs/kunden/web152/html/libraries/load_sql.lib.php on line 79

Warning: fopen(mysql/pphl_xxxxx_mpdl.sql) [function.fopen]: failed to create stream: No such file or directory in /usr/local/httpd/htdocs/kunden/web152/html/libraries/load_sql.lib.php on line 79

Warning: filesize() [function.filesize]: Stat failed for mysql/pphl_xxxxx_mpdl.sql (errno=2 - No such file or directory) in /usr/local/httpd/htdocs/kunden/web152/html/libraries/load_sql.lib.php on line 79

Warning: fread(): supplied argument is not a valid stream resource in /usr/local/httpd/htdocs/kunden/web152/html/libraries/load_sql.lib.php on line 79

Warning: Cannot modify header information - headers already sent by (output started at /usr/local/httpd/htdocs/kunden/web152/html/libraries/load_sql.lib.php:79) in /usr/local/httpd/htdocs/kunden/web152/html/modules/usercreate.php on line 63
___________________________________________________________

Line 79 ist 
___________________________________________________________
$sql_query = fread(fopen($sql_file, "r"), filesize($sql_file));
___________________________________________________________

And that works before !

Thanx Alf
 [2003-02-13 03:32 UTC] wez@php.net
Change summary
 [2003-02-13 12:19 UTC] wez@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php4-STABLE-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php4-win32-STABLE-latest.zip

I've committed a potential fix for this problem today.
Please try the next STABLE snapshot and let us know.
 [2003-02-20 08:06 UTC] sniper@php.net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.


 
PHP Copyright © 2001-2017 The PHP Group
All rights reserved.
Last updated: Sun Nov 19 01:31:42 2017 UTC