[2.0.0-snap] write.tar.id3v2.php error (*patch*)

Locked
Shadzik
User
Posts:3
Joined:Fri Jun 15, 2007 9:22 am
Location:Poland
[2.0.0-snap] write.tar.id3v2.php error (*patch*)

Post by Shadzik » Fri Jun 15, 2007 11:45 am

there was many bugs i found, not corrected class name, missing functions, missing arguments.

Code: Select all

Warning: Missing argument 1 for getid3_write_id3v2::generate_frame_flags(), called in /home/shadzik/www/getid3-2.0.0b4/getid3/write.id3v2.php on line 466 and defined in /home/shadzik/www/getid3-2.0.0b4/getid3/write.id3v2.php on line 514

Parse error: syntax error, unexpected T_STRING, expecting T_FUNCTION in /home/shadzik/www/getid3-20/getid3/write.id3v2.php on line 403

...
sorry i forgot to write all error
i made some changes:

missing static method i have take it from getID3 v1.7.7
in getid3.php:

Code: Select all

1377a1378,1399
>
>
>         public static function BigEndian2String($number, $minbytes=1, $synchsafe=false, $signed=false) {
>                 if ($number < 0) {
>                         return false;
>                 }
>                 $maskbyte = (($synchsafe || $signed) ? 0x7F : 0xFF);
>                 $intstring = '';
>                 if ($signed) {
>                         if ($minbytes > 4) {
>                                 die('ERROR: Cannot have signed integers larger than 32-bits in getid3_lib::BigEndian2String()');
>                         }
>                         $number = $number & (0x80 << (8 * ($minbytes - 1)));
>                 }
>                 while ($number != 0) {
>                         $quotient = ($number / ($maskbyte + 1));
>                         $intstring = chr(ceil(($quotient - floor($quotient)) * $maskbyte)).$intstring;
>                         $number = floor($quotient);
>                 }
>                 return str_pad($intstring, $minbytes, "\x00", STR_PAD_LEFT);
>         }
>
write.id3v2.php:

Code: Select all

14,15c14,15
< // | Authors: James Heinrich <info�getid3*org>                            |
< // |          Allan Hansen <ah�artemis*dk>                                |
---
> // | Authors: James Heinrich <info[AT]getid3*org>                            |
> // |          Allan Hansen <ah[AT]artemis*dk>                                |
377c377
<         else
---
>         else {
466c466
<                 $frame_flags  = $this->generate_frame_flags();
---
>                 $frame_flags  = $this->generate_frame_flags(); //here is missing something ? Many times warning
472c472
< 
---
>       
484c484
<         $header .= chr(getid3_id3v2_write::major_version);
---
>         $header .= chr(getid3_write_id3v2::major_version);
982c982
<                     throw new getid3_exception('Invalid Picture Type byte in '.$frame_name.' ('.$source_data_array['picturetypeid'].') for ID3v2.'.getid3_id3v2_write::major_version);
---
>                     throw new getid3_exception('Invalid Picture Type byte in '.$frame_name.' ('.$source_data_array['picturetypeid'].') for ID3v2.'.getid3_write_id3v2::major_version);
984,985c984,985
<                 if ((getid3_id3v2_write::major_version >= 3) && (!$this->ID3v2IsValidAPICimageformat($source_data_array['mime']))) {
<                     throw new getid3_exception('Invalid MIME Type in '.$frame_name.' ('.$source_data_array['mime'].') for ID3v2.'.getid3_id3v2_write::major_version);
---
>                 if ((getid3_write_id3v2::major_version >= 3) && (!$this->ID3v2IsValidAPICimageformat($source_data_array['mime']))) {
>                     throw new getid3_exception('Invalid MIME Type in '.$frame_name.' ('.$source_data_array['mime'].') for ID3v2.'.getid3_write_id3v2::major_version);
1084c1084
<                 if (!getid3_id3v2::valid_frame_name($source_data_array['frameid'], getid3_id3v2_write::major_version)) {
---
>                 if (!getid3_id3v2::valid_frame_name($source_data_array['frameid'], getid3_write_id3v2::major_version)) {
1133c1133
<                         if (getid3_id3v2_write::major_version == 3) {
---
>                         if (getid3_write_id3v2::major_version == 3) {
1136c1136
<                             throw new getid3_exception($source_data_array['frameid'].' is not a valid Frame Identifier in '.$frame_name.' (in ID3v2.'.getid3_id3v2_write::major_version.')');
---
>                             throw new getid3_exception($source_data_array['frameid'].' is not a valid Frame Identifier in '.$frame_name.' (in ID3v2.'.getid3_write_id3v2::major_version.')');
1143c1143
<                             throw new getid3_exception($source_data_array['frameid'].' is not a valid Frame Identifier in '.$frame_name.' (in ID3v2.'.getid3_id3v2_write::major_version.')');
---
>                             throw new getid3_exception($source_data_array['frameid'].' is not a valid Frame Identifier in '.$frame_name.' (in ID3v2.'.getid3_write_id3v2::major_version.')');
1384c1384
<         if (getid3_id3v2_write::major_version == 4) {
---
>         if (getid3_write_id3v2::major_version == 4) {
1506c1506
<                         throw new getid3_exception('Frame not allowed in ID3v2.'.getid3_id3v2_write::major_version.': '.$frame_name);
---
>                         throw new getid3_exception('Frame not allowed in ID3v2.'.getid3_write_id3v2::major_version.': '.$frame_name);
1511c1511
<         } elseif (getid3_id3v2_write::major_version == 3) {
---
>         } elseif (getid3_write_id3v2::major_version == 3) {
1631d1630
<                         throw new getid3_exception('Frame not allowed in ID3v2.'.getid3_id3v2_write::major_version.': '.$frame_name);
1663c1662
<         } elseif (($event_id >= 0x0E) && ($event_id <= 0x16) && (getid3_id3v2_write::major_version == 2)) {
---
>         } elseif (($event_id >= 0x0E) && ($event_id <= 0x16) && (getid3_write_id3v2::major_version == 2)) {
1666c1665
<         } elseif (($event_id >= 0x15) && ($event_id <= 0x16) && (getid3_id3v2_write::major_version == 3)) {
---
>         } elseif (($event_id >= 0x15) && ($event_id <= 0x16) && (getid3_write_id3v2::major_version == 3)) {
1675c1674
<         if (($content_type >= 0) && ($content_type <= 8) && (getid3_id3v2_write::major_version == 4)) {
---
>         if (($content_type >= 0) && ($content_type <= 8) && (getid3_write_id3v2::major_version == 4)) {
1677c1676
<         } elseif (($content_type >= 0) && ($content_type <= 6) && (getid3_id3v2_write::major_version == 3)) {
---
>         } elseif (($content_type >= 0) && ($content_type <= 6) && (getid3_write_id3v2::major_version == 3)) {
1686c1685
<         if (($channel_type >= 0) && ($channel_type <= 8) && (getid3_id3v2_write::major_version == 4)) {
---
>         if (($channel_type >= 0) && ($channel_type <= 8) && (getid3_write_id3v2::major_version == 4)) {
1695c1694
<         if (($picture_type >= 0) && ($picture_type <= 0x14) && (getid3_id3v2_write::major_version >= 2) && (getid3_id3v2_write::major_version <= 4)) {
---
>         if (($picture_type >= 0) && ($picture_type <= 0x14) && (getid3_write_id3v2::major_version >= 2) && (getid3_write_id3v2::major_version <= 4)) {
1706c1705
<         } elseif (getid3_id3v2_write::major_version == 2) {
---
>         } elseif (getid3_write_id3v2::major_version == 2) {
1710c1709
<         } elseif ((getid3_id3v2_write::major_version == 3) || (getid3_id3v2_write::major_version == 4)) {
---
>         } elseif ((getid3_write_id3v2::major_version == 3) || (getid3_write_id3v2::major_version == 4)) {
1721c1720
<         if ((getid3_id3v2_write::major_version >= 3) && ($received_as >= 0) && ($received_as <= 8)) {
---
>         if ((getid3_write_id3v2::major_version >= 3) && ($received_as >= 0) && ($received_as <= 8)) {
1748c1747
<         // written by dev-null�christophe*vg
---
>         // written by dev-null[AT]christophe*vg
Sorry for changing the email adress bu there was something not right with encoding

I try to do some others chenges, i have notice that writing headers is broken or should i say there is no header after writing.


Other question, maybe i'm wrong but if obcjects or methods responsible for writing and reading should be in one object ? This could resolve problem with generate_frame_flags() and rewriting flags in header.
Last edited by Shadzik on Fri Jun 15, 2007 12:31 pm, edited 1 time in total.

Allan Hansen
getID3() v2 developer
Posts:445
Joined:Sun May 04, 2003 2:22 pm
Location:Holmegaard, Denmark

Post by Allan Hansen » Fri Jun 15, 2007 12:17 pm

Thank you very much for having a go at this file. I know it is broken and missing a lot of functions. It is the single file that prevents 2.0.0 final from happening.

Regarding the e-mail addresses and the encoding: All source files are encoded in ISO-8859-1. However, if your editor thinks it is UTF-8 encoded then it will mess them up. I know this to be a problem for UltraEdit.

I am affraid I do not understand your last question.

Thanks again.

Shadzik
User
Posts:3
Joined:Fri Jun 15, 2007 9:22 am
Location:Poland

Post by Shadzik » Fri Jun 15, 2007 12:28 pm

hmm, sorry for my english but i don't use it very much :)

in last question i try to say to combine reading and writing module in one. In writing module there is missing attribute in generate_frame_flags() method. There should be attribute with flags description. In write tag module is no method that read current flags to write them again with all changes.

if i have more free time i will try to fix few more bugs :)

Allan Hansen
getID3() v2 developer
Posts:445
Joined:Sun May 04, 2003 2:22 pm
Location:Holmegaard, Denmark

Post by Allan Hansen » Fri Jun 15, 2007 12:53 pm

Okay, I think I understand your question now.

Several years ago reading and writing were combined in the same classes. This was changed because the ID3v2 format is very complex and require lots of code. All this code requires lots of memory and getID3() was growing into a very memory consuming project. Standard PHP installations only has 8Mb memory available and we wanted getID3() to be usable on as many systems as possible.

So we want reading and writing seperated in two modules with reading module not requiring writing module. It is acceptable if writing module requires reading module.

This may mean some code to copy headers from output generated by reader or just writing new headers based on the settings.

Locked