php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #31261 strange fix of old mysql LOAD DATA LOCAL INFILE issue
Submitted: 2004-12-22 23:41 UTC Modified: 2004-12-23 22:53 UTC
Votes:2
Avg. Score:5.0 ± 0.0
Reproduced:2 of 2 (100.0%)
Same Version:1 (50.0%)
Same OS:1 (50.0%)
From: dev at jkt dot wz dot cz Assigned:
Status: Not a bug Package: MySQL related
PHP Version: 4.3.10 OS: all
Private report: No CVE-ID: None
 [2004-12-22 23:41 UTC] dev at jkt dot wz dot cz
Description:
------------
Hi, sorry for creating another useless bugreport, but I haven't ability to comment bugs in CLOSED state.

[Considering bug reports #23779 and #28632 and mainly lines 601-604 in ext/mysql/php_mysql.c]

/* disable local infile option for open_basedir */
if (PG(open_basedir) && strlen(PG(open_basedir)) && (client_flags & CLIENT_LOCAL_FILES)) {
	client_flags ^= CLIENT_LOCAL_FILES;
}

Are you, PHP developers, sure that the approach "So, let's check bit 7. Oh, it is set, uhm, so, let's read it, make a negation and the write it back" the best way? Shouldn't be better (and also more elegant, faster,...) to write something like:

if (PG(open_basedir) && strlen(open_basedir)) {
	client_flags &= ~CLIENT_LOCAL_FILES;
}


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-12-23 19:06 UTC] iliaa@php.net
This is a non issue, the code avoids touching the mask if there is nothing to change in it.
 [2004-12-23 22:53 UTC] dev at jkt dot wz dot cz
I know that your code works, but there is other solution which is more readable, more elegant, faster and more C-like IMHO.
Of course you can write your code, say, without indentation, and it *will* compile and work (the compilation time could be even a bit faster due to reduced preprocessor overhead), but most of people simply don't do it as it is considered "bad programming style".
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Dec 13 09:01:28 2024 UTC