/    Sign up×
Community /Pin to ProfileBookmark

type casting headache with ftp_chmod

I have an FTP wrapper for a GUI app run by a PHP script (too lazy to write a real FTP client with sockets). Because it’s just a wrapper all the variables are passed to the script as command line arguments. I noticed that ftp_chmod was failing and tried to simply give it the correct permission in the script (0755 say for example) and it worked. I conclude that the value from $env was a string and thus confused the function. I then attempted to type cast the variable $env[‘permissions’] to an integer but that also failed.

Basically the only way I could make the function work was by giving it the argument from inside the script: ftp_chmod($connection, 0755, $file) but the identical code ftp_chmod($connection, intval($env[‘permissions’]), $file) failed ?.

any ideas? I’m totally confused and find a work around. thanks in advance I appreciate your time.

to post a comment
PHP

0Be the first to comment 😎

×

Success!

Help @thealchemistgui spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.7,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...