logs archiveIRC Archive / Freenode / #php / 2015 / July / 18 / 1
saimon69
so sometihng else might not work
sorabji
doubt it
saimon69
actually found why
sorabji
\o/
saimon69
had a wrapper if that interfered
sorabji
...still say you should use an array or something
Sammitch
variable variables are GREAT... ways to break you application in un-debuggable ways and also open GAPING security holes in your application. :I
sorabji
^
but have fun :)
diegoviola
my coworker wants to be able to use a java lib in php
         

monodesigns
That sounds like a wonderful idea.
laszlof
diegoviola: tell him to write a web service and pull it into PHP
diegoviola
they don't know java
they found some php java bridge thing
I don't even know what it is
laszlof
that sounds like a terrible idea
and java isnt that difficult
presuming you're experienced in OOP
Happzz
http://codepad.org/FA5x06SL
why doesnt this output "
"hello" ?
i mean, i know $x is an object x().
sorabji
Happzz: constructors don't work like that
monodesigns
I don't think constructors return data.
Happzz
sorabji do i have to have another function that will return that output?
sorabji
they return the newly constructed object implicitly
Happzz: yes
theskillwithin2
sorabji its cuz i had some headder() set but I took it out and that fixed that error msg, still having problems tho
sorabji
what problems exactly the
theskillwithin2:
sweb
are `SessionHandlerInterface` methods `read` and `write` call for each process of php during session start ?
means `write` call when $_SESSION ? or on every request call ?
seems to be run on every calls :(
theskillwithin2
sorabji I keep getting what looks like empty output (at the bottom) http://pastie.org/10299004
idk why its giving me the length, but it says 0
klemax
which one is best way to learn php for begginers? deduction or induction?
theskillwithin2
I feel like if this is incorrect it culd be my problem $xpath->query("//Item/Items/SalesRank");
each slash is a <tag> right
jmauerhan
Is Item a direct child of ItemLookupResponse
if not, I think you need // not /
It looks like SalesRank is a child of Item, not Items. It's hard to read when it's all on one line instead of nested
theskillwithin2
jmauerhan $xpath->query("//Item/Items/SalesRank"); ?
genaside
is there a reject version of socket_accept()?
I guess i can accept it then close it quickly after....
jmauerhan
theskillwithin2: thats the path you have, but it looks like SalesRank is a child item of Item, not Items
can you post the XML nested so it's human readable?
Why would one Item have many Items?
theskillwithin2
yea
         

LindsayMac
I have a quick question. I'm reverse engineering some code and I see a private function that does define('CLIENT_ID', '876234863548'); and that 'CLIENT_ID' is used in another function outside of the private function's class.
theskillwithin2
LindsayMac
Are 'defines' different in variables in that once they are set they are set where ever?
theskillwithin2
oh oops i took out an extra " when editing out the sensative data so thats why it looks wierd
http://pastie.org/10299018
Blackskyliner
LindsayMac, define() are like global constants. when they get defined you can access all of them.
theskillwithin2
so the data I want is this 428017
LindsayMac
Blackskyliner: Ok i guess that makes sense. I thought that they would still only be accessable in that class ..
Blackskyliner
LindsayMac, http://php.net/manual/en/language.constants.php - Like superglobals, the scope of a constant is global. You can access constants anywhere in your script without regard to scope.
theskillwithin2
jmauerhan and my code again http://pastie.org/10299019 xml : http://pastie.org/10299018
LindsayMac
Blackskyliner: got it. thanks
Sammitch
lol @ using `define()` in a class, and in a private function no less.
LindsayMac
Sammitch: thats kind of where my mind was going
sorabji
theskillwithin2: it's Items/Item isn't it?
LindsayMac
Sammitch: like, why make the class private if all it has are defines() in it?
Happy_the_Exceed
(Action) thinks the code LindsayMac has is obscured.
LindsayMac
Happy_the_Exceed: what do you mean?
theskillwithin2
omg Items/Item
how could i miss it
Sammitch
the best part is that if that function is run a second time the constant it defines will not change, because that's not how constants work.
LindsayMac
Sammitch: well that is kind of the point. The constants defined in there are definitely never meant to change no matter how many times the class runs
Happy_the_Exceed
LindsayMac, some crap like this: https://bpaste.net/show/01dc1036f42c
LindsayMac
Happy_the_Exceed: not entirely sure what you're trying to say
Sammitch
fu*k IonCube with a rake
Happy_the_Exceed
That is what an obscure code looks like. Obfuscated.
Blackskyliner
Sammitch, Include Zend Decoder in your rant please :D
LindsayMac
Happy_the_Exceed: right but what makes you think that the code i'm working with is Obfuscated?
Happy_the_Exceed
LindsayMac, random appearing digits for client id: define('CLIENT_ID', '876234863548');
Blackskyliner
LindsayMac, Because you said reverse engineered I guess
Happy_the_Exceed
That too.
LindsayMac
Happy_the_Exceed: I made that up just to give an idea of what i'm working with!
Happy_the_Exceed
Reverse engineer.
LindsayMac
its not I am just reverse engineering some plugin from another developer to rebuild it and learn a bit while doing so.
Blackskyliner
you are reading some plugin code, you want to say?
LindsayMac
Pulling it apart and rebuilding things is typically how I learn programming.
Sammitch
we can rebuild it, we have the technology
LindsayMac
well no. I'm taking it apart (by reading it) and then rebuilding it
Blackskyliner
Sammitch, It won't work without the flux compensator!
LindsayMac
Looking at the code to see what does what and how it works and then rebuilding it with a few new features and updated code for php5
Sammitch
(Action) reports budget surplus of $3mil over the original 6
Happy_the_Exceed
(Action) wonders if LindsayMac pasted a link to the code.
LindsayMac
No i did not because I didnt have to.
it wasn't necessary to get the answer from my question.
I am just trying to understand why someone would put a bunch of define()s inside of a private function
I am not that strong at OOP yet and wanting to understand how and why this was built the way it was
Happy_the_Exceed
Someone coming from a different language may've thought the constants weren't global.
LindsayMac
Ok so there's no real reason anyone would do that that is practical
Happy_the_Exceed
They are global. It would be as silly as "Creating a global function inside of a global function".
Sammitch
LindsayMac: hold on let me get something to hit you over the head with, then you'll be thinking like whoever wrote that. :P
LindsayMac
This is why I ask these things because I couldnt find an answer and didn't want to just go along with what the original dev did.
Happy_the_Exceed
Since the function on the inside is accessible from anywhere, and it's not "in a scope". Well it's in the Global Scope. But not function scope :)
Okay. :)
« prev 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 next »