Erg. Starting in the past few days high tweet IDs (at least, it appears it's ID related, but I suppose it could be some recent change in the api returns) are breaking my code. At first I tried passing the ID as a string instead of an integer to this function, and I thought this worked, but in reality it was just the process of uploading the file from my end.
In short, a php script generates these function calls, and when it does so, they fail. If I download the php file the call is generated into, delete the server copy and re-upload the exact same file without changing it, it works fine. Does anyone know what could be causing this behavior?
Below is what I suspect to be the most important part of the individual files that are pulling the errors. Each of the files is named for a status ID (e.g. the below file is named 12058543656.php)
<?php
require "singlePost.php";
SinglePost(12058543656)
?>
Here's the code that writes the above files:
$postFileName = $single_post_id.".php";
if(!file_exists($postFileName)){
$created_at_full = date("l, F jS, Y", strtotime($postRow[postdate])-(18000));
$postFileHandle = fopen($postFileName, 'w+');
fwrite($postFileHandle, '<html>
<head>
<title><?php $thisTITLE = "escarp | A brief poem or short story by '.$authorname.' on '.$created_at_full.'"; echo $thisTITLE;?></title><META NAME="Description" CONTENT="This brief poem or short story, by '.$authorname.', was published on '.$created_at_full.'">
<?php include("head.php");?>
To receive other poems or short stories like this one from <a href=http://twitter.com/escarp>escarp</a> on your cellphone, <a href=http://twitter.com/signup>create</a> and/or <a href=http://twitter.com/devices>associate</a> a Twitter account with your cellphone</a>, follow <a href=http://twitter.com/escarp>us</a>, and turn device updates on.
<pre><?php
require "singlePost.php";
SinglePost("'.$single_post_id.'")
?>
</div></div></pre><?php include("foot.php");?>
</body>
</html>');
fclose($postFileHandle);}
$postcounter++;
}
I can post more if you don't see anything here, but there are several files involved and I'm trying to avoid dumping tons of irrelevant code.
Error:
Warning: include(head.php) [function.include]: failed to open stream: No such file or directory in /f2/escarp/public/12177797583.php on line 4 Warning: include(head.php) [function.include]: failed to open stream: No such file or directory in /f2/escarp/public/12177797583.php on line 4
Warning: include() [function.include]: Failed opening 'head.php' for inclusion (include_path='.:/nfsn/apps/php5/lib/php/:/nfsn/apps/php/lib/php/') in /f2/escarp/public/12177797583.php on line 4 To receive other poems or short stories like this one from escarp on your cellphone, create and/or associate a Twitter account with your cellphone, follow us, and turn device updates on.
Warning: require(singlePost.php) [function.require]: failed to open stream: No such file or directory in /f2/escarp/public/12177797583.php on line 7
Warning: require(singlePost.php) [function.require]: failed to open stream: No such file or directory in /f2/escarp/public/12177797583.php on line 7
Fatal error: require() [function.require]: Failed opening required 'singlePost.php' (include_path='.:/nfsn/apps/php5/lib/php/:/nfsn/apps/php/lib/php/') in /f2/escarp/public/12177797583.php on line 7
SinglePost()
<?php
function SinglePost($statusID) {
require "nicetime.php";
$db = sqlite_open("db.escarp");
$updates = sqlite_query($db, "SELECT * FROM posts WHERE postID = '$statusID'");
$row = sqlite_fetch_array($updates, SQLITE_ASSOC);
$id = $row[authorID];
$result = sqlite_query($db, "SELECT * FROM authors WHERE authorID = '$id'");
$row5 = sqlit开发者_JS百科e_fetch_array($result, SQLITE_ASSOC);
$created_at_full = date("l, F jS, Y", strtotime($row[postdate])-(18000));
$created_at = nicetime($row[postdate]);
if($row5[url]==""){
$authorurl = '';
}
else{
/*I'm omitting a few pages of output code and associated regex*/
return;
}
?>
I doubt the high ID values are causing your problem (at least, not data-type related).
When PHP detects an integer overflow, it automatically converts the value to a float to prevent it. Therefore you can (somewhat) represent big numbers without any problems.
That being said, please make sure that the full path to the file do not exceed path length limitations of your file system and that the number of files in your folder doesn't exceed limitations either (for example, 65534 entries is the max for NTFS partitions).
精彩评论