jparise / php-python

Embedded Python Extension for PHP
http://pecl.php.net/package/python
MIT License
68 stars 16 forks source link

Add PHP 5.4.x Support #11

Open ym opened 11 years ago

ym commented 11 years ago

I've made some changes ... Now it can compile successfully with PHP 5.4.x

nickl- commented 11 years ago

@ym Tx for the work well done!!!

It works as advertised build succeeds against php 5.4.10 also works for 5.5.0alpha1 and still builds against php 5.3.20.

One snag though, tests are failing =(

=====================================================================
PHP         : …/5.4.10/bin/php 
PHP_SAPI    : cli
PHP_VERSION : 5.4.10
ZEND_VERSION: 2.4.0
PHP_OS      : Darwin - Darwin xxx.local 12.2.0 Darwin Kernel Version 12.2.0: Sat Aug 25 00:48:52 PDT 2012; root:xnu-2050.18.24~1/RELEASE_X86_64 x86_64
INI actual  : …/ext/php-python/tmp-php.ini
More .INIs  :  
CWD         : …/ext/php-python
Extra dirs  : 
VALGRIND    : Not used
=====================================================================
TIME START 2013-01-12 17:54:28
=====================================================================
FAIL Python: Convert Python types to PHP types [tests/convert_to_php.phpt] 
FAIL Python: foreach [tests/foreach.phpt] 
PASS Python: INI python.optimize [tests/ini_optimize.phpt] 
PASS Python: Object (count_elements) [tests/object_count_elements.phpt] 
PASS Python: Object (dimension_delete) [tests/object_dimension_delete.phpt] 
PASS Python: Object (dimension_exists) [tests/object_dimension_exists.phpt] 
FAIL Python: Object (get_properties) [tests/object_get_properties.phpt] 
FAIL Python: Object (property_exists) [tests/object_property_delete.phpt] 
FAIL Python: Object (property_exists) [tests/object_property_exists.phpt] 
PASS Python: Object (read_dimension) [tests/object_read_dimension.phpt] 
FAIL Python: Object (read_property) [tests/object_read_property.phpt] 
PASS Python: Object (write_dimension) [tests/object_write_dimension.phpt] 
FAIL Python: Object (write_property) [tests/object_write_property.phpt] 
PASS Python: php.call() [tests/php_call.phpt] 
PASS Python: php.var() [tests/php_var.phpt] 
PASS Python: php.version() [tests/php_version.phpt] 
FAIL Python: python_call() [tests/python_call.phpt] 
PASS Python: python_eval() [tests/python_eval.phpt] 
PASS Python: python_exec() [tests/python_exec.phpt] 
PASS Python: python_version() [tests/python_version.phpt] 
PASS Python: Default streams [tests/streams_default.phpt] 
PASS Python: Default streams [tests/streams_ob.phpt] 
=====================================================================
TIME END 2013-01-12 17:54:38

=====================================================================
TEST RESULT SUMMARY
---------------------------------------------------------------------
Exts skipped    :    0
Exts tested     :   58
---------------------------------------------------------------------

Number of tests :   22                22
Tests skipped   :    0 (  0.0%) --------
Tests warned    :    0 (  0.0%) (  0.0%)
Tests failed    :    8 ( 36.4%) ( 36.4%)
Expected fail   :    0 (  0.0%) (  0.0%)
Tests passed    :   14 ( 63.6%) ( 63.6%)
---------------------------------------------------------------------
Time taken      :   10 seconds
=====================================================================

=====================================================================
FAILED TEST SUMMARY
---------------------------------------------------------------------
Python: Convert Python types to PHP types [tests/convert_to_php.phpt]
Python: foreach [tests/foreach.phpt]
Python: Object (get_properties) [tests/object_get_properties.phpt]
Python: Object (property_exists) [tests/object_property_delete.phpt]
Python: Object (property_exists) [tests/object_property_exists.phpt]
Python: Object (read_property) [tests/object_read_property.phpt]
Python: Object (write_property) [tests/object_write_property.phpt]
Python: python_call() [tests/python_call.phpt]
=====================================================================

Same results for php 5.5.x

=====================================================================
PHP         : .../5.5.0alpha1/bin/php 
PHP_SAPI    : cli
PHP_VERSION : 5.5.0alpha1
ZEND_VERSION: 2.5.0-dev
PHP_OS      : Darwin - Darwin xxx.local 12.2.0 Darwin Kernel Version 12.2.0: Sat Aug 25 00:48:52 PDT 2012; root:xnu-2050.18.24~1/RELEASE_X86_64 x86_64
INI actual  : .../ext/php-python/tmp-php.ini
More .INIs  :  
CWD         : .../ext/php-python
Extra dirs  : 
VALGRIND    : Not used
====================================================
FAILED TEST SUMMARY
---------------------------------------------------------------------
Python: Convert Python types to PHP types [tests/convert_to_php.phpt]
Python: foreach [tests/foreach.phpt]
Python: Object (get_properties) [tests/object_get_properties.phpt]
Python: Object (property_exists) [tests/object_property_delete.phpt]
Python: Object (property_exists) [tests/object_property_exists.phpt]
Python: Object (read_property) [tests/object_read_property.phpt]
Python: Object (write_property) [tests/object_write_property.phpt]
Python: python_call() [tests/python_call.phpt]
=====================================================================

Which is not the case for the php 5.3.x counterpart, 100% tests passed

=====================================================================
PHP         : .../5.3.20/bin/php 
PHP_SAPI    : cli
PHP_VERSION : 5.3.20
ZEND_VERSION: 2.3.0
PHP_OS      : Darwin - Darwin xxx.local 12.2.0 Darwin Kernel Version 12.2.0: Sat Aug 25 00:48:52 PDT 2012; root:xnu-2050.18.24~1/RELEASE_X86_64 x86_64
INI actual  : .../ext/php-python/tmp-php.ini
More .INIs  :  
CWD         : .../ext/php-python
Extra dirs  : 
VALGRIND    : Not used
=====================================================================
TIME START 2013-01-12 19:57:42
=====================================================================
PASS Python: Convert Python types to PHP types [tests/convert_to_php.phpt] 
PASS Python: foreach [tests/foreach.phpt] 
PASS Python: INI python.optimize [tests/ini_optimize.phpt] 
PASS Python: Object (count_elements) [tests/object_count_elements.phpt] 
PASS Python: Object (dimension_delete) [tests/object_dimension_delete.phpt] 
PASS Python: Object (dimension_exists) [tests/object_dimension_exists.phpt] 
PASS Python: Object (get_properties) [tests/object_get_properties.phpt] 
PASS Python: Object (property_exists) [tests/object_property_delete.phpt] 
PASS Python: Object (property_exists) [tests/object_property_exists.phpt] 
PASS Python: Object (read_dimension) [tests/object_read_dimension.phpt] 
PASS Python: Object (read_property) [tests/object_read_property.phpt] 
PASS Python: Object (write_dimension) [tests/object_write_dimension.phpt] 
PASS Python: Object (write_property) [tests/object_write_property.phpt] 
PASS Python: php.call() [tests/php_call.phpt] 
PASS Python: php.var() [tests/php_var.phpt] 
PASS Python: php.version() [tests/php_version.phpt] 
PASS Python: python_call() [tests/python_call.phpt] 
PASS Python: python_eval() [tests/python_eval.phpt] 
PASS Python: python_exec() [tests/python_exec.phpt] 
PASS Python: python_version() [tests/python_version.phpt] 
PASS Python: Default streams [tests/streams_default.phpt] 
PASS Python: Default streams [tests/streams_ob.phpt] 
=====================================================================
TIME END 2013-01-12 19:57:47

=====================================================================
TEST RESULT SUMMARY
---------------------------------------------------------------------
Exts skipped    :    0
Exts tested     :   59
---------------------------------------------------------------------

Number of tests :   22                22
Tests skipped   :    0 (  0.0%) --------
Tests warned    :    0 (  0.0%) (  0.0%)
Tests failed    :    0 (  0.0%) (  0.0%)
Expected fail   :    0 (  0.0%) (  0.0%)
Tests passed    :   22 (100.0%) (100.0%)
---------------------------------------------------------------------
Time taken      :    5 seconds
=====================================================================

I am keen to get this committed and see it as a giant leap in the right direction unfortunately the tests would also have to succeed, am I right?

I will see what I can do in the meantime but lets get this sorted quick and check this off the todo list.

@ym Keep up the good work!

jparise commented 11 years ago

I'd definitely be interested in knowing why those tests are failing under PHP 5.4 before I merge this.

nickl- commented 11 years ago

I haven't had all that much time to dig into this, but from what I can tell the changes applied seem to be the correct hammer for the nail. Pending further investigation...

arm4b commented 11 years ago

Thanks for patch, now it's at least compiled for 5.4. Under PHP 5.4 as mentioned before it's unstable. Objects and arrays doesnt't work:

[root@tests]# php /tests/convert_to_php.php
NULL
int(1)
int(1)
float(1.5)
string(6) "string"
string(6) "string"
string(6) "string"
Segmentation fault (core dumped)

It would be really great to have php-python working on PHP 5.4+.

nickl- commented 11 years ago

@armab please provide more details of your stack ie. versions of os, python, etc. and providing the snippets you are testing with will also help.