From e7e985f4e25d2226a24d50a781e4ca295662ff48 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Sun, 16 Mar 2014 19:08:21 +0100 Subject: php-pecl-inclued: 0.1.3 with fix for 5.4, 5.5 and 5.6 --- LICENSE | 68 +++++++++++++++ inclued-svn.patch | 232 ++++++++++++++++++++++++++++++++++++++++++++++++++ php-pecl-inclued.spec | 58 ++++++++++--- 3 files changed, 348 insertions(+), 10 deletions(-) create mode 100644 LICENSE create mode 100644 inclued-svn.patch diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..42536af --- /dev/null +++ b/LICENSE @@ -0,0 +1,68 @@ +-------------------------------------------------------------------- + The PHP License, version 3.01 +Copyright (c) 1999 - 2012 The PHP Group. All rights reserved. +-------------------------------------------------------------------- + +Redistribution and use in source and binary forms, with or without +modification, is permitted provided that the following conditions +are met: + + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + + 3. The name "PHP" must not be used to endorse or promote products + derived from this software without prior written permission. For + written permission, please contact group@php.net. + + 4. Products derived from this software may not be called "PHP", nor + may "PHP" appear in their name, without prior written permission + from group@php.net. You may indicate that your software works in + conjunction with PHP by saying "Foo for PHP" instead of calling + it "PHP Foo" or "phpfoo" + + 5. The PHP Group may publish revised and/or new versions of the + license from time to time. Each version will be given a + distinguishing version number. + Once covered code has been published under a particular version + of the license, you may always continue to use it under the terms + of that version. You may also choose to use such covered code + under the terms of any subsequent version of the license + published by the PHP Group. No one other than the PHP Group has + the right to modify the terms applicable to covered code created + under this License. + + 6. Redistributions of any form whatsoever must retain the following + acknowledgment: + "This product includes PHP software, freely available from + ". + +THIS SOFTWARE IS PROVIDED BY THE PHP DEVELOPMENT TEAM ``AS IS'' AND +ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A +PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE PHP +DEVELOPMENT TEAM OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, +INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, +STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED +OF THE POSSIBILITY OF SUCH DAMAGE. + +-------------------------------------------------------------------- + +This software consists of voluntary contributions made by many +individuals on behalf of the PHP Group. + +The PHP Group can be contacted via Email at group@php.net. + +For more information on the PHP Group and the PHP project, +please see . + +PHP includes the Zend Engine, freely available at +. diff --git a/inclued-svn.patch b/inclued-svn.patch new file mode 100644 index 0000000..a84cf47 --- /dev/null +++ b/inclued-svn.patch @@ -0,0 +1,232 @@ +--- pecl/inclued/trunk/inclued.c 2013/09/23 14:27:53 331472 ++++ pecl/inclued/trunk/inclued.c 2013/09/23 18:23:34 331473 +@@ -108,26 +108,26 @@ + MAKE_STD_ZVAL(class_entry); + array_init(class_entry); + +- add_assoc_stringl_ex(class_entry, "name", sizeof("name"), ce->name, ce->name_length, 1); ++ add_assoc_stringl_ex(class_entry, "name", sizeof("name"), (char*) ce->name, ce->name_length, 1); + if(ce->name[0] != key[0]) + { + add_assoc_stringl_ex(class_entry, "mangled_name", sizeof("mangled_name"), key, keylen-1, 1); + } +- add_assoc_string_ex(class_entry, "filename", sizeof("filename"), CE_INFO(ce, filename), 1); ++ add_assoc_string_ex(class_entry, "filename", sizeof("filename"), (char*) CE_INFO(ce, filename), 1); + add_assoc_long_ex(class_entry, "line", sizeof("line"), CE_INFO(ce, line_start)); + + if(ce->parent) + { + MAKE_STD_ZVAL(parent_entry); + array_init(parent_entry); +- add_assoc_stringl_ex(parent_entry, "name", sizeof("name"), ce->parent->name, ce->parent->name_length, 1); ++ add_assoc_stringl_ex(parent_entry, "name", sizeof("name"), (char*) ce->parent->name, ce->parent->name_length, 1); + if(ce->parent->type == ZEND_INTERNAL_CLASS) + { + add_assoc_bool_ex(parent_entry, "internal", sizeof("internal"), 1); + } + else + { +- add_assoc_string_ex(parent_entry, "filename", sizeof("filename"), CE_INFO(ce, filename), 1); ++ add_assoc_string_ex(parent_entry, "filename", sizeof("filename"), (char*) CE_INFO(ce, filename), 1); + add_assoc_long_ex(parent_entry, "line", sizeof("line"), CE_INFO(ce, line_start)); + } + +--- pecl/inclued/trunk/inclued_zend.c 2013/09/23 14:27:53 331472 ++++ pecl/inclued/trunk/inclued_zend.c 2013/09/23 18:23:34 331473 +@@ -21,43 +21,40 @@ + #include "php_inclued.h" + #include "inclued_zend.h" + +-#define INCLUED_EX_T(offset) (*(temp_variable *)((char*)execute_data->Ts + offset)) ++ ++#if PHP_VERSION_ID >= 50500 ++# define INCLUED_EX_T(offset) (*EX_TMP_VAR(execute_data, offset)) ++#else ++# define INCLUED_EX_T(offset) (*(temp_variable *)((char *) execute_data->Ts + offset)) ++#endif + + static zval *inclued_get_zval_ptr(INCLUED_ZNODE *node, int op_type, zval **freeval, zend_execute_data *execute_data TSRMLS_DC) /* {{{ */ + { ++ zend_free_op free_op1; ++ zval *value = NULL; + *freeval = NULL; +- +- switch (op_type) { +- case IS_CONST: +-#if PHP_VERSION_ID >= 50400 +- return INCLUED_ZNODE_ELEM(node, zv); ++#if PHP_VERSION_ID >= 50600 ++ value = zend_get_zval_ptr(op_type, node, execute_data, &free_op1, BP_VAR_R TSRMLS_CC); + #else +- return &(INCLUED_ZNODE_ELEM(node, constant)); +-#endif +- case IS_VAR: +- return INCLUED_EX_T(INCLUED_ZNODE_ELEM(node, var)).var.ptr; +- case IS_TMP_VAR: +- return (*freeval = &INCLUED_EX_T(INCLUED_ZNODE_ELEM(node, var)).tmp_var); +-#ifdef ZEND_ENGINE_2_1 +- case IS_CV: +- { +- zval ***ret = &execute_data->CVs[INCLUED_ZNODE_ELEM(node, var)]; +- +- if (!*ret) { +- zend_compiled_variable *cv = &EG(active_op_array)->vars[INCLUED_ZNODE_ELEM(node, var)]; +- +- if (zend_hash_quick_find(EG(active_symbol_table), cv->name, cv->name_len+1, cv->hash_value, (void**)ret)==FAILURE) { +- zend_error(E_NOTICE, "Undefined variable: %s", cv->name); +- return &EG(uninitialized_zval); +- } +- } +- return **ret; +- } ++ value = zend_get_zval_ptr(op_type, node, execute_data->Ts, &free_op1, BP_VAR_R TSRMLS_CC); + #endif +- case IS_UNUSED: +- default: +- return NULL; ++ *freeval = free_op1.var; ++ return value; ++} ++/* }}} */ ++ ++static int is_autoload(const char *function_name) /* {{{ */ ++{ ++ /* TODO: config option? */ ++ if(strcmp("__autoload", function_name) == 0) ++ { ++ return 1; ++ } ++ if(strcmp("spl_autoload", function_name) == 0) ++ { ++ return 1; + } ++ return 0; + } + /* }}} */ + +@@ -121,12 +118,12 @@ + array_init(include_entry); + add_assoc_string_ex(include_entry, "operation", sizeof("operation"), operation, 1); + add_assoc_long_ex(include_entry, "op_type", sizeof("op_type"), op_type); +- add_assoc_string_ex(include_entry, "fromfile", sizeof("fromfile"), execute_data->op_array->filename, 1); ++ add_assoc_string_ex(include_entry, "fromfile", sizeof("fromfile"), (char*)execute_data->op_array->filename, 1); + add_assoc_long_ex(include_entry, "fromline", sizeof("fromline"), opline->lineno); + + if(execute_data->op_array->function_name) + { +- add_assoc_string_ex(include_entry, "function", sizeof("function"), (char*)execute_data->op_array->function_name, 1); ++ add_assoc_string_ex(include_entry, (char*) "function", sizeof("function"), (char*)execute_data->op_array->function_name, 1); + } + + add_next_index_zval(includes_hash, include_entry); +@@ -149,7 +146,7 @@ + inc_filename = &tmp_inc_filename; + } + +- wrapper = php_stream_locate_url_wrapper(Z_STRVAL_P(inc_filename), &path_for_open, 0 TSRMLS_CC); ++ wrapper = php_stream_locate_url_wrapper(Z_STRVAL_P(inc_filename), (const char**)&path_for_open, 0 TSRMLS_CC); + + + if(SUCCESS == zend_stream_open(inc_filename->value.str.val, &file_handle TSRMLS_CC)) +@@ -183,15 +180,15 @@ + add_assoc_bool_ex(include_entry, "duplicate", sizeof("duplicate"), 1); + } + +- add_assoc_string_ex(include_entry, "fromfile", sizeof("fromfile"), execute_data->op_array->filename, 1); ++ add_assoc_string_ex(include_entry, "fromfile", sizeof("fromfile"), (char*) execute_data->op_array->filename, 1); + add_assoc_long_ex(include_entry, "fromline", sizeof("fromline"), opline->lineno); + + if(execute_data->op_array->function_name) + { +- add_assoc_string_ex(include_entry, "function", sizeof("function"), (char*)execute_data->op_array->function_name, 1); ++ add_assoc_string_ex(include_entry, "function", sizeof("function"), (char*) execute_data->op_array->function_name, 1); + } + +- if(execute_data->op_array->function_name && (strcmp("__autoload", execute_data->op_array->function_name) == 0)) ++ if(execute_data->op_array->function_name && is_autoload(execute_data->op_array->function_name)) + { + real_execute_data = execute_data->prev_execute_data; + if(real_execute_data->opline == NULL && +@@ -203,7 +200,7 @@ + + real_execute_data = real_execute_data->prev_execute_data; + +- add_assoc_string_ex(autoload_entry, "fromfile", sizeof("fromfile"), real_execute_data->op_array->filename, 1); ++ add_assoc_string_ex(autoload_entry, "fromfile", sizeof("fromfile"), (char*) real_execute_data->op_array->filename, 1); + add_assoc_long_ex(autoload_entry, "fromline", sizeof("fromline"), real_execute_data->opline->lineno); + + add_assoc_zval(include_entry, "autoload", autoload_entry); +@@ -221,7 +218,7 @@ + + if(wrapper != &php_plain_files_wrapper) + { +- add_assoc_string_ex(include_entry, "streamwrapper", sizeof("streamwrapper"), (char*)wrapper->wops->label, 1); ++ add_assoc_string_ex(include_entry, "streamwrapper", sizeof("streamwrapper"), (char*) wrapper->wops->label, 1); + } + + add_next_index_zval(includes_hash, include_entry); +@@ -254,11 +251,11 @@ + #define INCLUED_ZCE(entry, ce) do { \ + MAKE_STD_ZVAL(entry); \ + array_init(entry); \ +- add_assoc_stringl(entry, "name", ce->name, ce->name_length, 1); \ ++ add_assoc_stringl(entry, "name", (char*) ce->name, ce->name_length, 1); \ + if(ce->type == ZEND_INTERNAL_CLASS) { \ + add_assoc_bool(entry, "internal", 1); \ + } else { \ +- add_assoc_string(entry, "filename", CE_INFO(ce, filename), 1); \ ++ add_assoc_string(entry, "filename", (char*) CE_INFO(ce, filename), 1); \ + add_assoc_long(entry, "line", CE_INFO(ce, line_start)); \ + } \ + }while(0) +@@ -281,7 +278,7 @@ + /* TODO: class flags - public, private, abstract etc ... */ + + add_assoc_string(class_entry, "operation", (opcode == ZEND_DECLARE_CLASS) ? "declare_class" : "declare_inherited_class", 1); +- add_assoc_string(class_entry, "filename", execute_data->op_array->filename, 1); ++ add_assoc_string(class_entry, "filename", (char*) execute_data->op_array->filename, 1); + add_assoc_long(class_entry, "line", opline->lineno); + #if PHP_VERSION_ID >= 50400 + add_assoc_stringl(class_entry,"name", Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv), 1); +@@ -302,7 +299,7 @@ + + if(execute_data->op_array->function_name) + { +- add_assoc_string(class_entry, "function", (char*)execute_data->op_array->function_name, 1); ++ add_assoc_string(class_entry, "function", (char*) execute_data->op_array->function_name, 1); + } + + add_next_index_zval(inh_hash, class_entry); +@@ -336,9 +333,9 @@ + array_init(iface_entry); + + add_assoc_string(iface_entry, "operation", "add_interface", 1); +- add_assoc_string(iface_entry, "filename", execute_data->op_array->filename, 1); ++ add_assoc_string(iface_entry, "filename", (char*) execute_data->op_array->filename, 1); + add_assoc_long(iface_entry, "line", opline->lineno); +- add_assoc_stringl(iface_entry, "class_name", ce->name, ce->name_length, 1); ++ add_assoc_stringl(iface_entry, "class_name", (char*) ce->name, ce->name_length, 1); /* contains \0 */ + + if(execute_data->op_array->function_name) + { +--- pecl/inclued/trunk/gengraph.php 2013/09/23 18:23:34 331473 ++++ pecl/inclued/trunk/gengraph.php 2013/09/23 18:27:55 331474 +@@ -233,7 +233,6 @@ + + $content = <<= 50600 ++#if PHP_VERSION_ID >= 50500 + value = zend_get_zval_ptr(op_type, node, execute_data, &free_op1, BP_VAR_R TSRMLS_CC); + #else + value = zend_get_zval_ptr(op_type, node, execute_data->Ts, &free_op1, BP_VAR_R TSRMLS_CC); diff --git a/php-pecl-inclued.spec b/php-pecl-inclued.spec index b0291e4..fb4c796 100644 --- a/php-pecl-inclued.spec +++ b/php-pecl-inclued.spec @@ -23,6 +23,13 @@ URL: http://pecl.php.net/package/%{pecl_name} Source0: http://pecl.php.net/get/%{pecl_name}-%{version}.tgz # https://bugs.php.net/65841 Please Provides LICENSE file +# http://svn.php.net/viewvc?view=revision&revision=331713 +Source1: LICENSE + +# http://svn.php.net/viewvc?view=revision&revision=331473 +# http://svn.php.net/viewvc?view=revision&revision=331474 +# http://svn.php.net/viewvc?view=revision&revision=333016 +Patch0: %{pecl_name}-svn.patch BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildRequires: php-devel @@ -38,9 +45,25 @@ Provides: php-%{pecl_name}%{?_isa} = %{version} Provides: php-pecl(%{pecl_name}) = %{version} Provides: php-pecl(%{pecl_name})%{?_isa} = %{version} -# Filter shared private +%if "%{?vendor}" == "Remi Collet" +# Other third party repo stuff +Obsoletes: php53-pecl-%{pecl_name} +Obsoletes: php53u-pecl-%{pecl_name} +Obsoletes: php54-pecl-%{pecl_name} +%if "%{php_version}" > "5.5" +Obsoletes: php55u-pecl-%{pecl_name} +%endif +%if "%{php_version}" > "5.6" +Obsoletes: php56u-pecl-%{pecl_name} +%endif +%endif + +%if 0%{?fedora} < 20 +# Filter private shared %{?filter_provides_in: %filter_provides_in %{_libdir}/.*\.so$} %{?filter_setup} +%endif + %description Allows you trace through and dump the hierarchy of file inclusions @@ -51,10 +74,18 @@ and class inheritance at runtime. %setup -q -c mv %{pecl_name}-%{version} NTS +sed -e '/gengraph.php/s/role="php"/role="doc"/' -i package.xml + cd NTS # no shebang, and will be provided as doc only chmod -x gengraph.php +cp %{SOURCE1} LICENSE + +%if "%{php_version}" > "5.4" +%patch0 -p3 -b .svn +%endif + # Sanity check, really often broken extver=$(sed -n '/#define PHP_INCLUED_VERSION/{s/.* "//;s/".*$//;p}' php_inclued.h) if test "x${extver}" != "x%{version}%{?prever:-%{prever}}"; then @@ -104,8 +135,7 @@ make %{?_smp_mflags} %install rm -rf %{buildroot} -make -C NTS \ - install INSTALL_ROOT=%{buildroot} +make -C NTS install INSTALL_ROOT=%{buildroot} # install config file install -D -m 644 %{pecl_name}.ini %{buildroot}%{php_inidir}/%{pecl_name}.ini @@ -114,12 +144,17 @@ install -D -m 644 %{pecl_name}.ini %{buildroot}%{php_inidir}/%{pecl_name}.ini install -D -m 644 package.xml %{buildroot}%{pecl_xmldir}/%{name}.xml %if %{with_zts} -make -C ZTS \ - install INSTALL_ROOT=%{buildroot} +make -C ZTS install INSTALL_ROOT=%{buildroot} install -D -m 644 %{pecl_name}.ini %{buildroot}%{php_ztsinidir}/%{pecl_name}.ini %endif +# Test & Documentation +cd NTS +for i in LICENSE $(grep 'role="doc"' ../package.xml | sed -e 's/^.*name="//;s/".*$//') +do install -Dpm 644 $i %{buildroot}%{pecl_docdir}/%{pecl_name}/$i +done + %post %{pecl_install} %{pecl_xmldir}/%{name}.xml >/dev/null || : @@ -134,15 +169,13 @@ fi %check # Minimal load test for NTS extension php --no-php-ini \ - --define extension_dir=NTS/modules \ - --define extension=%{pecl_name}.so \ + --define extension=%{buildroot}%{php_extdir}/%{pecl_name}.so \ --modules | grep %{pecl_name} %if %{with_zts} # Minimal load test for ZTS extension %{__ztsphp} --no-php-ini \ - --define extension_dir=ZTS/modules \ - --define extension=%{pecl_name}.so \ + --define extension=%{buildroot}%{php_ztsextdir}/%{pecl_name}.so \ --modules | grep %{pecl_name} %endif @@ -153,8 +186,9 @@ rm -rf %{buildroot} %files %defattr(-,root,root,-) -%doc NTS/gengraph.php +%doc %{pecl_docdir}/%{pecl_name} %{pecl_xmldir}/%{name}.xml + %config(noreplace) %{php_inidir}/%{pecl_name}.ini %{php_extdir}/%{pecl_name}.so @@ -165,5 +199,9 @@ rm -rf %{buildroot} %changelog +* Sun Mar 16 2014 Remi Collet - 0.1.3-2 +- install doc in pecl_docdir +- upstream patch for php 5.5+ + * Sun Oct 6 2013 Remi Collet - 0.1.3-1 - initial package -- cgit