Click to See Complete Forum and Search --> : [RESOLVED] Source code of PHP's core classes


Ipsens
January 16th, 2008, 03:16 PM
I have intention to extend mysqli and mysqli_stmt core PHP's classe.

Before I start to do that I would like to to see source code of those 2 classes that are shipped bt PHP and are part of it's core.

How and where can I look at them? :confused:

PeejAvery
January 16th, 2008, 03:20 PM
Extend?

You can go to the Downloads section on the PHP website and check out their binaries and source code. Have fun searching through all that!

Ipsens
January 16th, 2008, 03:36 PM
Extend?

You can go to the Downloads section on the PHP website and check out their binaries and source code. Have fun searching through all that!

Yes to extend it in a regular way, like:

class my_mysqli extends mysqli
{
{...}
}


But first I would like to see a PHP source code of mysqli!
So I was thinking of web page that has PHP source code of mysqli class.

You know...

I hope that source isn't in non PHP code like C or anything similar..., because I won't understand it. :sick:

PeejAvery
January 16th, 2008, 04:23 PM
PHP was written in C.

Ipsens
January 16th, 2008, 05:39 PM
Ok, tell me then...
Where can I see a PHP code of mysqli class?

In a same way I would see PHP code of MDB2 class.
that I've downloaded from PEAR.

PeejAvery
January 16th, 2008, 10:27 PM
You will have to contact MySQL for that information. It was just sold to Sun for $1 billion. I don't even know if you can get the source for the mysqli extension itself.

Ipsens
January 16th, 2008, 10:52 PM
You will have to contact MySQL for that information. It was just sold to Sun for $1 billion. I don't even know if you can get the source for the mysqli extension itself.

What a... ?!? :eek:

Maybe you have a $1 billion to borrow? :wave:
So I could just see a php code of mysqli class. :o

Gosh! I can't believe it! :sick:

PeejAvery
January 16th, 2008, 11:57 PM
We are both confused. I meant MySQL (the open source company) was just sold to Sun (Java Systems) for $1 billion.

I was confused because I thought you wanted to see the C source code of the mysqli entension to PHP.

So all you want is to see a PHP class implementing mysqli?

Ipsens
January 17th, 2008, 09:52 AM
All I want to see is a PHP source code of mysqli class.
After I gain a knowledge of mysqli class, then I'll gona extend it like:

class my_cutomDB extends mysqli
{

{...lots of code here...}

}


Is all clear now?

PeejAvery
January 17th, 2008, 11:52 AM
Yes, I understand now. To view the actual source for the class, you are going to have to dig through php_mysqli.dll.

Ipsens
January 17th, 2008, 01:07 PM
Ok, I've found it in php\ext dir.
After I've opened it in text editor I've saw a lot of giberish data.

Any recomendation for app. that reads .dll files. :confused:


PS: I use windows for dev.

PeejAvery
January 17th, 2008, 01:46 PM
Haha. You tried to read a DLL with notepad. A DLL is a compiled library. You will have to read it with a hex editor or Resource Hacker (http://www.google.com/search?source=ig&hl=en&rlz=&q=resource+hacker&btnG=Google+Search).

Ipsens
January 17th, 2008, 02:01 PM
Yeah very funny! :p

Anyway I can see you know with dlls.
Can you throw an eye in there and post a PHP code of mysqli here?

PeejAvery
January 17th, 2008, 02:12 PM
Well, Resource Hacker only views the library information. You will have to read it with a hex editor. Then decode the hex. That is no easy, nor short process. It will take you days straight.

Ipsens
January 17th, 2008, 02:22 PM
What a ...?!? :mad:

That does it!

So much about "OPEN" source! :lol:

I'll use Reflection class instead. :sick:

Ipsens
January 17th, 2008, 10:12 PM
Ok I've ran this code:

echo '<pre>';
Reflection::export( new ReflectionClass('mysqli') );
echo '</pre>';


Now what bugs me is a fact that each method exist twice! :confused:
How could that be?

I am interested in prepare method, but there are 2 of them...

PeejAvery
January 18th, 2008, 08:27 AM
I don't have a clue. Perhaps you might want to report that to PHP bugs.

Ipsens
January 18th, 2008, 10:24 AM
Ok I will,

There is also missing __constructor for that class and it is crucial for extending this class.

Anyway, I've extended both mysqli and mysqli_stmt successfully. :cool: